Mixins

audio-tracks

Audio Tracks

Audio tracks are a feature of HTML5 video for providing alternate audio track selections
to the user, so that a track other than the main track can be played. Video.js offers a
cross-browser implementation of audio tracks.

Table of Contents

Caveats

It is not possible to add audio tracks through HTML like you can with text tracks.
They must be added programmatically.

Video.js only stores track representations. Switching audio tracks for playback is
not handled by Video.js and must be handled elsewhere - for example,
videojs-contrib-hls handles switching
audio tracks to support track selection through the UI.

Removing an Audio Track from the Player

Assuming a player already exists and has an audio track that you want to remove, you
might do something like the following:

// Get the track we created in an earlier example.
var track = player.audioTracks().getTrackById('my-spanish-audio-track');
// Remove it from the audio track list.
player.audioTracks().removeTrack(track);

enabled

In Video.js, we only allow one track to be enabled at a time; so, if you enable more
than one, the last one to be enabled will end up being the only one. While the spec
allows for more than one track to be enabled, Safari and most implementations only allow
one audio track to be enabled at a time.