Skip to content

Commit

Permalink
[#960183] Ensure we remove ready callbacks when they are called.
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottDowne committed Jan 16, 2014
1 parent 65a2629 commit 7f29250
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions wrappers/null/popcorn.HTMLNullVideoElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@
self._util.type = "NullVideo";

function addPlayerReadyCallback( callback ) {
playerReadyCallbacks.unshift( callback );
playerReadyCallbacks.push( callback );
}

function onPlayerReady( ) {
function onPlayerReady() {
var callback;
playerReady = true;

impl.networkState = self.NETWORK_IDLE;
Expand All @@ -128,10 +129,9 @@
impl.readyState = self.HAVE_ENOUGH_DATA;
self.dispatchEvent( "canplaythrough" );

var i = playerReadyCallbacks.length;
while( i-- ) {
playerReadyCallbacks[ i ]();
delete playerReadyCallbacks[ i ];
while( playerReadyCallbacks.length ) {
callback = playerReadyCallbacks.shift();
callback();
}

// Auto-start if necessary
Expand Down

0 comments on commit 7f29250

Please sign in to comment.