From 8c0f1822622df8ffb74d4f3d0b1cf25cfc3a0a15 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Fri, 9 Jan 2026 22:06:40 -0500 Subject: [PATCH] fix(player): calculate actual video frame number instead of display counter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The frame counter was showing the internal display loop counter (30fps) instead of the actual video frame number. This caused the UI to show frame numbers jumping by large increments (e.g., 260→304→348). Fixed by calculating: actualFrameNumber = currentTime × fps For a 60fps video: - At 4.33s: frame 260 (not display counter 130) - At 5.07s: frame 304 (not display counter 152) - At 5.80s: frame 348 (not display counter 174) Now the frame counter accurately reflects the actual video frame number, progressing smoothly: 0, 1, 2, 3... (every 1/60th second for 60fps video). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index b5f239b..88775ce 100644 --- a/main.go +++ b/main.go @@ -11401,10 +11401,13 @@ func (p *playSession) frameDisplayLoop() { } lastFrameTime = currentTime - // Update frame counter + // Calculate actual video frame number from current time + actualFrameNumber := int(currentTime.Seconds() * p.fps) + + // Update frame counter (for display tracking) frameCount++ p.mu.Lock() - p.frameN = frameCount + p.frameN = actualFrameNumber p.current = currentTime.Seconds() isPaused := p.paused p.mu.Unlock() @@ -11421,7 +11424,7 @@ func (p *playSession) frameDisplayLoop() { p.prog(p.current) } if p.frameFunc != nil { - p.frameFunc(frameCount) + p.frameFunc(actualFrameNumber) } }, false) }