javascript – What algorithm is used in the subtitles?

What algorithm does a video player use to find the subtitles to show at a given moment?

I am creating a video player that shows some notes at different times in a video. Each note has a start time and an end time, just like the subtitles.

I have trouble finding an algorithm to find all the "notes" while playing the video, obviously I want it to be as efficient as possible, and I thought the subtitles work basically the same (if they are ordered by the "start time").

I am creating it with Javascript, since the player is designed to work in the browser, and this makes it even more important for its performance.

I thought about using a binary tree, but I do not think it works, because a binary tree is compared with a parameter, and I'm not sure it's the best option after modifying it.