mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-05 23:54:25 +00:00
fix(video): resolve 1-frame shift on external seeks due to floor rounding
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user