philippe44 / LMS-uPnP

Integrate UPnP players with LogitechMediaServer
111 stars 17 forks source link

Premature STOPPED event is closing the event subscription #63

Open Mikescops opened 2 years ago

Mikescops commented 2 years ago

Hello @philippe44, hope you're doing well!

While building another UPNP client and trying to debug why the LMS bridge fails to switch between songs in a playlist (even with the force setting), I spotted an issue in recent UPNP players.

I own a SONY HT-A9 sound system (which is a pretty recent device) and while sending the SOAP request #SetAVTransportURI and subscribing to events, the device emits a STOPPED event even before our SOAP request #Play. This naturally triggers an unsubscribe request from LMS.

To make it clearer I have captured the network with Wireshark:

Screenshot_20220610_122110

  1. > POST #SetAVTransportURI
  2. < NOTIFY stopped event
  3. > UNSUBSCRIBE
  4. > POST #Play

Thanks to @alexballas, we confirmed that other devices like his own TV use the same behavior.

Earlier I mentioned that this could cause issues while moving to the next URI in the playlist, and I might be wrong but I still think that as we're not subscribed to the events anymore this is linked.

Our solution to prevent this strange behavior to happen is to ignore the first STOPPED event if it happens before the #Play request or the PLAY/TRANSITIONING event.

See our discussion here: https://github.com/alexballas/go2tv/issues/43#issuecomment-1152166628

Let me know if you have more questions!