mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 18:59:00 +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)
|
||||
}
|
||||
|
||||
@@ -903,7 +903,6 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
|
||||
toggleLoop={toggleLoop}
|
||||
toggleMute={toggleMute}
|
||||
handleVolumeChange={handleVolumeChange}
|
||||
setState={setState}
|
||||
changePlaybackRate={changePlaybackRate}
|
||||
changeResolution={changeResolution}
|
||||
handleDownload={handleDownload}
|
||||
|
||||
Reference in New Issue
Block a user