Open ksiazkowicz opened 5 years ago
Same goes for disconnecting a bluetooth headset. Is there a DBus event we might listen to?
Found a DBus event for headphone. See https://github.com/sailfish-spotify/hutspot/pull/51/commits/80522fe37f0fcfb9d3221d5d78684f1268efc0e5
I think this is usually done with audio policies.
@abranson I don't know much about those policies. I thought they were meant to give access or not. How can we use them to detect disconnection of a headphone or headset to pause playing?
I will find that out next week - am away this weekend. Other Sailfish music players do it though I think.
Ok, so it's usually done inside QtMultimedia - the resource is lost and there's a signal to catch. But as you're not using that, the fallback is to listen for the routeChanged like you did in #51.
Code is in to pause on route changed to speaker. It works for the audio jack but not for bluetooth. It appears for bluez5 (which my phone uses) you need to run mpris-proxy
(from bluez5-tools
package) for it to work.
When using Librespot locally, user might expect their music to be paused after headphones get unplugged. This is not currently the case.