mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 13:45:25 +03:00
Get pip working correctly
This commit is contained in:
parent
392ff1319d
commit
087afd96fe
@ -127,22 +127,22 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
|
|||||||
if (mainRef.current == null) {
|
if (mainRef.current == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fsListener = () => {
|
const fsListener = () => {
|
||||||
setFullscreen(document.fullscreenElement != null);
|
setFullscreen(document.fullscreenElement != null);
|
||||||
};
|
};
|
||||||
const pipListener = () => {
|
|
||||||
setPip(document.pictureInPictureElement != null);
|
|
||||||
};
|
|
||||||
document.addEventListener("fullscreenchange", fsListener);
|
document.addEventListener("fullscreenchange", fsListener);
|
||||||
document.addEventListener("focusin", pipListener);
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener("fullscreenchange", fsListener);
|
document.removeEventListener("fullscreenchange", fsListener);
|
||||||
document.removeEventListener("focusin", pipListener);
|
|
||||||
};
|
};
|
||||||
}, [mainRef]);
|
}, [mainRef]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setPip(document.pictureInPictureElement != null);
|
||||||
|
// we know that these deps are correct
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [document.pictureInPictureElement]);
|
||||||
|
|
||||||
// playback state
|
// playback state
|
||||||
|
|
||||||
const [audio, setAudio] = useState(false);
|
const [audio, setAudio] = useState(false);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user