Cuepoints in HTML5 tag

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?

+7
source share
2 answers

Ronnie, you do not need to go through this array. If the items are fine, just check the box next to the first, and then currentIndex to one.

 function timeUpdate(event) { var times = [3,8,13,19,25]; currentTime = player.currentTime(); if (currentTime >= times[currentIndex]) { currentIndex++; loadAssets(currentIndex); } } 
+1
source

one of the closest answers to your question: http://codecanyon.net/item/html5-video-cue-points-engine/8840124

0
source

All Articles