From 05c4988066e37b9e951861fab8f67f78b11fcc96 Mon Sep 17 00:00:00 2001 From: Ivan Evans <74743263+Pasithea0@users.noreply.github.com> Date: Thu, 15 Aug 2024 12:47:14 -0600 Subject: [PATCH] Disable PiP and Fullscreen for iOS PWA --- src/pages/parts/player/PlayerPart.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/pages/parts/player/PlayerPart.tsx b/src/pages/parts/player/PlayerPart.tsx index 2d73286b..9eed5d3f 100644 --- a/src/pages/parts/player/PlayerPart.tsx +++ b/src/pages/parts/player/PlayerPart.tsx @@ -20,6 +20,11 @@ export function PlayerPart(props: PlayerPartProps) { const { isMobile } = useIsMobile(); const isLoading = usePlayerStore((s) => s.mediaPlaying.isLoading); + // Detect if running as a PWA on iOS + const isIOSPWA = + /iPad|iPhone|iPod/i.test(navigator.userAgent) && + window.matchMedia("(display-mode: standalone)").matches; + return ( {props.children} @@ -122,12 +127,19 @@ export function PlayerPart(props: PlayerPartProps) {
- {status === playerStatus.PLAYING ? : null} + {/* Disable PiP for iOS PWA */} + {!isIOSPWA && + (status === playerStatus.PLAYING ? : null)} {status === playerStatus.PLAYING ? : null}
- + {/* Disable for iOS PWA */} + {!isIOSPWA && ( +
+ +
+ )}