Video addTextTrack()Method
Examples
Add a new text track to the video:
var
x = document.getElementById("myVideo");
var y = x.addTextTrack("caption");
y.addCue(new TextTrackCue("Test text", 01.000, 04.000,"","","",true));
var y = x.addTextTrack("caption");
y.addCue(new TextTrackCue("Test text", 01.000, 04.000,"","","",true));
Try it Yourself »
Definition and Usage
The addTextTrack() method creates and returns a new text track.
The new TextTrack object is added to the text track list of the video/audio element.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers do not support the addTextTrack() method.
Syntax
videoObject.addTextTrack(kind,label,language)
Parameter Values
| Value | Description |
|---|---|
| kind |
Specifies the type of text track. Possible values:
|
| label | A string value 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. 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 Other Extensions