From d6a65ce8b72c7146bdf7312d1e898388c86e0567 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 16 Sep 2026 10:12:59 +0200 Subject: [PATCH] Add picture-in-picture to the video player Asked for directly, mobile in particular: a phone has no second window to put this app in the way a desktop might, so the standard browser Picture-in-Picture API - popping the video out into a small, OS-managed floating window - is the one way to keep watching while switching to another app. Standard requestPictureInPicture()/exitPictureInPicture(), not anything WebKit-prefixed - confirmed directly in a real Chromium build that pictureInPictureEnabled/requestPictureInPicture/ exitPictureInPicture are all present, which is what actually matters for Android Chrome, the mobile browser this was asked for. New #pipBtn, right next to #fullscreenBtn - both are "how is this displayed" toggles, so they share the same .fsBtn sizing, and a new .fsBtn[aria-pressed="true"] rule gives it the same "clearly on" orange treatment #castBtn already has (its own rule rather than combined onto .iconBtn, which disagrees with .fsBtn on padding/border-radius/ background). Feature-detected once at mount, not live the way #castBtn's own availability listener is - browser support for this doesn't appear/disappear mid-session the way a Chromecast on the network does. State (aria-pressed) syncs via the video's own enterpictureinpicture/ leavepictureinpicture events rather than the button's click handler alone, so it also reflects the browser's native PiP window being closed directly. No cleanup needed on navigation: browsers already close an active PiP window once its source video leaves the document, and every route change here already destroys and replaces