From e09f2e0a3c2ee441c9089b7aec1b7a00df8677a2 Mon Sep 17 00:00:00 2001 From: David Seifried Date: Mon, 20 Jun 2011 14:40:45 -0400 Subject: [PATCH] [#t541] Changed timeout from 250ms to 50ms and also added some array padding and other styling fixes --- players/baseplayer/popcorn.baseplayer.html | 2 +- players/baseplayer/popcorn.baseplayer.js | 10 ++++---- players/baseplayer/popcorn.baseplayer.unit.js | 24 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/players/baseplayer/popcorn.baseplayer.html b/players/baseplayer/popcorn.baseplayer.html index 9417d8e..85358cb 100644 --- a/players/baseplayer/popcorn.baseplayer.html +++ b/players/baseplayer/popcorn.baseplayer.html @@ -87,4 +87,4 @@ This demo showcases basic functionality of a player. It is a shell of an HTMLMediaElement with basic timing routines.
At 2 seconds, the phrase "2 seconds reached" will appear beside 'Event Output'
- \ No newline at end of file + diff --git a/players/baseplayer/popcorn.baseplayer.js b/players/baseplayer/popcorn.baseplayer.js index 9666d42..3833f6f 100644 --- a/players/baseplayer/popcorn.baseplayer.js +++ b/players/baseplayer/popcorn.baseplayer.js @@ -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 ); }); }, @@ -129,13 +129,13 @@ 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 ]; } } }; diff --git a/players/baseplayer/popcorn.baseplayer.unit.js b/players/baseplayer/popcorn.baseplayer.unit.js index 16e346b..9aebb55 100644 --- a/players/baseplayer/popcorn.baseplayer.unit.js +++ b/players/baseplayer/popcorn.baseplayer.unit.js @@ -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(); -- 2.43.0