fondberg / spotcast

Home assistant custom component to start Spotify playback on an idle chromecast device as well as control spotify connect devices
Apache License 2.0
674 stars 98 forks source link

When switching Cast Device - Music was stopped because spotify was used at a different device #323

Open VaillantHassIo opened 2 years ago

VaillantHassIo commented 2 years ago

Bug Ticket

Describe the bug

A clear and concise description of what the bug is.

Environment

Configuration

Service Call

Additional context

I belive this is not(?) related to https://github.com/fondberg/spotcast/issues/13

fcusson commented 2 years ago

Hi @VaillantHassIo, I would consider this more of an improvement option than a bug. The following is primarily to document so people can pitch in on their idea for improvement

I can confirm yes this would be the appropriate behavior, but that's because we don't have control over the way the media_selector makes the transfer.

Basically, Spotcast already has a way to transfer playback, you simply call the spotcast.start without any media data (no URI, search query or category) and it will do just that transfer the playback, but if you transfer the playback and change media at the same time, the API sees that as the account being overtaken by the new media source and sends that message.

I could try and simply add a stop media before the rest of the start method, but we will have to test if this creates problem in seamlessness in general for the integration.

VaillantHassIo commented 2 years ago

thx for reply.

So transition to a different device should work flawlessly, thats what you are saying? as long as no new media is being started. ( which is not the case unfortunately )

fcusson commented 2 years ago

i was not changing the media data, are you saying the spotcast media selector is different from spotcast.start?

I'm not sure I'm following you, because I'm unaware of a way to change the media source without selecting a media in the media selector. Just to make sure we are talking about the same thing: Are you talking about the media tab in the left menu of your dashboard when you refer to the media player selector (or the pop-up menu on the media_player itself)? Or something else?

Also, how do you go about changing the source?

After testing, it seems the transfer playback solution we have (spotcast.start without media data) sends the "used on another device" message also, which is a regression because it wasn't supposed to do it anymore. A change in the API might be causing that. We would have to check if it's possible to circumvent that. It could be possible that we are stuck with the message if we don't want to sacrifice usability.

VaillantHassIo commented 2 years ago

change in the API might be causing that. We would have to check if it's possible to circumvent that. It could be possible that we are stuck with the message if we don't want to sacrifice usability.

I had a typo. Its the CastDevice Selector not Media Selector. But your statement above basically narrow it down, this being a regression. Do you have a Reference Issue for that?

I am gonna try to see if the automation (script) in HA can send a stop before start playback on another device.

Feel free to close this issue. Many thx again

fcusson commented 2 years ago

That is something we could look into in the process flow of Spotcast, I won't close the issue to keep documentation on a potential improvement.