The 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 MediaStreamTrack.
Creates and returns a new MediaStream object. You can create an empty stream, a stream which is based upon an existing stream, or a stream that contains a specified list of tracks (specified as an array of MediaStreamTrack objects).
Instance properties
This interface inherits properties from its parent, EventTarget.
Returns a list of the MediaStreamTrack objects stored in the MediaStream object that have their kind attribute set to audio. The order is not defined, and may not only vary from one browser to another, but also from one call to another.
Returns the track whose ID corresponds to the one given in parameters, trackid. If no parameter is given, or if no track with that ID does exist, it returns null. If several tracks have the same ID, it returns the first one.
Returns a list of all MediaStreamTrack objects stored in the MediaStream object, regardless of the value of the kind attribute. The order is not defined, and may not only vary from one browser to another, but also from one call to another.
Returns a list of the MediaStreamTrack objects stored in the MediaStream object that have their kind attribute set to "video". The order is not defined, and may not only vary from one browser to another, but also from one call to another.
22Before Firefox 64, this method returned an array of AudioStreamTrack objects. However, MediaStreamTrack has now subsumed that interface's functionality.
No
15
11
37
26
22Before Firefox 64, this method returned an array of AudioStreamTrack objects. However, MediaStreamTrack has now subsumed that interface's functionality.
No
11
1.5
getTrackById
26
12
49
No
No
11
37
26
49
No
11
1.5
getTracks
38
12
34
No
25
11
38
38
34
25
11
3.0
getVideoTracks
26
12
22Before Firefox 64, this method returned an array of VideoStreamTrack objects. However, MediaStreamTrack has now subsumed that interface's functionality.
No
15
11
37
26
22Before Firefox 64, this method returned an array of VideoStreamTrack objects. However, MediaStreamTrack has now subsumed that interface's functionality.
No
11
1.5
id
26
12
41
No
15
11
4.4
26
41
14
11
1.5
inactive_event
42
12
No
No
29
No
42
42
No
29
No
4.0
removeTrack
26
12
44
No
15
11
37
26
44
No
11
1.5
removetrack_event
26
12
7259–72Before Firefox 72, the event handler was exposed but had no effect.
No
No
11
4.4
26
7959–79Before Firefox 72, the event handler was exposed but had no effect.