Skip to content

Commit

Permalink
Merge remote branch 'scott/t421' into 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna Sobiepanek committed May 18, 2011
2 parents 6f71faa + 832f745 commit 6207902
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
8 changes: 5 additions & 3 deletions players/vimeo/popcorn.vimeo.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@
//On document ready
document.addEventListener( "DOMContentLoaded", function() {
var player = Popcorn( Popcorn.vimeo( "player_1", "http://player.vimeo.com/video/11127501", {
width: 500,
height: 281
css: {
width: "500px",
height: "281px"
}
}) )
.footnote({
start: 5, // seconds
Expand Down Expand Up @@ -246,4 +248,4 @@ <h4>Expected Events</h4>
<br />

</body>
</html>
</html>
50 changes: 24 additions & 26 deletions players/vimeo/popcorn.vimeo.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
player.offsetParent = player.swfObj.offsetParent;
player.offsetLeft = player.swfObj.offsetLeft;
player.offsetTop = player.swfObj.offsetTop;

player.dispatchEvent( "load" );
};

Expand Down Expand Up @@ -229,11 +229,6 @@
var matches = url.match( rWebUrl );
return matches ? matches[0].substr(10) : "";
}

// Gets the style for the given element
function getStyle( elem, styleProp ) {
return elem.style[styleProp];
}

function makeSwf( self, vidId, containerId ) {
if ( !window.swfobject ) {
Expand Down Expand Up @@ -279,13 +274,16 @@

var vidId,
that = this,
tmp,
container = this._container = document.createElement( "div" );
tmp;

container.id = containerId + "object";
document.getElementById( containerId ).appendChild( container );
this._container = document.createElement( "div" );
this._container.id = containerId + "object";
this._target = document.getElementById( containerId );
this._target.appendChild( this._container );

options = options || {};

options.css && Popcorn.extend( this._target.style, options.css );

this.addEventFn;
this.evtHolder;
Expand All @@ -302,31 +300,31 @@
this.previousCurrentTime = this.currentTime;
this.previousVolume = this.volume;
this.evtHolder = new EventManager( this );

bounds = this._container.getBoundingClientRect();

// For calculating position relative to video (like subtitles)
this.width = options.width || getStyle( container, "width" ) || "504px";
this.height = options.height || getStyle( container, "height" ) || "340px";
this.width = this._target.style.width || "504px";
this.height = this._target.style.height || "340px";

if ( !/[\d]%/.test( this.width ) ) {
this.offsetWidth = parseInt( this.width, 10 );
this._target.style.width = this.width + "px";
} else {
// convert from pct to abs pixels
tmp = container.style.width;
container.style.width = this.width;
this.offsetWidth = container.offsetWidth;
container.style.width = tmp;
tmp = this._target.style.width;
this._target.style.width = this.width;
this.offsetWidth = this._target.offsetWidth;
this._target.style.width = tmp;
}

if ( !/[\d]%/.test( this.height ) ) {
this.offsetHeight = parseInt( this.height, 10 );
this._target.style.height = this.height + "px";
} else {
// convert from pct to abs pixels
tmp = container.style.height;
container.style.height = this.height;
this.offsetHeight = container.offsetHeight;
container.style.height = tmp;
tmp = this._target.style.height;
this._target.style.height = this.height;
this.offsetHeight = this._target.offsetHeight;
this._target.style.height = tmp;
}

this.offsetLeft = 0;
Expand All @@ -340,9 +338,9 @@
throw "No video id";
}

registry[ container.id ] = this;
registry[ this._container.id ] = this;

makeSwf( this, vidId, container.id );
makeSwf( this, vidId, this._container.id );

// Set up listeners to internally track state as needed
this.addEventListener( "load", function() {
Expand Down Expand Up @@ -582,7 +580,7 @@
return this.evtHolder.dispatchEvent( evtName );
},
getBoundingClientRect: function() {
return this._container.getBoundingClientRect();
return this._target.getBoundingClientRect();
},
startTimeUpdater: function() {
var self = this,
Expand Down

0 comments on commit 6207902

Please sign in to comment.