Advertisement
Home Open Editor ❯

HTML Audio/Video DOM textTracks Property

Example

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

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

Try this code ❯

Meaning

The textTracks property returns a TextTrackList object representing the available text tracks.

Note: The first available TextTrack object is index 0.


Standard Syntax

audio|video.textTracks


Advertisement

Return Value

Type Description
TextTrackList Object Returns the available text tracks for the the audio/video.
  • length: get the number of text tracks available in the audio/video.
  • [index]: get TextTrack object by index.
TextTrack Object Returns an text track.
  • activeCues: get the currently active text track cues as a TextTrackCueList object.
  • addCue(cue): add a cue to the list of cues.
  • cues: get a list of cues as a TextTrackCueList object.
  • 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").
Home Open Editor ❯
Advertisement