From a249b8cf9d8783fa512581bc69718b93aa6a512a Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Fri, 18 Feb 2011 15:47:43 -0500 Subject: [PATCH] [#349] Round exec times, widen buffer for callback.fired release --- popcorn.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/popcorn.js b/popcorn.js index c42a5d8..36f7c01 100644 --- a/popcorn.js +++ b/popcorn.js @@ -323,27 +323,26 @@ return -~this.video.currentTime; }, - exec: function ( time, fn ) { !fn && ( fn = Popcorn.nop ); - var self = this, guid = Popcorn.guid( "execCallback" ), callback = function execCallback( event ) { + + if ( Math.round( this.currentTime() ) === time && !callback.fired ) { - if ( this.currentTime() >= time && !callback.fired ) { - callback.fired = true; fn.call(self, event); + // Enforce a once per second execution setTimeout(function() { callback.fired = false; - }, 500 ); + }, 1000 ); } }; -- 2.43.0