Skip to content

Build your personal knowledge base with Trilium Notes

feat(video_player): don't hide controls if not playing

Elian Doranf6d61eefcc09
diff --git a/apps/client/src/widgets/type_widgets/file/Video.tsx b/apps/client/src/widgets/type_widgets/file/Video.tsx
index 5eac6ca68e..1e755dd389 100644
--- a/apps/client/src/widgets/type_widgets/file/Video.tsx
+++ b/apps/client/src/widgets/type_widgets/file/Video.tsx
@@ -72,6 +72,7 @@ function useAutoHideControls(videoRef: RefObject<HTMLVideoElement>, playing: boo
}, [scheduleHide]);
const onClick = useCallback((e: MouseEvent) => {
+ if (!playing) return;
if ((e.target as HTMLElement).closest(".video-preview-controls")) return;
setVisible((prev) => {
const next = !prev;
@@ -79,7 +80,7 @@ function useAutoHideControls(videoRef: RefObject<HTMLVideoElement>, playing: boo
if (next) scheduleHide();
return next;
});
- }, [scheduleHide]);
+ }, [playing, scheduleHide]);
// Auto-hide when playback starts, show when paused.
useEffect(() => {