Video textTracks attribute

Definition and usage

textTracks The property returns a TextTrackList object.

The TextTrackList object represents the available text tracks of the video.

Each available text track is represented by a TextTrack object.

Example

Get the number of available text tracks:

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

Try it yourself

Syntax

videoObject.textTracks

Return value

Type Description
TextTrackList object

Represents the available text tracks of the video.

TextioTrackList object:

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

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

TextTrack object

Represents the text track.

TextTrack object properties:

  • kind - Get the type of the text track
  • label - Get the label of the text track
  • language - Get the language of the text track
  • mode - Get or set whether the track is in an active state ("disabled"|"hidden"|"showing")
  • cues - Get the cue list as a TextTrackCueList object
  • activeCues - Get the current active text track cues as a TextTrackCueList object
  • addCue(cue) - Add the cue to the cue list
  • removeCue(cue) - Remove the cue from the cue list

The value of the kind attribute:

  • "subtitles"
  • "caption"
  • "descriptions"
  • "chapters"
  • "metadata"

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 9.0 Not Supported 6.0 Support