Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

MediaStream.getTrackById()

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!

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.

Syntax

var track = MediaStream.getTrackById(id);

Parameters

id
A DOMString which identifies the track to be returned.

Return value

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.

Example

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

Specification Status Comment
Media Capture and Streams
The definition of 'getTrackById()' in that specification.
Editor's Draft Initial specification.

Browser compatibility

?
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support ? 49 (49) No support ? ?
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? 49.0 (49) No support ? ?

See also

ドキュメントのタグと貢献者

 このページの貢献者: Sheppy
 最終更新者: Sheppy,