I am looking to dynamically load subtitles onto a video.
let subs:TextTrack = video.addTextTrack('subtitles');
for (let dataSrt of dataSrts) {
let cue: any = new VTTCue(
dataSrt['startTime'],
dataSrt['endTime'],
dataSrt['text']
);
subs.addCue(cue);
}
subs.mode = "showing";
While this method works smoothly, the compiler seems to have trouble recognizing the VTTCue Object.
Although there is a TextTrackCue Object available, it currently does not function properly on any browser.
The issue arises when I start the server with npm start, an error prevents the launch process. However, if I make changes to the code after launching, everything runs perfectly fine.
I attempted to add an empty VTTCue class in C++ style, but TypeScript did not approve of it.
Thank you in advance.