Unintentionally comitted to main
This commit is contained in:
David Baker 2023-01-03 18:34:27 +00:00
commit 70b693ef3c
2 changed files with 2 additions and 15 deletions

View file

@ -54,23 +54,16 @@ export function useFullscreen(ref: React.RefObject<HTMLElement>): {
);
const onFullscreenChanged = useCallback(() => {
if (!document.fullscreenElement && !document.webkitFullscreenElement) {
if (!document.fullscreenElement) {
setFullscreenParticipant(null);
}
}, [setFullscreenParticipant]);
useEventTarget(ref.current, "fullscreenchange", onFullscreenChanged);
useEventTarget(ref.current, "webkitfullscreenchange", onFullscreenChanged);
useEffect(() => {
if (disposed) {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else {
logger.error("No available fullscreen API!");
}
document.exitFullscreen();
setFullscreenParticipant(null);
}
}, [disposed]);