So, I was skimming through MDN beautifully written docs on Web APIs and discovered there’s an API called “Picture-in-Picture” that basically lets you “detach” a video player from its context (browser tab) and treat it like a “standalone” player.

r/webdev - TIL: You can activate PIP (Picture in Picture) in Youtube (or any HTMLVideoElement)

Youtube video in PIP mode

AFAIK, Youtube doesn’t support it out of the box yet, but it is pretty easy to do it manually, you just need to select the HTMLVideoElement and $0.requestPictureInPicture() .

It’s specially useful if you have a single monitor and are following a tutorial while coding, so that you don’t need to ALT+TAB.

EDIT: There’s actually an extension in Chrome that activates PIP mode with a shortcut and it’s been developed by Google itself. Chrome PIP Extension



Source link

Write A Comment