BimmerGestalt / AAIdrive

Implementations of some Android Auto features as unofficial IDrive apps
MIT License
540 stars 90 forks source link

Spotify "enable shuffle" not working from iDrive controls #625

Closed HaivanJV closed 1 year ago

HaivanJV commented 1 year ago

I noticed that I cannot enable/disable shuffling anymore, when inside the Spotify app from the iDrive. One possible reason is the new "smart shuffle" feature. When Spotify App (on the phone) is playing, selecting "shuffle" from the song view screen pops up a selection menu. There you can select normal and enhanced shuffle (screenshot attached).

1) do you experience the same limitation from the iDrive? 2) can the new feature be the cause of it? 3) if yes, can the iDrive control be defaulted to normal shuffle?

image
hufman commented 1 year ago

Hmmm it seems that my Spotify (freshly updated to version 8.7.76.359) does not have this feature, I checked while playing from an album and from a playlist. AAIdrive uses the Spotify API to setShuffle(true/false), and so it would be up to Spotify to handle this command appropriately. The current API docs don't indicate that they've enhanced the shuffle command, however.

HaivanJV commented 1 year ago

most probably this is behind an a/b test or only released on a regional basis. Please let me know whether you encounter the same issue in the future

6i6i commented 1 year ago

Same problem for me.

DominikS66 commented 1 year ago

The Problem appeared between Spotify Version 8.7.70.553 (working) and Version 8.7.72.546 (Not working). With actual Version 8.7.78.383, Shuffle can be enabled, but it is Not shown active in Button Bar. In Action Dialog, the State Of shuffle is shown correct, but cannot be changed. Strange…

hufman commented 1 year ago

Good news! My Spotify no longer lets me disable Shuffle from the car interface, but I can enable shuffle. The UI doesn't show whether shuffle or repeat are enabled. Now that I can reproduce the problem, I might be able to make progress! Or it might just be a bug report on Spotify's API, I can't promise a fix yet :)

JollyJumper88 commented 1 year ago

I also cannot disable shuffle

DominikS66 commented 1 year ago

here some screenshots.

  1. Tool bar icon the tool bar icon is always showing shuffle not activated, even if the state of shuffling is changed on the smartphone. 20221226_135353 Toggling shuffle from here switches shuffling on in Spotify. The called function toggleshuffle uses the inverted actual state - as the state is (by error) disabled the function can only enable shuffle.

  2. Custom action menu Inside this menu, the state of shuffling is always shown correct. When you change shuffling in Spotify on teh smartphone, the correct state of shuffling is shown here: 20221226_135555 (shuffling disabled by smartphone app) 20221226_135824 (shuffling enabled by smartphone app) Strange thing: Inside the custom action menu it is NOT possible to change shuffling state (neither enable nor disable shuffling), although the same function toggleshuffling is used. @hufman i didn't dug deep inside the source code yet, but maybe you create two different objects from spotify api, one for toolbar and one for custom action menu ? Maybe this is the reason for this strange behavior. BTW, I tested Spotify shuffle toggle API call here outside of the app: https://developer.spotify.com/console/put-shuffle/ and it worked correct.

hufman commented 1 year ago

Thank you for investigating! I added some debug statements and indeed, Spotify's SDK is now always returning isShuffle:false even though my Spotify version doesn't have Smart Shuffle enabled, so I raised an issue against the SDK. The official forum even has a thread about it, cataloguing what versions are affected.

The Custom Actions menu is combined from the Spotify SDK code (Repeat and Like) and the generic music controller which is only accessible if the user has granted control over all running music apps. The shuffle option in that menu is provided by this generic music controller, and AAIdrive is unable to parse it to drive the main toolbar entry.

hufman commented 1 year ago

I randomly tried this today and it seemed to work well (Spotify version 8.8.12.545). Can other people confirm that it works for them?

HaivanJV commented 1 year ago

Updated Spotify and tried it. It works for me as well!

hufman commented 1 year ago

Excellent, thanks!