I am attempting to display subtitles for an audio recording using a webvtt <track>
element like so:
<audio controls="controls">
<source src="TheBrigands.mp3" />
<source src="TheBrigands.ogg" />
<track default="" kind="subtitles" srclang="en" label="English text" src="TheBrigands.vtt" />
</audio>
<div id="display">
It was a cold and stormy night,
</div>
Populating the display div
with this script:
<script>
function main() {
var recording = document.querySelector("audio");
var track = recording.textTracks[0];
var display = document.getElementById("display");
track.mode = "hidden";
track.oncuechange = function () {
var cue = this.activeCues[0];
display.innerHTML = cue.text;
}
}
window.onload = main;
</script>
Yet, when I inspect the track in firefox, though it has a cue object, it is empty:
document.querySelector('track').track.cues
TextTrackCueList { length: 0 }
I checked, and I have the mime-type
configured correctly in the server. What am I missing to cause it to not load?