HTML Audio/Video DOM textTracks Property
HTML Audio/Video DOM Reference
Example
Get the number of available text tracks:
myVid=document.getElementById("video1");
alert(myVid.textTracks.length);
Try it »
Definition and Usage
The textTracks attribute returns a TextTrackList object.
The TextTrackList object represents the available text tracks of the audio/video.
Each available text track is represented by a TextTrack object.
Browser support





Internet Explorer 10, Opera, Chrome, and Safari 6 support the textTracks property.
**Note:** Internet Explorer 9 and earlier versions do not support the textTracks property.
Syntax
audio|video
.textTracks
Return Value
| Type | Description |
|---|---|
| TextTrackList object | Represents the available text tracks of the audio/video.
TextioTrackList object: |
Note:The index of the first available text track index is 0.
| | TextTrack object | Represents a text track.TextTrack object properties:
- kind - Gets 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 - Gets or sets whether the track is active ("disabled"\|"hidden"\|"showing")
- cues - get the cues list as a TextTrackCueList object
- activeCues - get the current active text track cues as a TextTrackCueList object
- addCue(cue) - Adds a cue to the cues list
- removeCue(cue) - Removes a cue from the cues list
HTML Audio/Video DOM Reference