]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#421] vimeo player position with subtitles fix
authorScottDowne <sdowne@learn.senecac.on.ca>
Tue, 17 May 2011 18:21:22 +0000 (14:21 -0400)
committerScottDowne <sdowne@learn.senecac.on.ca>
Tue, 17 May 2011 18:21:22 +0000 (14:21 -0400)
players/vimeo/popcorn.vimeo.js

index 1a481ccbe54a92b73a532b5166f8a01a884fb9bd..012f3091ac276a5d7f605d9d97ed0fb6efef876d 100644 (file)
     player.offsetParent = player.swfObj.offsetParent;
     player.offsetLeft = player.swfObj.offsetLeft;
     player.offsetTop = player.swfObj.offsetTop;
-    
+
     player.dispatchEvent( "load" );
   };
   
       
       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 || {};
       
       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 = options.width || getStyle( this._target, "width" ) || "504px";
+      this.height = options.height || getStyle( this._target, "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;
         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() {
       return this.evtHolder.dispatchEvent( evtName );
     },
     getBoundingClientRect: function() {
-      return this._container.getBoundingClientRect();
+      return this._target.getBoundingClientRect();
     },
     startTimeUpdater: function() {
       var self = this,