fix: defer MPV playback start until user unpauses on session restore

Instead of play → pause → sleep → seek when restoring a paused session,
introduce loadTrackPaused which sets internal state and fires UI/OS
callbacks (song change, paused) without touching MPV. On Continue(),
detect pendingLoadPaused and start MPV playback from the saved position.

Also triggers waveform pre-generation for the paused track via the
onBeforeSongChange hook.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Drew Weymouth
2026-02-21 09:40:59 -08:00
co-authored by Claude Sonnet 4.6
parent ce3ae4f15a
commit dba540861f
5 changed files with 80 additions and 6 deletions
+1 -5
View File
@@ -683,11 +683,7 @@ func (a *App) LoadSavedPlayQueue() error {
}
if playQueue.TrackIndex >= 0 && playQueue.TrackIndex < len(playQueue.Tracks) {
// TODO: This isn't ideal but doesn't seem to cause an audible play-for-a-split-second artifact
a.PlaybackManager.PlayTrackAt(playQueue.TrackIndex)
a.PlaybackManager.Pause()
time.Sleep(100 * time.Millisecond) // MPV seek fails if run quickly after
a.PlaybackManager.SeekSeconds(playQueue.TimePos)
a.PlaybackManager.LoadTrackPaused(playQueue.TrackIndex, playQueue.TimePos)
}
return nil