/
/
# What does this implement/fix? Pausing a live audio source (like Spotify Connect) left the Spotify app tethered to Music Assistant for good: it kept showing MA as its playback device, paused, even after the queue was cleared, replaced by other music, or moved to another player. Pausing already ends the stream, so the callback that normally hands the device back has nothing left to release by the time the queue changes - and none of those three actions gave the plugin any signal of their own. - Spotify Connect now hands the device back when you clear the queue, so the Spotify app drops MA as its playback target instead of staying stuck on it. - Same when you start something else that takes the source's place in the queue - playing an album or playlist, for instance. - Starting that same source again still resumes where you paused it: that is not the source leaving the queue. - Moving a paused source to another player used to leave the plugin pointing at the player it came from. It now follows the source, which also fixes volume sync and where playback starts when you press play in the Spotify app afterwards. - Under the hood: two optional callbacks for plugin providers (`on_source_removed` and `on_source_transferred`); sources that are still streaming keep releasing on the existing stream teardown. **Related issue (if applicable):** - n/a ## Types of changes - [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` - [ ] 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` - [ ] 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.