Video addTextTrack() method
Definition and usage
addTextTrack()
This method creates and returns a new TextTrack object.
A new TextTrack object is added to the text track list of the video element.
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", 01.000, 04.000, "", "", "", true));
Syntax
videoObject.addTextTrack("kind, label, language)
Parameter
Parameter | Description |
---|---|
kind |
Specify the type of text track. Possible values:
|
label | String value, specifying the label of the text track. Used to help users identify the text track. |
language |
Language codes consisting of two letters, used to specify the language of the text track. To view all available language codes, please visit ourLanguage Code Reference Manual. |
Technical Details
Return Value: | TextTrack Object, representing a new text track. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Not Supported | Not Supported | Not Supported | Not Supported | Not Supported |