Audio 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 audio element.
Example
Add a new text track to the audio:
var x = document.getElementById("myAudio"); var y = x.addTextTrack("caption"); y.addCue(new TextTrackCue("Test text", 01.000, 04.000,"","","",true));
Syntax
audioObject.addTextTrack(kind, label, language)
Parameter value
Value | Description |
---|---|
kind |
Define the type of text track. Possible values:
|
label | String value, specifying the label of the text track. Used to facilitate user identification of 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 |