I have very simple function to start playing audio in OpenPlayerJS which is a fork of video.js. The track for closed caption is same name as the mp3 file passed, and the function correctly adds it.
I want to have the caption mode enabled by default. Cannot find the option to enable it by default in player loader arguments.
It does not get enabled by calling track.mode = "showing"
as explained here https://developer.mozilla.org/en-US/docs/Web/API/TextTrack/mode
function play(sound) {
let id = document.querySelector('.op-player').id;
let player = OpenPlayerJS.instances[id];
let captions = stem(sound) + '.vtt';
player.src = { src: sound };
player.addCaptions({ src: captions, kind: "subtitles", srclang: "en", label: "English" });
// https://developer.mozilla.org/en-US/docs/Web/Events#media
let track = document.querySelector("track").track;
track.mode = "showing";
player.play();
}
What am I doing wrong or missing? I just want this "CC" option to be enabled automatically: