WebRTC consists of several interrelated APIs and protocols which work together to support the exchange of data and media between two or more peers. This article provides a brief overview of each of these APIs and what purpose it serves.
The MediaStreaminterface represents a stream of media content. A stream consists of several trackssuch as video or audio tracks. Each track is specified as an instance of MediaStreamTrack.
The MediaStream.getTrackById() method returns a MediaStreamTrack object representing the track with the specified ID string. If there is no track with the specified ID, this method returns null.
The MediaStreamTrack.enabled property returns a Boolean with a value of true if the track is enabled, that is allowed to render the media source stream; or false if it is disabled, that is not rendering the media source stream but silence and blackness. If the track has been disconnected, this value can be changed but has no effect.
The MediaStreamTrack.onunmute event handler is a property called when the unmute event is received. Such an event is sent when the track is again able to send data.
The MediaStreamTrack.stop() method stops playing the source associated with the track. Both the source and the track are deassociated. The track state is set to ended.