HTML 오디오/비디오 DOM videoTracks 속성

❮ HTML 오디오/비디오 DOM 참조

예시

사용 가능한 비디오 트랙 수 가져오기:

var vid = document.getElementById("myVideo");
alert(vid.videoTracks.length);

정의 및 사용

videoTracks 속성은 VideoTrackList 객체를 반환합니다.

VideoTrackList 객체는 비디오에 사용 가능한 비디오 트랙을 나타냅니다.

사용 가능한 각 비디오 트랙은 VideoTrack 개체로 표시됩니다.


브라우저 지원

Property
videoTracks Not supported Not supported Not supported Not supported Not supported

통사론

video.videoTracks

반환 값

Type Description
VideoTrackList Object Represents the available video tracks for the video.

VideoTrackList Object:

  • videoTracks.length - get the number of video tracks available in the video
  • videoTracks.getTrackById(id) - get VideoTrack object by id
  • videoTracks[index] - get VideoTrack object by index
  • videoTracks.selectedIndex - get the index of the current VideoTrack object

Note: The first available VideoTrack object is index 0

VideoTrack Object Represents a video track.

VideoTrack Object Properties:

  • id - get the id of the video track
  • kind - get the type of the video track (can be: "alternative", "captions", "main", "sign", "subtitles", "commentary", or "" (empty string)) 
  • label - get the label of the video track
  • language - get the language of the video track
  • selected - get or set if the track is active (true|false)

❮ HTML 오디오/비디오 DOM 참조