Export (0) Print
Expand All
id
src
Expand Minimize

enabled property

Gets or sets whether a track is enabled.

This property is read/write.

HTML5 A vocabulary and associated APIs for HTML and XHTMLInternet Explorer 10

 

Syntax

JavaScript
object.enabled = enabled
enabled = object.enabled

 

Property values

Type: boolean

False (false)

The track is not enabled to play.

True (true)

The track is enabled to play.

Standards information

Remarks

You can select audio tracks on a video file by enabling and disabling the tracks you want. If more than one audio track are enabled at a time, the audio is mixed together.

Examples

The following example displays the status of all the audio tracks associated with a multi-track video. The first track is turned on and off when the button is clicked.


    <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

AudioTrack

 

 

Show:
© 2015 Microsoft