diff --git a/internal/player/unified_ffmpeg_player.go b/internal/player/unified_ffmpeg_player.go index 1ef5ff1..2b067b6 100644 --- a/internal/player/unified_ffmpeg_player.go +++ b/internal/player/unified_ffmpeg_player.go @@ -582,7 +582,8 @@ func (p *UnifiedPlayer) startVideoProcess() error { p.cmd = cmd // Start video frame reading goroutine - go func() { + if !p.previewMode { + go func() { rate := p.frameRate if rate <= 0 { rate = 24 @@ -626,7 +627,8 @@ func (p *UnifiedPlayer) startVideoProcess() error { } } } - }() + }() + } return nil } diff --git a/internal/player/unified_player_adapter.go b/internal/player/unified_player_adapter.go index 27fc823..e09afa3 100644 --- a/internal/player/unified_player_adapter.go +++ b/internal/player/unified_player_adapter.go @@ -75,7 +75,7 @@ func NewUnifiedPlayerAdapter(path string, width, height int, fps, duration float Muted: false, AutoPlay: false, HardwareAccel: false, - PreviewMode: false, + PreviewMode: true, AudioOutput: "auto", VideoOutput: "rgb24", CacheEnabled: true, @@ -287,9 +287,15 @@ func (p *UnifiedPlayerAdapter) startUpdateLoop() { case <-p.updateTicker.C: p.mu.Lock() if !p.paused && p.player != nil { - // Get current time from UnifiedPlayer - currentTime := p.player.GetCurrentTime() - p.current = currentTime.Seconds() + // Drive timeline locally to avoid fighting the frame reader. + elapsed := time.Since(p.startTime).Seconds() + if elapsed < 0 { + elapsed = 0 + } + if p.duration > 0 && elapsed > p.duration { + elapsed = p.duration + } + p.current = elapsed p.frameN = int(p.current * p.fps) // Update UI callbacks