function exitPictureInPicture() {
if (document.pictureInPictureElement) {
document.exitPictureInPicture();
}
}Document: pictureInPictureElement property / notebook
Document: pictureInPictureElement property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.