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

HTML DOM Video addTextTrack() method

Video addTextTrack() method

Video Object Reference The Video object

Example

Add a new text track to a video:

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

var y = x.addTextTrack("caption");

y.addCue(new TextTrackCue("Test text", 01.000, 04.000,"","","",true));

Try it »


Definition and Usage

The addTextTrack() method creates and returns a new text track.

The new TextTrack object is added to the list of text tracks of the video/audio element.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

No major browsers support the addTextTrack() method.


Syntax

videoObject

.addTextTrack(

kind

,

label

,

language

)

Parameter value

Value Description
kind

Specifies the type of the text track.

Possible values:

  • "subtitles"
  • "caption"
  • "descriptions"
  • "chapters"
  • "metadata"
  • | | *label* | A string value that specifies the label for the text track, used to identify it for the user. | | *language* |

    A two-letter language code that specifies the language of the text track.

    To see all available language codes, see ourLanguage Code Reference Manual.

    |

    Technical Details

    Return Value: A TextTrack object, representing the new text track.

    Video Object Reference The Video object