fix more progress

This commit is contained in:
Jelle van Snik 2023-02-07 23:26:40 +01:00
parent f8b5c4169c
commit d8e2597db7

View File

@ -15,6 +15,11 @@ export function ProgressAction() {
const videoTime = useProgress(descriptor);
const ref = useRef<HTMLDivElement>(null);
const dragRef = useRef<boolean>(false);
const controlRef = useRef<typeof controls>(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)