webrtc.interfaces.media_stream#
- class webrtc.interfaces.media_stream.MediaStream(native_obj=None)#
Bases:
webrtc.base.WebRTCObjectThe MediaStream interface represents a stream of media content. A stream consists of several tracks, such as video or audio tracks. Each track is specified as an instance of
webrtc.MediaStreamTrack.- property active: bool#
A value that returns true if the
webrtc.MediaStreamis active, or false otherwise.- Type
bool
- addTrack(track: webrtc.MediaStreamTrack)#
Alias for
add_track
- add_track(track: webrtc.MediaStreamTrack)#
Stores a copy of the
webrtc.MediaStreamTrackgiven as argument. If the track has already been added to thewebrtc.MediaStreamobject, nothing happens.
- clone() webrtc.MediaStream#
Returns a clone of the
webrtc.MediaStreamobject. The clone will, however, have a unique value forid.
- getAudioTracks() List[webrtc.MediaStreamTrack]#
Alias for
get_audio_tracks
- getTrackById(track_id: str) Optional[webrtc.MediaStreamTrack]#
Alias for
get_track_by_id
- getTracks() List[webrtc.MediaStreamTrack]#
Alias for
get_tracks
- getVideoTracks() List[webrtc.MediaStreamTrack]#
Alias for
get_video_tracks
- get_audio_tracks() List[webrtc.MediaStreamTrack]#
Returns a
listof thewebrtc.MediaStreamTrackobjects stored in thewebrtc.MediaStreamobject that have their kind attribute set to “audio”. The order is not defined, and may not only vary from one machine to another, but also from one call to another.
- get_track_by_id(track_id: str) Optional[webrtc.MediaStreamTrack]#
Returns the track whose ID corresponds to the one given in parameters,
track_id. If no parameter is given, or if no track with that ID does exist, it returnsNone. If several tracks have the same ID, it returns the first one.
- get_tracks() List[webrtc.MediaStreamTrack]#
Returns a
listof allwebrtc.MediaStreamTrackobjects stored in thewebrtc.MediaStreamobject, regardless of the value of the kind attribute. The order is not defined, and may not only vary from one machine to another, but also from one call to another.
- get_video_tracks() List[webrtc.MediaStreamTrack]#
Returns a
listof thewebrtc.MediaStreamTrackobjects stored in thewebrtc.MediaStreamobject that have their kind attribute set to “video”. The order is not defined, and may not only vary from one machine to another, but also from one call to another.
- property id: str#
A String containing 36 characters denoting a universally unique identifier (UUID) for the object.
- Type
str
- removeTrack(track: webrtc.MediaStreamTrack)#
Alias for
remove_track
- remove_track(track: webrtc.MediaStreamTrack)#
Removes the
webrtc.MediaStreamTrackgiven as argument. If the track is not part of thewebrtc.MediaStreamobject, nothing happens.