Skip to content

armgit / Piik

Public Imported from GitHub
0

Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。

fix(viewer): reveal overlays from fullscreen (#261)

AAAb25ea5c0d19e
diff --git a/src/client/pages/ViewerPage.tsx b/src/client/pages/ViewerPage.tsx
index d4ef9962..d15d1fa6 100644
--- a/src/client/pages/ViewerPage.tsx
+++ b/src/client/pages/ViewerPage.tsx
@@ -1534,6 +1534,30 @@ export function ViewerPage({ roomId, viewerGrant }: ViewerPageProps) {
);
}, [frameProofEpoch, presentationState.connection, remoteMedia]);
+ useEffect(() => {
+ if (presentation.overlay === "none") {
+ return;
+ }
+ const video = videoRef.current as
+ | (HTMLVideoElement & {
+ webkitDisplayingFullscreen?: boolean;
+ webkitExitFullscreen?: () => void;
+ })
+ | null;
+ if (!video) {
+ return;
+ }
+ if (document.fullscreenElement === video) {
+ void document.exitFullscreen().catch(() => undefined);
+ return;
+ }
+ if (video.webkitDisplayingFullscreen) {
+ try {
+ video.webkitExitFullscreen?.();
+ } catch {}
+ }
+ }, [presentation.overlay]);
+
useEffect(() => {
dispatchPresentation({
type: "retry-available",