From: ScottDowne
Date: Wed, 20 Apr 2011 23:46:39 +0000 (-0400)
Subject: [#475] fixed up youtube test failures
X-Git-Tag: v0.5~9^2
X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=3679966eac3c2958e6266bdb5bcc9b50a3dd13bc;p=popcorn-js.git
[#475] fixed up youtube test failures
---
3679966eac3c2958e6266bdb5bcc9b50a3dd13bc
diff --cc players/vimeo/popcorn.vimeo.js
index 518919e,ff24772..9c73f51
--- a/players/vimeo/popcorn.vimeo.js
+++ b/players/vimeo/popcorn.vimeo.js
@@@ -290,14 -308,32 +308,35 @@@
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
@@@ -612,4 -620,4 +623,4 @@@
}
}
});
- })( Popcorn );
-})( Popcorn, window );
++})( Popcorn, window );
diff --cc players/youtube/popcorn.youtube.unit.html
index fb2195e,fb2195e..54c3f84
--- a/players/youtube/popcorn.youtube.unit.html
+++ b/players/youtube/popcorn.youtube.unit.html
@@@ -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.
--
--
++
++