Audio textTracks attribute
Example
Get the number of available text tracks:
var x = document.getElementById("myAudio").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.
Each available text track is represented by a TextTrack object.
Browser support





Internet Explorer, Opera, Chrome, and Safari 6 support the textTracks attribute.
Note: Firefox and Internet Explorer 9 and earlier IE versions do not support the textTracks attribute.
Syntax
audioObject
.textTracks
Return Value
| Type | Description |
|---|---|
| TextTrackList object |
Represents the available text tracks of the audio. TextioTrackList object properties: |
Note:The index of the first available text track is 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 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) - add a cue to the cues list
- removeCue(cue) - remove a cue from the cues list
Audio object