Resync playback state on app activate and menu open#7
Merged
Conversation
|
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.



Closes the second cause of #5: a
player_state_changedevent lost while the socket stays alive was never recovered, leaving stale "not playing" state.Adds a
PlaybackSyncService.resyncPlaybackState(pid:)to the audio service and triggers it when a UI surface appears — menu bar opens (MenuBarView.onAppear) and the window becomes active (scenePhase == .active). The HEOS implementation re-reads play state and now-playing and applies each only on success, so a transient fetch failure can never overwrite good state with defaults.No polling timer — the resync runs exactly when the user looks, which is when staleness matters. Dropped-connection recovery was already handled by the existing reconnect path.
Tests: new PlayerViewModel cases cover resync-when-connected and the two no-op guards (disconnected, no selected player). NeosDomain 35, HEOSKit builds, Neos app builds, PlayerViewModelTests 24 pass.
Closes #5