refactor(webui): move onTimeUpdate out of requestAnimationFrame loop

Moves the onTimeUpdate callback back into the native low-frequency timeupdate handler to avoid parent performance degradation, and removes it from the requestAnimationFrame loop and useEffect dependency array.
This commit is contained in:
yiling
2026-06-14 21:06:39 +08:00
parent e9e9be71f4
commit 443b099e12
@@ -517,10 +517,10 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
progress: duration > 0 ? (current / duration) * 100 : 0,
}
})
}
if (onTimeUpdate) {
onTimeUpdate(current)
}
if (onTimeUpdate) {
onTimeUpdate(current)
}
})
@@ -577,10 +577,6 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
}
})
if (onTimeUpdate) {
onTimeUpdate(current)
}
animationFrameId = requestAnimationFrame(updateProgress)
}
}
@@ -594,7 +590,7 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
cancelAnimationFrame(animationFrameId)
}
}
}, [state.isPlaying, playerRef, data.media?.metadata?.duration, onTimeUpdate])
}, [state.isPlaying, playerRef, data.media?.metadata?.duration])
const handleMouseMove = useCallback(() => {
// Always show controls on movement