From 0da63a05218ca2bdbe86039bc76577ae3b80e3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Thu, 11 May 2023 11:30:14 +0200 Subject: [PATCH] fix: Document Picture-in-Picture: Use width/height instead of initialAspectRatio (#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 https://github.com/WICG/document-picture-in-picture/pull/36 --- externs/pictureinpicture.js | 1 - ui/pip_button.js | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/externs/pictureinpicture.js b/externs/pictureinpicture.js index 12f92e193a..e850b5e156 100644 --- a/externs/pictureinpicture.js +++ b/externs/pictureinpicture.js @@ -53,7 +53,6 @@ HTMLMediaElement.prototype.webkitPresentationMode; /** * @typedef {{ - * initialAspectRatio: (number|undefined), * width: (number|undefined), * height: (number|undefined), * copyStyleSheets: (boolean|undefined), diff --git a/ui/pip_button.js b/ui/pip_button.js index f33aa216ce..34f5a9b93b 100644 --- a/ui/pip_button.js +++ b/ui/pip_button.js @@ -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, });