Picture-in-Picture APIã使ã£ã¦ãVideoè¦ç´ ããã¯ãã£ã¼ã¤ã³ãã¯ãã£ã§åçãã¦ã¿ã¾ããã
iOS Safariï¼18.2ï¼ãAndroid Chromeï¼131.0.6778.135ï¼ã§ãåä½ã確èªæ¸ã¿ã§ãã
ã½ã¼ã¹ã³ã¼ã
<html> <head> <style> video { display: block; width: 640px; } button { cursor: pointer; } </style> </head> <body> <video src="movie.mp4" autoplay muted loop></video> <button>PictureInPicture</button> <script> document.querySelector('button').addEventListener('click', () => { if (!document.pictureInPictureElement) { document.querySelector('video').requestPictureInPicture(); } else if (document.pictureInPictureEnabled) { document.exitPictureInPicture(); } }) </script> </body> </html>
DEMO
https://jsfiddle.net/kimizuka/qebu4og6/4/
JSFiddleã«åç»ãã¢ãããã¼ãã§ããªãã£ããããgetUserMediaã使ã£ã¦ãã¦ã§ãã«ã¡ã©ã®æ åããããªã«ãã¬ãã¥ã¼ãã¦ãã¾ãã