/
/
/
# What does this implement/fix? Follow-up to #5613. A speaker's list of linked protocols carries an "available" flag that is set once when the link is made and never refreshed, so it stays `True` even after that protocol player has gone offline. #5613 fixed the sync group's use of it; two other places still asked the same question by hand. The one that mattered: when the leader of an ad-hoc group is removed while music is playing, the leader role is handed to a remaining member that can play on the same protocol. That check trusted the stale flag, so it could hand the group to a speaker whose AirPlay side was already gone. It now picks a speaker that is actually reachable, and otherwise falls back to the first remaining member (which switches the group to another protocol) instead of moving onto a dead one. ## Changes - Added `Player.playback_domains` — a single, live answer to "which protocols can this speaker be reached on right now" — next to `Player.output_protocols`. - Leader hand-over in the player controller now uses it instead of the stale flag. - The sync group's private copy of the same logic is gone; it uses the shared property. - Tests for the new property and for the leader hand-over skipping an offline speaker. `_resolve_session_target` in the sync group was checked too and deliberately left alone: it looks up *which* player object of a member handles a given protocol, not whether that member is reachable. Filtering it on live availability would drop a member from the hand-over bookkeeping right after the old session's ownership has been torn down, leaving it playing with nobody owning it. **Related issue (if applicable):** - n/a ## Types of changes - [ ] 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` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [x] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [ ] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have [raised a PR against the documentation repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md) targeting the main or beta branch as appropriate.