Advertisement
Home Open Editor ❯

HTML Audio/Video DOM videoTracks Property

Example

var vid = document.getElementById("myVideo");

function myFunction() {
  alert(vid.videoTracks.length);
}

Try this code ❯

Meaning

The videoTracks property returns a VideoTrackList object representing the available video tracks.

Note: The first available VideoTrack object is index 0.


Standard Syntax

audio|video.videoTracks


Advertisement

Property Value

Type Description
VideoTrackList Object Returns the available video tracks for the video.
  • length: get the number of video tracks available in the video.
  • getTrackById(id): get VideoTrack object by id.
  • [index]: get VideoTrack object by index.
  • selectedIndex: get the index of the current VideoTrack object.
VideoTrack Object Represents a video track.
  • 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).
Home Open Editor ❯
Advertisement