Skip to content

Commit

Permalink
fix: Document Picture-in-Picture: Use width/height instead of initial…
Browse files Browse the repository at this point in the history
…AspectRatio (#5224)

The `initialAspectRatio` option was removed from the Document
Picture-in-Picture spec in favour of `width` and `height`, so we should
use them. See
WICG/document-picture-in-picture#36
  • Loading branch information
beaufortfrancois authored May 11, 2023
1 parent 1c89204 commit 0da63a0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion externs/pictureinpicture.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ HTMLMediaElement.prototype.webkitPresentationMode;

/**
* @typedef {{
* initialAspectRatio: (number|undefined),
* width: (number|undefined),
* height: (number|undefined),
* copyStyleSheets: (boolean|undefined),
Expand Down
3 changes: 2 additions & 1 deletion ui/pip_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ shaka.ui.PipButton = class extends shaka.ui.Element {
const pipPlayer = this.videoContainer_;
const rectPipPlayer = pipPlayer.getBoundingClientRect();
const pipWindow = await window.documentPictureInPicture.requestWindow({
initialAspectRatio: rectPipPlayer.width / rectPipPlayer.height,
width: rectPipPlayer.width,
height: rectPipPlayer.height,
copyStyleSheets: true,
});

Expand Down

0 comments on commit 0da63a0

Please sign in to comment.