Conversation
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 <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #853 by implementing a cleaner mechanism to restore playback state on app startup. Previously, the app would momentarily play, pause, and seek to restore a paused track, causing brief audio artifacts and unwanted scrobbling. The new LoadTrackPaused mechanism sets up the engine state (UI, OS integrations, waveform generation) without touching the MPV player, deferring actual playback initialization until the user presses Continue.
Changes:
- Added
LoadTrackPausedcommand and engine method to load a track in paused state without starting MPV playback - Modified
NowPlaying()andPlaybackStatus()to correctly report state when a track is loaded but not yet playing - Enhanced waveform generation to handle tracks loaded in paused state at app startup
- Simplified
App.LoadSavedPlayQueue()to use the new mechanism, removing the play-pause-seek workaround
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| backend/playbackcommands.go | Added cmdLoadTrackPaused command type and LoadTrackPaused method to command queue |
| backend/playbackengine.go | Implemented loadTrackPaused method, updated state checks in NowPlaying/PlaybackStatus, and modified Continue/Stop/playTrackAt to handle pendingLoadPaused state |
| backend/playbackmanager.go | Added LoadTrackPaused public API, isLoadTrackPaused helper, waveform handling for paused load state, and command processing |
| backend/app.go | Replaced play-pause-seek workaround with LoadTrackPaused call for cleaner queue restoration |
| backend/mediaprovider/subsonic/jukebox_mock.go | Added missing package declaration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #853
This pull request introduces a new mechanism for restoring the play queue so that, on app startup, the previously playing track is loaded in a paused state at the correct position—without immediately interacting with the audio backend (MPV). This avoids the previous workaround of momentarily playing, pausing, and seeking the track, which could cause audio artifacts. The implementation involves new command types, engine state handling, and careful management of UI and waveform updates.
Key changes:
Core Playback Engine and Command Handling
cmdLoadTrackPaused) and corresponding methods (LoadTrackPaused,loadTrackPaused) to support loading a track in a paused state at a specific position, updating engine state and UI/OS integrations without starting playback in the audio backend. [1] [2] [3] [4] [5]NowPlayingandPlaybackStatusmethods to correctly reflect the paused state when a track is loaded but not yet playing, ensuring UI consistency. [1] [2]Continuemethod to begin playback from the paused state, handling scrobbling and track change logic correctly.App Startup and Play Queue Restoration
App.LoadSavedPlayQueueto use the newLoadTrackPausedmethod, eliminating the need for the previous workaround that could cause a brief playback artifact.Waveform and UI Integration
Other
jukebox_mock.gofor completeness.These changes improve the reliability and user experience when restoring playback state on app startup, and provide a cleaner, more maintainable approach to handling paused track loading.