devgianlu/go-librespot

Transferring playback to go-librespot doesn't always work

Closed this issue · 2 comments

I found that transferring playback to go-librespot doesn't always work.

Sometimes it switches back to the previous player. Other times the previous player becomes unresponsive, and only switching back and forth again fixes it.

It appears that this happens only when transferring playback after playback was transferred successfully before. So if it fails, switching to a different player and to go-librespot again typically works.

See: #106 (comment)

I think the core issue is that the cluster update (hm://connect-state/v1/cluster) and the "transfer" player command (hm://connect-state/v1/player/command) are sometimes reversed so that the cluster update of the previous device comes after the transfer player command.

I have experienced this bug myself too and it has always been kind of a problem. My previous attempt at fixing this with librespot-java was this: https://github.com/librespot-org/librespot-java/blob/d0ff31b4f476590c9c17401aac01a6762e4ba908/player/src/main/java/xyz/gianlu/librespot/player/state/DeviceStateHandler.java#L174-L176

Sadly this doesn't seem to fix the bug entirely, though it is a whole lot better. I still sometimes get "bounced" after connecting to go-librespot.