Canvas JavaScript

MediaStream Class

MediaStream Class
InheritsDescription
EventTarget
ConstructorsDescription
MediaStream()
MediaStream(stream)
MediaStream(tracks)
The constructor can take a MediaStream object, stream, and share its tracks, or it can take an Array of MediaStreamTrack objects, tracks, which are added to the stream.
PropertiesDescription
activeThis is a read-only boolean value which is true when any of its MediaStreamTracks does not have its readyState set to "ended".
idThis is a read-only string value consisting of 36 characters that make up a globally unique idnetifier (GUID) for the object.
MethodsDescription
addTrack(track)This method adds the MediaStreamTrack instance track to the stream.
MediaStream clone()This clones the stream object and all of its tracks (MediaStreamTrack instances) into a new MediaStream with a new id.
Array getAudioTracks()This returns an array of MediaStreamTrack object, one for each audio track contained in the stream. An audio track has its kind property set to "audio".
MediaStreamTrack getTrackById(id)This returns the MediaStreamTrack in this object that is associated with the string id that was passed in. If no track exists with that id, null is returned.
Array getTracks()This returns an array of all of the MediaStreamTrack objects that are contained in the track set of this stream.
Array getVideoTracks()This returns an array of MediaStreamTrack object, one for each video track contained in the stream. A video track has its kind property set to "video".
removeTrack()
EventsDescription
addtrackThis is fired when a MediaStreamTrack is added. It is can not be cancelled and does not bubble.
removetrackThis is fired when a MediaStreamTrack is removed. It is can not be cancelled and does not bubble.
 
 

© 2007–2025 XoaX.net LLC. All rights reserved.