I need breakpoints for an HTML5 video player. I found Cuepoint.js , except that this only applies to captions. I need things other than text to change when a label is clicked.
I kind of made my own logic of the starting point, but I feel that it is not as effective as it could be. Now I deal with a few times, which does not really matter. I am afraid that when I hit hundreds, it might cause some performance problems.
This is what I came up with, and it is pretty accurate:
function timeUpdate(event) { var times = [3,8,13,19,25]; currentTime = player.currentTime(); $.each(times,function(key, value) { if (currentTime >= times[key] && currentTime <= times[key] + 0.3) { currentIndex++; loadAssets(currentIndex); } }); }
The times array is just an example. Is there a more efficient way to do this, or is it pretty much it?
Ronnie
source share