Skip to content

Commit

Permalink
fix control position on hulu w/ getBoundingClientRect (igrigorik#752)
Browse files Browse the repository at this point in the history
* fix control position on hulu w/ getBoundingClientRect instead of offsetLeft/Top

* minor reorder
  • Loading branch information
paulirish authored Jan 26, 2021
1 parent 43aa856 commit a25373f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,11 @@ function defineVideoController() {

tc.videoController.prototype.initializeControls = function () {
log("initializeControls Begin", 5);
var document = this.video.ownerDocument;
var speed = this.video.playbackRate.toFixed(2),
top = Math.max(this.video.offsetTop, 0) + "px",
left = Math.max(this.video.offsetLeft, 0) + "px";
const document = this.video.ownerDocument;
const speed = this.video.playbackRate.toFixed(2);
const rect = this.video.getBoundingClientRect();
const top = Math.max(rect.top, 0) + "px";
const left = Math.max(rect.left, 0) + "px";

log("Speed variable set to: " + speed, 5);

Expand Down

0 comments on commit a25373f

Please sign in to comment.