Permalink
Browse files

[#1348] Remove eady callbacks if player destroyed.

  • Loading branch information...
1 parent 7674302 commit 204d419ad75afa2f9e73645b4d4c32cd13874367 @ScottDowne committed Dec 21, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js
@@ -44,13 +44,17 @@
window.YT = null;
}
- window.onYouTubeIframeAPIReady = function() {
- ytReady = true;
+ function deleteYtCallbacks () {
var i = ytCallbacks.length;
while( i-- ) {
ytCallbacks[ i ]();
delete ytCallbacks[ i ];
}
+ }
+
+ window.onYouTubeIframeAPIReady = function() {
+ ytReady = true;
+ deleteYtCallbacks();
};
function HTMLYouTubeVideoElement( id ) {
@@ -264,6 +268,7 @@
if( !( playerReady && player ) ) {
return;
}
+ deleteYtCallbacks();
clearInterval( currentTimeInterval );
player.stopVideo();
player.clearVideo();

0 comments on commit 204d419

Please sign in to comment.