core icon indicating copy to clipboard operation
core copied to clipboard

Another source - stop playing zone

Open nkw2b4wp78-ctrl opened this issue 7 months ago • 4 comments

Hi,

It would be possible to add the following feature.

I’m streaming from Loxone via AirPlay. I play music from my phone on the same output device. Playback on the Audio Server zone continues. It would be good if playback on the Loxone audio zone stopped when another source is used.

Tnx

nkw2b4wp78-ctrl avatar Apr 26 '26 16:04 nkw2b4wp78-ctrl

Did I understood this correctly?

  1. Lox AudioServer plays song on AirPlay client
  2. Phone takes over the AirPlay client
  3. Lox AudioServer should stop

mr-manuel avatar Apr 28 '26 13:04 mr-manuel

Yes, correct.

nkw2b4wp78-ctrl avatar Apr 28 '26 14:04 nkw2b4wp78-ctrl

I added support for this indirectly through @lox-audioserver/[email protected]. The sender now exposes a session-ended event with the RTSP/session end reason, such as busy, disconnected, timeout, etc. Lox AudioServer consumes that event and stops the zone when the AirPlay output session ends unexpectedly.

There is a small guard so our own local actions, like stop, pause, or track restart, are not treated as an external takeover.

One limitation remains: AirPlay does not necessarily provide a clean "taken over by another sender" event. So this works when the target closes/invalidates our session or reports an error. If a device silently ignores our UDP audio without closing the RTSP session, that may not be detectable reliably.

I did not test it myself, but if you want to try it you can use the dev branch. It will also be part of the next beta.

rudyberends avatar Apr 28 '26 18:04 rudyberends

Validated using latest dev container

rudyberends avatar May 05 '26 19:05 rudyberends