HTML Audio/Video DOMaddTextTrack()Methods

HTML Audio/Video DOM Reference Manual

Example

Add a new text track to the video:

text1=myVid.addTextTrack("caption");
text1.addCue(new TextTrackCue("Test text", 01.000, 04.000,"","","",true));

Try it Yourself »

Definition and Usage

The addTextTrack() method creates and returns a new TextTrack object.

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

None of the major browsers support the addTextTrack() method.


Syntax

audio|video.addTextTrack(kind,label,language)

Parameter

Value Description
kind Specify 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. It is used to identify the text track for the user.
language A two-letter language code that specifies the language of the text track.
To see all available language codes, please refer to ourLanguage Code Reference Manual。

Return Value

Type Description
TextTrack Object Represent the new text track.


HTML Audio/Video DOM Reference Manualother extensions