X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML Audio/Video DOM videoTracks Property

HTML audio Tag Reference HTML Audio/Video DOM Reference

Example

Get the number of available video tracks:

myVid=document.getElementById("video1");
alert(myVid.videoTracks.length);

Try it Yourself »

Definition and Usage

The videoTracks property returns a VideoTrackList object.

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

Each available video track is represented by an VideoTrack Object.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The videoTracks property is not supported in any major browser.


Syntax

video.videoTracks

Return Value

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 audio Tag Reference HTML Audio/Video DOM Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook