Easy Tutorial
❮ Prop Track Label Prop Form Target ❯

addTextTrack() Method

Video Object

Example

Add a new text track to the video:

var x = document.getElementById("myVideo");
var y = x.addTextTrack("caption");
y.addCue(new TextTrackCue("Test text", 1.000, 4.000, "", "", "", true));

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

The addTextTrack() method is not supported by any major browsers.


Syntax

Parameter Values

Value Description
kind Specifies the type of the text track. Possible values: "subtitles"<br>"captions"<br>"descriptions"<br>"chapters"<br>"metadata"
label A string that specifies the label for the text track. Used to identify the text track for the user.
language A two-letter language code that specifies the language of the text track. See our language code reference for all available language codes.

Technical Details

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

❮ Prop Track Label Prop Form Target ❯