From 13fa6b672e957cbf7b7bd39674cebde661d5725d Mon Sep 17 00:00:00 2001 From: kuekhaoyang Date: Mon, 17 Nov 2025 22:38:53 +0800 Subject: [PATCH] feat: Implement control visibility toggle on shortcut key press in CustomVideoPlayer --- components/player/CustomVideoPlayer.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/player/CustomVideoPlayer.tsx b/components/player/CustomVideoPlayer.tsx index 318cff0..51872cc 100644 --- a/components/player/CustomVideoPlayer.tsx +++ b/components/player/CustomVideoPlayer.tsx @@ -418,6 +418,16 @@ export function CustomVideoPlayer({ const shortcuts = [' ', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'f', 'F', 'm', 'M', 'i', 'I', '<', '>', ',', '.']; if (shortcuts.includes(e.key)) { e.preventDefault(); + + // Show controls when any shortcut key is pressed + setShowControls(true); + if (controlsTimeoutRef.current) { + clearTimeout(controlsTimeoutRef.current); + } + // Hide controls after 3 seconds if video is playing + if (isPlaying) { + controlsTimeoutRef.current = setTimeout(() => setShowControls(false), 3000); + } } switch (e.key) {