Video.js - Switching between multiple audio tracks (and playing them when I change it)

Viewed 553

Video.js supports adding multiple audio tracks to a video file. When I add audio tracks to my player, I can switch between the audio tracks. However, it doesn't play the corresponding audio. How can I play the audio track when I change it from the player? Thank you.

My code looks like:

...
componentDidMount() {
    this.player = videojs(this.videoNode, this.props.videoJsOptions);

    this.props.audioTracks.forEach(audio => {
        // Create a track object.
        var track = new videojs.AudioTrack(audio);

        // Add the track to the player's audio track list.
        this.player.audioTracks().addTrack(track);
    });
}
...

My video player looks like:

Player with audio track options.

0 Answers
Related