Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML Audio/Video DOM textTracks Property

HTML Audio/Video DOM textTracks Property

HTML audio/video Tag Reference 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 ExplorerFirefoxOperaGoogle ChromeSafari

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:

  • length - Get the number of available text tracks in the audio/video
  • [index] - Gets a TextTrack object by its index
  • Note:The index of the first available text track index is 0.

    | | TextTrack object | Represents a text track.

    TextTrack object properties:

    |

    HTML audio/video Tag Reference HTML Audio/Video DOM Reference