This feature is not Baseline because it does not work in some of the most widely-used browsers.
The PictureInPictureWindow interface represents an object able to programmatically obtain the width and height and resize event of the floating video window.
An object with this interface is obtained using the HTMLVideoElement.requestPictureInPicture() promise return value.
The PictureInPictureWindow interface doesn't inherit any properties.
PictureInPictureWindow.width Read only
Determines the width of the floating video window.
PictureInPictureWindow.height Read only
Determines the height of the floating video window.
The PictureInPictureWindow interface doesn't inherit any methods.
The PictureInPictureWindow interface doesn't inherit any events.
resizeSent to a PictureInPictureWindow when the floating video window is resized.
Given a <button> and a <video>, clicking the button will make the video enter the picture-in-picture mode; we then attach an event to print the floating video window dimensions to the console.
const button = document.querySelector("button");
const video = document.querySelector("video");
function printPipWindowDimensions(evt) {
const pipWindow = evt.target;
console.log(
`The floating window dimensions are: ${pipWindow.width}x${pipWindow.height}px`,
);
// will print:
// The floating window dimensions are: 640x360px
}
button.onclick = () => {
video.requestPictureInPicture().then((pictureInPictureWindow) => {
pictureInPictureWindow.onresize = printPipWindowDimensions;
});
};
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
PictureInPictureWindow |
69 | 79 | No | 56 | 13.1 | 105 | No | 72 | 13.4 | 20.0 | No | 13.4 |
height |
69 | 79 | No | 56 | 13.1 | 105 | No | 72 | 13.4 | 20.0 | No | 13.4 |
resize_event |
69 | 79 | No | 56 | 13.1 | 105 | No | 72 | 13.4 | 20.0 | No | 13.4 |
width |
69 | 79 | No | 56 | 13.1 | 105 | No | 72 | 13.4 | 20.0 | No | 13.4 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PictureInPictureWindow