Enable companion Cloud video picture-in-picture

This commit is contained in:
archipelago
2026-10-07 08:05:56 -04:00
parent a64dd77efa
commit 6e38d0c093
3 changed files with 20 additions and 2 deletions
+4 -1
View File
@@ -20,7 +20,10 @@ export function isPipSupported(): boolean {
}
export async function togglePip(video: HTMLVideoElement | null | undefined): Promise<void> {
if (!video || !pipSupported) return
// Check at call time. Embedded WebViews can expose the document capability
// after the module has been evaluated, and companion navigation can restore
// a page with a different media capability than its first load.
if (!video || !isPipSupported()) return
try {
if (document.pictureInPictureElement === video) await document.exitPictureInPicture()
else await video.requestPictureInPicture()