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/language below:

language · WebPlatform Docs

language Summary

Returns the language of the given track, if known, or the empty string otherwise.

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

Syntax

Note: This property is read-only.

var result = AudioTrack.language;
Return Value

Returns an object of type StringString

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