fix(video): resolve 1-frame shift on external seeks due to floor rounding

This commit is contained in:
yiling
2026-06-28 21:12:29 +08:00
parent eee7b5a677
commit 1ebf79edd3
2 changed files with 1 additions and 2 deletions
@@ -245,7 +245,7 @@ export function useFramePlayer(
const handleExternalSeeked = () => {
// Only sync if this seek was not triggered internally by seekToFrame
if (!isSeekingRef.current) {
const actualFrame = Math.floor(video.currentTime * frameRate)
const actualFrame = Math.round(video.currentTime * frameRate)
const finalFrame = Math.max(0, Math.min(actualFrame, totalFrames - 1))
setCurrentFrame(finalFrame)
}