Baseline Widely available
The getTrackById()
method of the MediaStream
interface 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
.
id
A string which identifies the track to be returned.
If a track is found for which MediaStreamTrack.id
matches the specified id
string, that MediaStreamTrack
object is returned. Otherwise, the returned value is null
.
This example activates a commentary track on a video by ducking the audio level of the main audio track to 50%, then enabling the commentary track.
stream.getTrackById("primary-audio-track").applyConstraints({ volume: 0.5 });
stream.getTrackById("commentary-track").enabled = true;
Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3