What algorithm does a video player use to find the subtitles to show at any given time?
I'm building a video player that displays some notes on different times over a video. Each note has a starting time and an ending time, just like subtitles.
I'm having issues coming up with an algorithm to find the all the "notes" while the video is playing, obviously I want it to be as efficient as possible, and I figured that subtitles work basically the same(If they are ordered by the "start time").
I'm building it with Javascript since the player is intended to work in the browser, and this makes it even more important for it to be performant.
I thought about using a Binary Tree, but I don't think it will work, because a Binary Tree compares against one parameter, and I'm not sure it will be the best option after I modify it.