<!DOCTYPE html>
<html>
<head>
<title>Picture-in-Picture Pixel Test</title>
</head>
<body>
<video controls loop preload=auto src='pixel_test_video.webm'></video>
</body>
<script>
const video = document.querySelector('video');
async function enterPictureInPicture() {
await _waitForMetadata();
await video.requestPictureInPicture();
return true;
}
function _waitForMetadata() {
return new Promise(resolve => {
if (video.readyState >= HTMLMediaElement.HAVE_METADATA) {
resolve();
return;
}
video.addEventListener('loadedmetadata', () => {
resolve();
}, { once: true });
});
}
async function play() {
await video.play();
return true;
}
</script>
</html>