|
|
@ -15,6 +15,11 @@ export function ProgressAction() { |
|
|
|
const videoTime = useProgress(descriptor); |
|
|
|
const videoTime = useProgress(descriptor); |
|
|
|
const ref = useRef<HTMLDivElement>(null); |
|
|
|
const ref = useRef<HTMLDivElement>(null); |
|
|
|
const dragRef = useRef<boolean>(false); |
|
|
|
const dragRef = useRef<boolean>(false); |
|
|
|
|
|
|
|
const controlRef = useRef<typeof controls>(controls); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
controlRef.current = controls; |
|
|
|
|
|
|
|
}, [controls]); |
|
|
|
|
|
|
|
|
|
|
|
const commitTime = useCallback( |
|
|
|
const commitTime = useCallback( |
|
|
|
(percentage) => { |
|
|
|
(percentage) => { |
|
|
@ -36,11 +41,11 @@ export function ProgressAction() { |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (dragging) { |
|
|
|
if (dragging) { |
|
|
|
const state = getPlayerState(descriptor); |
|
|
|
const state = getPlayerState(descriptor); |
|
|
|
controls.setDraggingTime( |
|
|
|
controlRef.current.setDraggingTime( |
|
|
|
state.progress.duration * (dragPercentage / 100) |
|
|
|
state.progress.duration * (dragPercentage / 100) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
}, [descriptor, dragging, dragPercentage, controls]); |
|
|
|
}, [descriptor, dragging, dragPercentage]); |
|
|
|
|
|
|
|
|
|
|
|
let watchProgress = makePercentageString( |
|
|
|
let watchProgress = makePercentageString( |
|
|
|
makePercentage((videoTime.time / videoTime.duration) * 100) |
|
|
|
makePercentage((videoTime.time / videoTime.duration) * 100) |
|
|
|