From: David Seifried Date: Tue, 13 Sep 2011 14:56:51 +0000 (-0400) Subject: Merge branch '708' of github.com:dseif/popcorn-js into 708 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=51cda0ad9f6aceaf6dcdef0c56ad1c00b04eaba5;p=popcorn-js.git Merge branch '708' of github.com:dseif/popcorn-js into 708 --- 51cda0ad9f6aceaf6dcdef0c56ad1c00b04eaba5 diff --cc popcorn.js index 55a820e,9f6b091..d50a864 --- a/popcorn.js +++ b/popcorn.js @@@ -875,39 -877,29 +877,39 @@@ Popcorn.timeUpdate = function( obj, event ) { - var currentTime = obj.media.currentTime, - previousTime = obj.data.trackEvents.previousUpdateTime, - tracks = obj.data.trackEvents, - tracksByEnd = tracks.byEnd, - tracksByStart = tracks.byStart; + var currentTime = obj.media.currentTime, + previousTime = obj.data.trackEvents.previousUpdateTime, + tracks = obj.data.trackEvents, + end = tracks.endIndex, + start = tracks.startIndex, + + registryByName = Popcorn.registryByName, + + byEnd, byStart, natives, type; // Playbar advancing - if ( previousTime < currentTime ) { + if ( previousTime <= currentTime ) { - while ( tracksByEnd[ tracks.endIndex ] && tracksByEnd[ tracks.endIndex ].end <= currentTime ) { + while ( tracks.byEnd[ end ] && tracks.byEnd[ end ].end <= currentTime ) { + + byEnd = tracks.byEnd[ end ]; + natives = byEnd._natives; + type = natives && natives.type; + // If plugin does not exist on this instance, remove it - if ( !tracksByEnd[ tracks.endIndex ]._natives || - ( !!Popcorn.registryByName[ tracksByEnd[ tracks.endIndex ]._natives.type ] || - !!obj[ tracksByEnd[ tracks.endIndex ]._natives.type ] ) ) { + if ( !natives || + ( !!registryByName[ type ] || + !!obj[ type ] ) ) { - if ( tracksByEnd[ tracks.endIndex ]._running === true ) { - tracksByEnd[ tracks.endIndex ]._running = false; - tracksByEnd[ tracks.endIndex ]._natives.end.call( obj, event, tracksByEnd[ tracks.endIndex ] ); + if ( byEnd._running === true ) { + byEnd._running = false; + natives.end.call( obj, event, byEnd ); } - tracks.endIndex++; + + end++; } else { // remove track event - Popcorn.removeTrackEvent( obj, tracksByEnd[ tracks.endIndex ]._id ); + Popcorn.removeTrackEvent( obj, byEnd._id ); return; } }