]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#t541] Changed timeout from 250ms to 50ms and also added some array padding and...
authorDavid Seifried <david.c.seifried@gmail.com>
Mon, 20 Jun 2011 18:40:45 +0000 (14:40 -0400)
committerDavid Seifried <david.c.seifried@gmail.com>
Mon, 20 Jun 2011 18:40:45 +0000 (14:40 -0400)
players/baseplayer/popcorn.baseplayer.html
players/baseplayer/popcorn.baseplayer.js
players/baseplayer/popcorn.baseplayer.unit.js

index 9417d8eaa4e884f2688b5526f9f4f3a652a1c7cf..85358cbf92b4db5503e55758b1d7d44e3eb02580 100644 (file)
@@ -87,4 +87,4 @@
           This demo showcases basic functionality of a player. It is a shell of an HTMLMediaElement with basic timing routines.<br />
           At 2 seconds, the phrase "2 seconds reached" will appear beside 'Event Output'<br />
     </body>
-</html>
\ No newline at end of file
+</html>
index 9666d4270ce4627cc74038af34935a747fdb9c14..3833f6f00cca6e79026b1718549ad0163447da1a 100644 (file)
@@ -59,7 +59,7 @@
       
       setTimeout( function() {
         self.timeupdate.call( self );
-      }, 250 );
+      }, 50 );
     },
     
     // By default, assumes this.resource is a DOM Element
@@ -70,7 +70,7 @@
     
     // Add an event listener to the object
     addEventListener: function( evtName, fn ) {
-      if ( !this._events[evtName] ) {
+      if ( !this._events[ evtName ] ) {
         this._events[evtName] = [];
       }
       
@@ -96,7 +96,7 @@
         }
       }
       
-      Popcorn.forEach( this._events[eventName], function( val ) {
+      Popcorn.forEach( this._events[ eventName ], function( val ) {
         val.call( self, evt, self );
       });
     },
       
       if ( elem.currentStyle ) {
         // IE syntax
-        return elem.currentStyle[prop];
+        return elem.currentStyle[ prop ];
       } else if ( global.getComputedStyle ) {
         // Firefox, Chrome et. al
         return doc.defaultView.getComputedStyle( elem, null ).getPropertyValue( prop );
       } else {
         // Fallback, just in case
-        return elem.style[prop];
+        return elem.style[ prop ];
       }
     }
   };
index 16e346bbc63c498669c199b848818ca19d5e6621..9aebb5527d458e6b7bab904bde0dcd1e1cd95a76 100644 (file)
@@ -55,7 +55,7 @@ test( "API", function () {
   stop( 10000 );
   
   Popcorn.forEach( members, function ( type, prop ) {
-    ok( typeof player[prop] === type, "player." + prop + " is type: " + type );
+    ok( typeof player[ prop ] === type, "player." + prop + " is type: " + type );
     plus();
   });
 });
@@ -78,18 +78,18 @@ test( "Default Functionality", function () {
     }
   }
   
-  player._resource = document.getElementById('player_1');
+  player._resource = document.getElementById( 'player_1' );
   dimensions = player.getBoundingClientRect();
   
   Popcorn.forEach( expectedVals, function() {
-    expects+= 2;
+    expects += 2;
   });
   
   expect( expects );
   stop( 1000 );
   
   Popcorn.forEach( expectedVals, function( val, prop ) {
-    equals( player.getStyle( prop ), val+'px', "Style '" + prop + "' correctly got" );
+    equals( player.getStyle( prop ), val + 'px', "Style '" + prop + "' correctly got" );
     plus();
     
     equals( dimensions[prop], val, "Bounding Client " + prop + " works" );
@@ -137,7 +137,7 @@ test( "Extension and Method Overriding", function () {
     }
   }
   
-  expect(expects);
+  expect( expects );
   stop( 4000 );
   
   Popcorn.extend( player, {
@@ -150,7 +150,7 @@ test( "Extension and Method Overriding", function () {
       plus();
       
       // Must dispatch event so event listeners can work!
-      this.dispatchEvent("timeupdate");
+      this.dispatchEvent( "timeupdate" );
       
       // We don't want to cue custom timing loop using setTimeout because we only want this to run once
     }
@@ -162,12 +162,12 @@ test( "Extension and Method Overriding", function () {
   });
   
   popcorn = Popcorn( playerForPopcorn )
-            .exec( 2, function() {
-              ok( Math.abs(player2.currentTime() - playerForPopcorn.currentTime) < 0.2, "Time update is within a reasonable range" );
-              plus();
-              ok( true, "Exec triggereed from popcorn after 2 seconds" );
-              plus();
-            });
+  .exec( 2, function() {
+    ok( Math.abs( player2.currentTime() - playerForPopcorn.currentTime ) < 0.2, "Time update is within a reasonable range" );
+    plus();
+    ok( true, "Exec triggereed from popcorn after 2 seconds" );
+    plus();
+  });
   
   player.load();
   player2.play();