jplayer / jPlayer

jPlayer : HTML5 Audio & Video for jQuery
http://jplayer.org/
Other
4.6k stars 1.47k forks source link

Precise time event #115

Closed yukulele closed 11 years ago

yukulele commented 11 years ago

i would like to trigger an event at a precise time, of course I can use timeupdate event, but it's only trigger on every 0.25s.

if would be nice to add a onTime function with time option. exemple:

$("#player").jPlayer('onTime',10.17,function(){
    // will be run at 10.17s
});

$("#player").jPlayer('onTime',"25%",function(){
    // will be run at  25% of the media duration
});

$("#player").jPlayer('onTime',[30, -25, "90%"],function(){
    // will be run at 30s, {media duration}-25s and 90% of media duration
});
happyworm commented 11 years ago

Maybe you should take a look at http://popcornjs.org/ And the demo: http://jplayer.org/2.2.0/demo-09-popcorn-video/

Popcorn.js uses the timeupdate event to execute. We have considered adding a cue method, but it would be tied to the timeupdate event.

The only way I see to do it "more precise" would be to use a timeout... Which is not precise and has other problems... Like timeouts on iOS seem to get ignored if you are scrolling the screen when they happen. Other browsers will queue them up if the window is not in focus and so on.