/
/
# What does this implement/fix? When a speaker's AirPlay/Chromecast/DLNA output starts up before the speaker itself, it could get attached to the wrong speaker. Another player that still listed that output in an outdated config entry would grab it first, and once that happened the real speaker never got its own output back — it stayed on the wrong player permanently. The output now waits for the speaker it was saved against, instead of being handed to whichever player happens to be ready first. If that speaker never appears (removed or replaced device), the existing delayed check still attaches the output elsewhere, so nothing gets stranded. Follow-up to #5801, which fixed the related double-listing but deliberately left this startup ordering alone. **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` Changes: - An output whose saved speaker has not registered yet now waits for that speaker instead of being matched to whatever else is available. - Other speakers registering during that wait also leave the output alone, so it cannot be taken from the other direction either. - Added startup-order tests: an outdated cached entry, a matching identifier, a speaker registering first, and the case where the saved speaker never returns. ## 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.