A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/apis/audio-video/AudioTrack/enabled below:

enabled · WebPlatform Docs

enabled Summary

Returns true if the given track is active, and false otherwise. Can be set, to change whether the track is enabled or not. If multiple audio tracks are enabled simultaneously, they are mixed.

Property of apis/audio-video/AudioTrackapis/audio-video/AudioTrack

Syntax
var result = AudioTrack.enabled;
AudioTrack.enabled = value;
Return Value

Returns an object of type BooleanBoolean

Examples
(function () {
    
    var video = document.getElementById("video");

    video.addEventListener("loadeddata", function () {

        
        var audioTracks = video.audioTracks;

        var tracksSelection = document.getElementById("tracksSelection");

        
        for (var i = 0; i < audioTracks.length; i++) {

            
            
            var opt = document.createElement('option');
            opt.value = audioTracks[i].id;
            opt.text = audioTracks[i].language;

            tracksSelection.add(opt);
        }
    });

    tracksSelection.addEventListener("change", function (e) {
        
        
        var audioTracks = video.audioTracks;
        var track = audioTracks.getTrackById(e.currentTarget.value);

        
        for (var i = 0; i < audioTracks.length; i++) {
            audioTracks.enabled = false;
        }

        
        track.enabled = true;
    });
})();

View live example

Related specifications
W3C HTML5 Specification
W3C Editor’s Draft
See also Related articles Audio Video Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4