]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Actual test commit without comments and such
authorDavid Seifried <david.c.seifried@gmail.com>
Tue, 20 Sep 2011 14:12:09 +0000 (10:12 -0400)
committerDavid Seifried <david.c.seifried@gmail.com>
Tue, 20 Sep 2011 14:12:09 +0000 (10:12 -0400)
popcorn.js
testDestroy.html

index 6db21a9809ce26f933b556c55472ec98b34a8809..de90f0fc3c2e811ea873030b5c64a817800adda7 100644 (file)
       events[ item ] = null;
     }
 
-    //instance.media.removeEventListener( "timeupdate", function( event ) {
-      //console.log("HERE");
-      //Popcorn.timeUpdate( that, event );
-    //}, false );
-
-    instance.media.removeEventListener( "timeupdate", instance.data.timeUpdateFunction, false );
+    if ( instance.media.readyState >= 2 ) {
+      instance.media.removeEventListener( "timeupdate", instance.data.timeUpdateFunction, false );
+    } else {
+      throw ( "Attempting to remove event listener before event has been added!" );
+    }  
 
     Popcorn.removeInstance( instance );
   };
 
           } else {
 
-        that.data.timeUpdateFunction = function( event ) {
-          console.log( "here" );
-          Popcorn.timeUpdate( that, event );
-        }
+            that.data.timeUpdateFunction = function( event ) {
+              console.log( "in time update" );
+              Popcorn.timeUpdate( that, event );
+            }
 
-         //  that.media.addEventListener( "timeupdate", function( event ) {
-           //  console.log("HERE");
-            // Popcorn.timeUpdate( that, event );
-           //}, false );
-           //
-           that.media.addEventListener( "timeupdate", that.data.timeUpdateFunction, false );
+            that.media.addEventListener( "timeupdate", that.data.timeUpdateFunction, false );
           }
         } else {
           global.setTimeout(function() {
index 94c389458c0bf283bed45f95d45b2fde41fc89e5..ca6b604df91a4d64c81dc60a8a9f04a6cc33156c 100644 (file)
@@ -5,7 +5,7 @@
     var popcorn;
 
     function destroy() {
-      Popcorn.destroy( popcorn );
+      popcorn.destroy();
     }
 
 
@@ -19,6 +19,8 @@
           console.log( "EVENT: ", popcorn.data.events[ item ] );
         }
 
+        //popcorn.destroy();
+
       }, false );
     </script>
   </head>