HTML Audio/Video DOM textTracks Property

❮ HTML Audio/Video DOM Reference

Example

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

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

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



Browser Support




Status







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").
❮ HTML Audio/Video DOM Reference