mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-25 20:11:52 +01:00
fix more progress
This commit is contained in:
parent
f8b5c4169c
commit
d8e2597db7
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user