YouTip LogoYouTip

Met Audio Addtexttrack

HTML DOM Audio addTextTrack() Method

HTML DOM Audio addTextTrack() Method

HTML DOM Audio addTextTrack() Method

-- Learning not just technology, but dreams!

JavaScript Reference

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

HTML DOM Area Object

HTML DOM Base Object

Explore Further

  • Programming
  • Web Services
  • Scripting
  • Programming Languages
  • Scripting Languages
  • Web Service
  • Computer Science
  • Software
  • Development Tools
  • Web Design and Development

Audio addTextTrack() Method

Image 8: Audio Object Reference Audio Object

Example

Add a new text track to an audio element:

var x = document.getElementById("myAudio");
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 is added to the audio element's list of text tracks.


Browser Support

Image 9: Internet ExplorerImage 10: FirefoxImage 11: OperaImage 12: Google ChromeImage 13: Safari

Currently, all major browsers do not support the addTextTrack() method.


Syntax

audioObject.addTextTrack(kind,label,language)

Parameter Values

Value Description
kind Specifies the type of text track. Possible values:
* "subtitles"
* "caption"
* "descriptions"
* "chapters"
* "metadata"
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 view all available language codes, please refer to our Language Code Reference.

Technical Details

Return Value: A TextTrack object representing the new text track.

Image 14: Audio Object Reference Audio Object

← Met Audio PlayProp Audio Volume β†’