Skip to content

Commit 79ce6f6

Browse files
committed
update metadata on enter pip event
1 parent 269c255 commit 79ce6f6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/js/player.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3200,10 +3200,13 @@ class Player extends Component {
32003200
}
32013201
pipContainer.appendChild(Dom.createEl('p', { className: 'vjs-pip-text' }, {}, this.localize('Playing in picture-in-picture')));
32023202

3203+
const pipWidth = this.videoWidth();
3204+
const pipHeight = this.videoHeight();
3205+
32033206
return window.documentPictureInPicture.requestWindow({
32043207
// The aspect ratio won't be correct, Chrome bug https://crbug.com/1407629
3205-
width: this.videoWidth(),
3206-
height: this.videoHeight()
3208+
width: pipWidth,
3209+
height: pipHeight
32073210
}).then(pipWindow => {
32083211
Dom.copyStyleSheetsToWindow(pipWindow);
32093212
this.el_.parentNode.insertBefore(pipContainer, this.el_);
@@ -3212,7 +3215,7 @@ class Player extends Component {
32123215
pipWindow.document.body.classList.add('vjs-pip-window');
32133216

32143217
this.player_.isInPictureInPicture(true);
3215-
this.player_.trigger('enterpictureinpicture');
3218+
this.player_.trigger({type: 'enterpictureinpicture', width: pipWidth, height: pipHeight});
32163219

32173220
// Listen for the PiP closing event to move the video back.
32183221
pipWindow.addEventListener('pagehide', (event) => {

0 commit comments

Comments
 (0)