I'm trying to implement a way to navigate through the subtitles of a video that has subtitles in WebVTT format.
Task:
I would like to click on a button to make the video go to the beginning of the previous cue, but sometimes the video is between two cues, so when evaluating texttrack.activeCues
the result is an empty element.
Problem:
I can think of several ways to do this, but none of them seem the most efficient or logical. Let's say the video is currently at minute 100, where there is no active cue, how do I know what the previous cue is when I don't have a reference id?
I don't know if there is some element inside the TextTrackCueList that will help me without having to make an algorithm that goes through all the cues and evaluate them. There should be a simpler way I think. I appreciate any help you can give me.