devgianlu/go-librespot

Don't try play while ALSA device is using by other player

Closed this issue · 2 comments

  1. Pause currently playing track in android spotify app (and start playing internet radio with mpd...)

DEBU[3699] handling pause player command from [UID - edited]
DEBU[3699] pause track at 139981ms
DEBU[3699] put connect state because PLAYER_STATE_CHANGED
DEBU[3699] sending successful reply for dealer request
DEBU[3699] put connect state because PLAYER_STATE_CHANGED

  1. Trying resume palyback in spotify app while mpd is still using ALSA Device

DEBU[3954] handling resume player command from [UID - edited]
ERRO[3954] failed resuming playback error="ALSA error at snd_pcm_open: Device or resource busy"
DEBU[3954] resume track at 139739ms
DEBU[3954] put connect state because PLAYER_STATE_CHANGED
DEBU[3954] sending successful reply for dealer request
DEBU[3954] put connect state because PLAYER_STATE_CHANGED

After that mpd is still playing (as expected) and progress bar in spotify android app goes forward without sound.

Can we handle this scenario in go-librespot (dont resume track while ALSA Device is using by other player)?

We definitely should not fake being able to play, but instead return an error. I don't think there's any easy way to communicate this specific problem (audio device busy) to the client in a nice way.

I have implemented a fix, feel free to re-open if this is not fixed.