Skip to content

Resync playback state on app activate and menu open#7

Merged
gaelsimon merged 3 commits into
mainfrom
fix/playback-resync
Jun 19, 2026
Merged

Resync playback state on app activate and menu open#7
gaelsimon merged 3 commits into
mainfrom
fix/playback-resync

Conversation

@gaelsimon

Copy link
Copy Markdown
Owner

Closes the second cause of #5: a player_state_changed event 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

@sonarqubecloud

Copy link
Copy Markdown

@gaelsimon gaelsimon merged commit 8a6289b into main Jun 19, 2026
3 checks passed
@gaelsimon gaelsimon deleted the fix/playback-resync branch June 19, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Player intermittently shows "not playing" while audio is actually playing

1 participant