Repository navigation
Report the player as available only after its clock is synchronized - #205
Merged
Merged
Conversation
Servers sent audio before the player could schedule it, so a short clip that arrived before the first time sync was never played.
There was a problem hiding this comment.
🟢 Approval recommended
The scoped availability change and callback wiring are consistent, with regression coverage and no identified blocking issues.
No open issues 🎉
What changed in this PR
This PR delays the SDK’s availability report until its clock is synchronized, allowing servers to hold audio until the player can schedule it. Reconnect resynchronization remains deferred to #201.
Changes:
- Report availability from clock synchronization state for all role combinations.
- Send a state update when the clock first becomes synchronized.
- Add availability transition coverage and update time-sync test setup.
| File | Description |
|---|---|
tests/unit/time-sync-manager.test.ts |
Supplies the new synchronization callback in test setup. |
tests/unit/protocol-handler.test.ts |
Tests initial unavailability, synchronized availability, and controller-only behavior. |
src/core/time-sync-manager.ts |
Invokes a callback on the first synchronization transition. |
src/core/protocol-handler.ts |
Reports synchronization-based availability and sends the transition update. |
Review effort: Balanced
1 of 9 tasks
maximmaxim345
added a commit
that referenced
this pull request
Oct 29, 2026
# What does this implement/fix? <!-- Quick description and explanation of changes. --> After a reconnect, the player kept the previous connection's clock offset and reported itself as synchronized. After a server restart, this scheduled playback against the old server clock until the time filter slowly caught up. The time filter now resets whenever a new connection opens, and still persists across a re-handshake as the spec requires. Until the first clock sync on the new connection, the player reports itself as not available and skips sync correction. **Related issue or spec PR (if applicable):** - #205 ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the matching label, and the release notes use it to sort this change. --> - [x] Bugfix (non-breaking change which fixes an issue): `bugfix` - [ ] New feature (non-breaking change which adds functionality): `new-feature` - [ ] Enhancement to an existing feature: `enhancement` - [ ] Breaking change (changes the public API or the protocol in a way that is not backwards compatible): `breaking-change` - [ ] Refactor (no behavior change): `refactor` - [ ] Documentation only: `documentation` - [ ] Maintenance / chore: `maintenance` - [ ] CI / workflow change: `ci` - [ ] Dependencies bump: `dependencies`
This was referenced Nov 5, 2026
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.
What does this implement/fix?
The player reported
available: truebefore its clock was synchronized, so servers sent audio it couldn't schedule yet. A short clip like an announcement that arrived before the first time sync was never played.client/statenow reportsavailable: falseuntil the first time sync completes, then sends an update withavailable: true. I kept one rule for every set of roles, so a controller only client also reportsavailable: falseuntil then.Servers that follow the spec keep a client that opens with
available: falsein its group while it syncs. Music Assistant 2.10.0 to 2.10.6 moves it to its own group instead, which aiosendspin 10.0.0 fixed.After a reconnect the clock filter stays synchronized from the previous connection, so the player can still report available before the new connection's first sync. #201 will fix that.
Related issue or spec PR (if applicable):
available: truebefore its clock is synchronized #182Types of changes
bugfixnew-featureenhancementbreaking-changerefactordocumentationmaintenancecidependencies