From d8e2597db7775db846e8dbad4a1122defc46d391 Mon Sep 17 00:00:00 2001 From: Jelle van Snik Date: Tue, 7 Feb 2023 23:26:40 +0100 Subject: [PATCH] fix more progress --- src/video/components/actions/ProgressAction.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/video/components/actions/ProgressAction.tsx b/src/video/components/actions/ProgressAction.tsx index ee08c5da..f8d28036 100644 --- a/src/video/components/actions/ProgressAction.tsx +++ b/src/video/components/actions/ProgressAction.tsx @@ -15,6 +15,11 @@ export function ProgressAction() { const videoTime = useProgress(descriptor); const ref = useRef(null); const dragRef = useRef(false); + const controlRef = useRef(controls); + + useEffect(() => { + controlRef.current = controls; + }, [controls]); const commitTime = useCallback( (percentage) => { @@ -36,11 +41,11 @@ export function ProgressAction() { useEffect(() => { if (dragging) { const state = getPlayerState(descriptor); - controls.setDraggingTime( + controlRef.current.setDraggingTime( state.progress.duration * (dragPercentage / 100) ); } - }, [descriptor, dragging, dragPercentage, controls]); + }, [descriptor, dragging, dragPercentage]); let watchProgress = makePercentageString( makePercentage((videoTime.time / videoTime.duration) * 100)