PL EN

Picture in Picture API

Open the video in a new window and navigate the page where the video is playing.

Example of usage:

const video = document.querySelector('#video');
const button = document.querySelector('#picture-in-picture-button');

const togglePictureInPicture = () => {
  if (document.pictureInPictureElement) {
    document.exitPictureInPicture();
  } else {
    video.requestPictureInPicture();
  }
};

button.addEventListener('click', togglePictureInPicture);

Go back to shorts