From 92bd2d5b0e68077957ac26355b33d2f5ba6e97d9 Mon Sep 17 00:00:00 2001 From: Prayag Prajapati Date: Wed, 4 Oct 2023 18:54:51 +0530 Subject: [PATCH] Improve Mouse detection in video player #191 --- src/routes/player/videoPlayer.jsx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/routes/player/videoPlayer.jsx b/src/routes/player/videoPlayer.jsx index 1e2a188..86b8388 100644 --- a/src/routes/player/videoPlayer.jsx +++ b/src/routes/player/videoPlayer.jsx @@ -462,12 +462,13 @@ export const VideoPlayer = () => { const [appFullscreen, setAppFullScreen] = useState(false); useEffect(() => { - let timeout = null; if (showControls) { - window.clearTimeout(timeout); - timeout = setTimeout(() => { + let timeout = setTimeout(() => { setShowControls(false); }, 5000); + return () => { + clearTimeout(timeout); + }; } }, [showControls]); @@ -716,8 +717,10 @@ export const VideoPlayer = () => { @@ -750,9 +753,13 @@ export const VideoPlayer = () => { @@ -780,7 +787,7 @@ export const VideoPlayer = () => { role: "listbox", }} anchorOrigin={{ - vertical: "bottom", + vertical: "top", horizontal: "center", }} transformOrigin={{