javascript - Efficient way to scan through array based on time? -


I am currently trying to show the elements of an array based on the timing of a video.

>

For example, a user says that when a video occurs at 00: 30-1: 20 (minute: seconds) and when on website 2: 00- 03:00

I currently have an array from the beginning of each color change, and there is an index. The time of beggar will be compared to the current time of the video. If current time => is the beginning time, the background will change to the color of the index. The current time will now be compared with the timeline, once the end time is over, the index will increase ...

Actually something like that.

  var index = 0; StartTime []; EndingTime []; Colour's[]; If (vid.currentTime> = betting time [index] & amp; amp; amp; amp; amp;; cense time & amp; finish; timing [index]) {background.color = colors [i]; } If (Weave Syrentum> Ending Time [Index]) i ++;  

I was wondering if there is a more effective way to do this? Or any better tips for doing this?


Comments