Represents a list of AudioTrack objects. A video element can have one or more associated audio tracks and the audioTracks property returns the list.
![]() |
Syntax
var oAudioTracks = oVideo.audioTracks;
DOM Information
Inheritance Hierarchy
The AudioTrackList does not inherit from any class or interface.Members
The AudioTrackList object has these types of members:
Events
The AudioTrackList object has these events.
| Event | Description |
|---|---|
| addtrack |
Occurs when an AudioTrack is added to the AudioTrackList on a video object. |
| onchange |
Occurs when an AudioTrack in the AudioTrackList associated with a video is enabled or disabled. |
Methods
The AudioTrackList object has these methods.
| Method | Description |
|---|---|
| addEventListener |
Registers an event handler for the specified event type. |
| dispatchEvent |
Sends an event to the current element. |
| getTrackById |
Returns the first AudioTrack with the specified id in an AudioTrackList. |
| item |
Returns a track from a list that corresponds with the given index based on track order. |
| removeEventListener |
Removes an event handler that the addEventListener method registered. |
Properties
The AudioTrackList object has these properties.
| Property | Description |
|---|---|
|
Returns the number of tracks in a TextTrackList, TextTrackCueList, or AudioTrackList list object. |
Standards information
- HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4.8.10.10
Remarks
The following example gets an AudioTrackList associated with a video object and displays the language and enabled status of each AudioTrack .
Examples
<script type="text/javascript"> function getLanguages() { oAudioTracks = document.getElementById("video1").audioTracks; document.getElementById("display").innerHTML = ""; for (var i = 0; i < oAudioTracks.length; i++) { document.getElementById("display").innerHTML += "Track " + i + " Language: " + oAudioTracks[i].language + " is " + ((oAudioTracks[i].enabled == true) ? "enabled" : "not enabled")+"<br/>"; } } </script> </head> <body> <video id="video1" src="multi-lang-movie.mp4" controls >HTML5 video not supported </video> <br /> <button onclick="getLanguages();">Get language status</button> <div id="display"></div> </body> </html>
Build date: 11/28/2012
