Video videoTracks attribute

Definition and usage

videoTracks Properties return the VideoTrackList object.

The VideoTrackList object represents the available video tracks of the video.

Each available video track is represented by a VideoTrack object.

Example

Get the number of available video tracks:

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

Try it yourself

Syntax

videoObject.videoTracks

Return value

Type Description
VideoTrackList object

Represents the available video tracks of the video.

VideoTrackList object:

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

Note:The first available VideoTrack object is at index 0.

VideoTrack object

Represents the video track.

VideoTrack object properties:

  • id - Get the id of the video track
  • kind - Get the type of the video track
  • label - Get the label of the video track
  • language - Get the language of the video track
  • selected - Get or set whether the track is in an active state (true|false)

The value of the kind attribute:

  • "alternative"
  • "captions"
  • "main"
  • "sign"
  • "subtitles"
  • "commentary"
  • "" (Empty String)

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Not Supported Not Supported Not Supported Not Supported Not Supported