Audio addTextTrack()Method
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));
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 is used to create and return a new text track.
The new TextTrack object will be added to the text track list of the audio element.
Browser Support
![]()
![]()
![]()
![]()
![]()
Currently, no major browsers support the addTextTrack() method.
Syntax
audioObject.addTextTrack(kind,label,language)
Parameter Values
| Value | Description |
|---|---|
| kind |
Specifies the type of the text track. Possible values:
|
| label | A string value that specifies a 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, please refer to ourLanguage Code Reference Manual。 |
Technical Details
| Return Value: | A TextTrack object, representing the new text track. |
|---|
Audio Object Other Extensions