]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#475] fixed up youtube test failures
authorScottDowne <sdowne@learn.senecac.on.ca>
Wed, 20 Apr 2011 23:46:39 +0000 (19:46 -0400)
committerScottDowne <sdowne@learn.senecac.on.ca>
Wed, 20 Apr 2011 23:46:39 +0000 (19:46 -0400)
1  2 
players/vimeo/popcorn.vimeo.js
players/youtube/popcorn.youtube.unit.html
players/youtube/popcorn.youtube.unit.js

index 518919e2adf3cad05afc4e3c24fb348c3d291c98,ff247720e8b3cb229acbbcae92ce9fe9b737fd87..9c73f5117eac5691023310e7cf49644c026ebd90
        this.previousVolume = this.volume;
        this.evtHolder = new EventManager( this );
        
 +      this._container =  document.getElementById( containerId );
 +      bounds = this._container.getBoundingClientRect();
 +      
        // For calculating position relative to video (like subtitles)
-       this.offsetWidth = this.width = this._container.getAttribute( "width" ) || 504;
-       this.offsetHeight = this.height = this._container.getAttribute( "height" ) || 340;
-       this.offsetLeft = bounds.left;
-       this.offsetTop = bounds.top;
+       this.width = options.width || getStyle( container, "width" ) || "504px";
+       this.height = options.height || getStyle( container, "height" ) || "340px";
+       
+       if ( !/[\d]%/.test( this.width ) ) {
+         this.offsetWidth = parseInt( this.width, 10 );
+       } else {
+         // convert from pct to abs pixels
+         tmp = container.style.width;
+         container.style.width = this.width;
+         this.offsetWidth = container.offsetWidth;
+         container.style.width = tmp;
+       }
+       
+       if ( !/[\d]%/.test( this.height ) ) {
+         this.offsetHeight = parseInt( this.height, 10 );
+       } else {
+         // convert from pct to abs pixels
+         tmp = container.style.height;
+         container.style.height = this.height;
+         this.offsetHeight = container.offsetHeight;
+         container.style.height = tmp;
+       }
+       
+       this.offsetLeft = 0;
+       this.offsetTop = 0;
        
        // Try and get a video id from a vimeo site url
        // Try either from ctor param or from iframe itself
        }
      }
    });
- })( Popcorn );
 -})( Popcorn, window );
++})( Popcorn, window );
index fb2195e37c72b49ba71002c14a3c1e396c13f8d4,fb2195e37c72b49ba71002c14a3c1e396c13f8d4..54c3f84c48869880ec2ee4724c8a000d7c57207b
@@@ -28,8 -28,8 +28,8 @@@
      Therefore, if failures occur for the first time, just run it again. Likely,
      failures would disappear the second time.
    </p>
--  <div id="video" width="360" height="300" src="http://www.youtube.com/e/ac7KhViaVqc" ></div>
--  <div id="video2" width="360" height="300" src="http://www.youtube.com/e/ac7KhViaVqc" ></div>
++  <div id="video" width="360" height="300"></div>
++  <div id="video2" width="360" height="300"></div>
  </body>
  </html>
  
index 18d9cdf35b3fafd273e5a3d860fd8eb5383ae5b0,18d9cdf35b3fafd273e5a3d860fd8eb5383ae5b0..3632fdbef000b0e51c9dc289a7444b650fbd0126
@@@ -1,9 -1,9 +1,9 @@@
--var ytReady = false,
++var ytReady = true; /*
      popcorn = Popcorn( Popcorn.youtube( 'video' ) );
  
  popcorn.listen( "load", function onYouTubePlayerReady() {
    ytReady = true;
--});
++});*/
  
  test( "Popcorn YouTube Plugin Startup", function() {
    var time = 0,
  });
  
  test( "Popcorn YouTube Plugin Event Tests", function() {
--  if ( !ytReady ) {
++  /*if ( !ytReady ) {
      ok( false, "YouTube did not start." );
      return;
--  }
++  }*/
++var popcorn = Popcorn( Popcorn.youtube( 'video', "http://www.youtube.com/e/ac7KhViaVqc" ) );
    
    function plus(){ 
      if ( ++count == expects ) {
@@@ -219,4 -219,4 +220,4 @@@ test( "Popcorn YouTube Plugin Url and D
    });
    
    popcorn.play();
--});
++});