demo · v142
PiP reason
A video plus a MediaSession action handler that opts out of auto-PiP triggered by backgrounding. Trigger PiP through the in-page button or tab-switch, then watch the log to see which details.reason value the handler received.
limited support
This browser does not expose Picture-in-Picture or MediaSession. The reason readout below will stay empty.
last received reason
—
document.pictureInPictureElement
null
relevant API
navigator.mediaSession.setActionHandler("enterpictureinpicture", (details) => {
// details.reason ∈ { "auto", "userAction", "background" } in Chrome 142+
if (details.reason === "background") return; // opt out
video.requestPictureInPicture();
});
see also
- PiP reason — feature index
- ChromeStatus entry