Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

audioTracks property

Returns an AudioTrackList object with the audio tracks for a given video element.

This property is read-only.

HTML5 A vocabulary and associated APIs for HTML and XHTML

Syntax

JavaScript
oAudioTrackList = object.audioTracks

Property values

Type: AudioTrackList

An AudioTrackList object that represents a list of AudioTracks.

Standards information

Remarks

The following example gets and enables all audio tracks associated with a video element.

Examples


    <script type="text/javascript">
      var i = 0;
      function NextTrack() {                 
        var oAudioTracks = document.getElementById("video1").audioTracks;
        var aLen = oAudioTracks.length;
        for (i = 0; i < aLen; i++){
          if (oAudioTracks[i].enabled) {
            oAudioTracks[i].enabled = false;
            break;
          } 
        }         
        i++;
        if (i == oAudioTracks.length) {
          i = 0;                          // wrap around to start
        }
        oAudioTracks[i].enabled = true;
      }            
    </script>
  </head>
  <body>
    <video id="video1" src="multi-lang-movie.mp4" controls  >
      HTML5 video not supported in this mode or browser
    </video>
    <br />
    <button onclick="NextTrack();">Next track</button>
  </body>
</html> 


See also

HTMLMediaElement
HTMLVideoElement
SourceBuffer

 

 

Show:
© 2014 Microsoft