THE WORLD'S LARGEST WEB DEVELOPER SITE

Video textTracks Property

❮ Video Object

Example

Get the number of available text tracks:

var x = document.getElementById("myVideo").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 video.

Each available text track is represented by a TextTrack Object.


Browser Support

Property
textTracks Yes 9.0 Not supported 6.0 Yes

Syntax

videoObject.textTracks

Return Value

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

TextioTrackList Object:

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

Note: The first available TextTrack object is index 0

TextTrack Object Represents a 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

❮ Video Object