From 13833e814414252802e93e66edbd8cdee866e83d Mon Sep 17 00:00:00 2001 From: yiling Date: Sat, 4 Jul 2026 13:04:25 +0800 Subject: [PATCH] fix(webui): auto-hide fullscreen controls on idle regardless of play state The fullscreen control bar only auto-hid while playing, and a separate effect force-showed it whenever paused, so it stayed visible permanently when paused in fullscreen. Now in fullscreen the bar shows on cursor move and hides after the cursor is idle (~2s) whether playing or paused; windowed mode keeps the bar always visible. --- .../webui/components/viewers/video-player.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/webui/components/viewers/video-player.tsx b/packages/webui/components/viewers/video-player.tsx index 7ea029f2..54b16fe8 100644 --- a/packages/webui/components/viewers/video-player.tsx +++ b/packages/webui/components/viewers/video-player.tsx @@ -348,22 +348,22 @@ const VideoPlayer: React.FC = ({ clearTimeout(controlsTimeoutRef.current) } - // Only set auto-hide timer if we are in fullscreen and playing - // If paused, controls should remain visible so user can see what to do - if (state.isFullScreen && state.isPlaying) { + // In fullscreen, hide the controls after the cursor stays idle, regardless + // of play/pause (YouTube-style). In windowed mode controls stay visible. + if (state.isFullScreen) { controlsTimeoutRef.current = setTimeout(() => { setIsControlsVisible(false) }, 2000) } - }, [state.isFullScreen, state.isPlaying]) + }, [state.isFullScreen]) const handleMouseLeave = useCallback(() => { - // If we leave the player area in fullscreen, hide controls (optional preference, usually good) - if (state.isFullScreen && state.isPlaying) { + // If the cursor leaves the player while fullscreen, hide the controls. + if (state.isFullScreen) { if (controlsTimeoutRef.current) clearTimeout(controlsTimeoutRef.current) setIsControlsVisible(false) } - }, [state.isFullScreen, state.isPlaying]) + }, [state.isFullScreen]) // Clean up timeout on unmount or state change useEffect(() => { @@ -372,13 +372,13 @@ const VideoPlayer: React.FC = ({ } }, []) - // Ensure controls are visible when pausing or entering fullscreen initially + // Windowed mode: controls are always visible. Fullscreen: show now and let + // the idle timer hide them (re-runs on play/pause so pausing re-reveals them). useEffect(() => { - if (!state.isPlaying) { + if (!state.isFullScreen) { setIsControlsVisible(true) if (controlsTimeoutRef.current) clearTimeout(controlsTimeoutRef.current) } else { - // If we just started playing (or re-entered playing state), trigger the timer logic handleMouseMove() } }, [state.isPlaying, state.isFullScreen, handleMouseMove])