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

HTML Audio/Video DOM textTracks Property

HTML audio Tag Reference HTML Audio/Video DOM Reference

Example

Get the number of available text tracks:

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

Try it Yourself »

Definition and Usage

The textTracks property returns a TextTrackList object.

The TextTrackList object represents the available text tracks for the audio/video.

Each available text track is represented by an TextTrack Object.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The textTracks property is supported in Internet Explorer 10, Opera, Chrome, and Safari 6.

Note: The textTracks property is not supported in Internet Explorer 9 and earlier versions.


Syntax

audio|video.textTracks

Return Value

Type Description
TextTrackList Object Represents the available text tracks for the the audio/video.

TextioTrackList Object:

  • length - get the number of text tracks available in the audio/video
  • [index] - get TextTrack object by index

Note: The first available TextTrack object is index 0

TextTrack Object Represents an text track.

TextTrack Object Properties:

  • kind - get the type of the text track (can be: "subtitles", "caption", "descriptions", "chapters", or "metadata")
  • label - get the label of the text track
  • language - get the language of the text track
  • mode - get or set if the track is active ("disabled"|"hidden"|"showing")
  • cues - get a list of cues as a TextTrackCueList object
  • activeCues - get the currently active text track cues as a TextTrackCueList object
  • addCue(cue) - add a cue to the list of cues
  • removeCue(cue) - remove a cue from the list of cues


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 BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE