spotcast icon indicating copy to clipboard operation
spotcast copied to clipboard

Add shuffle and other options to media browser

Open bernikr opened this issue 3 years ago • 5 comments

I really like that the usage of this integration improved drastically with the new media browser. However, I find myself still using the old spotcast.start service because I want to shuffle a playlist. I think if the there was a way to set the "shuffle", "random songs" and other flags through the media browser, the usability would improve even more.

bernikr avatar Apr 01 '22 21:04 bernikr

This is sadly a limitation on home assistant side. Not possible to implement because the media selector doesn't have hooks for shuffle and random songs (for all I know, the documentation is very lacking for this feature).

Even then, the shuffle toggle would have to be implemented from the Spotify integration directly, not Spotcast

fcusson avatar Apr 23 '22 16:04 fcusson

@fcusson the Spotify code seems to suggest it's there

https://github.com/home-assistant/core/blob/dev/homeassistant/components/spotify/media_player.py#L45

hmmbob avatar Apr 23 '22 16:04 hmmbob

@hmmbob the media_player does provide a way to shuffle directly from media_player.spotify, but the media_selector currently doesn't have the button for it. We only have access to async_browse_media and async_play_media. No argument can be passed to play_media and the media_selector only has a simple play button, no way to select to shuffle.

Unless I'm missing something in the documentation, but the only hook we have is the async_play_media.

Technically, we can modify the method to shuffle the media source, but that would be hardcoded and not something the user can choose.

That leaves us with hardconding the shuffle and random_song arguments or calling the service. We must ask ourselves:

  1. Should shuffle be the default playback method or ordered should?
  2. Could we parse per media_type and say per exemple, album is ordered but playlist shuffle?

The important part to take into account is that we would be forcing this behavior on all the users

fcusson avatar Apr 23 '22 17:04 fcusson

Hmmm, too bad. Saw this in the code, so hoped it would be available for use.

I don't think existing behavior should change.

hmmbob avatar Apr 23 '22 17:04 hmmbob

With mushroom cards it's a little buggy but works.

Silther avatar Sep 24 '23 20:09 Silther