This feature is not Baseline because it does not work in some of the most widely-used browsers.
The HTMLVideoElement method requestPictureInPicture() issues an asynchronous request to display the video in picture-in-picture mode.
It's not guaranteed that the video will be put into picture-in-picture. If permission to enter that mode is granted, the returned Promise will resolve and the video will receive a enterpictureinpicture event to let it know that it's now in picture-in-picture.
requestPictureInPicture()
None.
A Promise that will resolve to a PictureInPictureWindow object that can be used to listen when a user will resize that floating window.
NotSupportedError DOMException
Thrown if the feature is not supported (for example, disabled by a user preference or by a platform limitation).
SecurityError DOMException
Thrown if the feature is blocked by a Permissions Policy.
InvalidStateError DOMException
Thrown if the video element's readState is HAVE_NOTHING, or if the video element has no video track, or if the video element's disablePictureInPicture attribute is true.
NotAllowedError DOMException
Thrown if document.pictureInPictureElement is null and the document does not have transient activation.
Transient user activation is required. The user has to interact with the page or a UI element for this feature to work.
This example requests that the video enters Picture-in-Picture mode, and sets an event listener to handle the floating window resizing.
function enterPictureInPicture() {
videoElement.requestPictureInPicture().then((pictureInPictureWindow) => {
pictureInPictureWindow.addEventListener(
"resize",
() => onPipWindowResize(),
false,
);
});
}
| Specification |
|---|
| Picture-in-Picture> # request-pip> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
requestPictureInPicture |
69 | 79 | No | 56 | 13.1 | 105 | No | 72 | 13.4 | 20.0 | No | 13.4 |
<video> elementHTMLVideoElement.disablePictureInPictureDocument.pictureInPictureEnabledDocument.exitPictureInPicture()Document.pictureInPictureElement:picture-in-picture
© 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/HTMLVideoElement/requestPictureInPicture