ios-sdk icon indicating copy to clipboard operation
ios-sdk copied to clipboard

Spotify enqueueTrackUri function has reversed the enqueue method; songs enqueued will stay in queue regardless of user action

Open zallanx opened this issue 2 years ago • 6 comments

Recently, it appears that the enqueueTrackUri function has reversed the way tracks are enqueued on the Spotify iOS app. Previously, the queueing function would always add a track to the next-to-be-played queue.

To illustrate, with songs A, B, C and D, if song A is playing:

  • calling enqueue on B would result in [A, B] as the song queue.
  • calling enqueue on C would result in [A, C, B] as the song queue
  • calling enqueue on D would result in [A, D, C, B] as the song queue

A stealth update to backend, or possibly an update to the Spotify iOS app itself which changed the user behavior, has reversed this order so that:

With songs A, B, C and D, if song A is playing:

  • calling enqueue on B would result in [A, B] as the song queue
  • calling enqueue on C would result in [A, B, C] as the song queue
  • calling enqueue on D would result in [A, B, C, D] as the song queue

Is this an intended consequence?

Also, related to this note, the queue can no longer be cleared and enqueued songs would always stay in the queue unless they are played or the user manually hits clear queue. Is this also intended?

Thanks for addressing!

zallanx avatar Mar 23 '22 03:03 zallanx

Hey @zallanx having the same issue here. I'm working on an already build app that has spotify integrated. I really need to be able to clear the queue or at least have the track prepended to the current queue.

I was wondering was this possible in the past and which version of the sdk would that be?

ArlindDushi avatar Jun 07 '22 11:06 ArlindDushi

Hey @ArlindDushi, the workaround I discovered to clear the queue was to:

  1. Pause
  2. Skip through all of the remaining tracks in the queue
  3. Resume playback

The gap between the pause and resume is imperceptible and does not disrupt the user experience.

To your other question about whether there is an older version of the SDK that can be reverted to: I don't believe so. I think this was a stealth to the Spotify mobile product, which upended queuing.

I hope this helps.

zallanx avatar Jun 07 '22 13:06 zallanx

Hey @zallanx thanks for the quick response! How did you manage to know what is currently queued (so that we know how many times to skip) ? I don't see any API in the spotify sdk to get the current queue.

ArlindDushi avatar Jun 07 '22 13:06 ArlindDushi

Hi @ArlindDushi, good question - while it is not possible tell what's currently in queue using the SDK, once there are no more tracks to skip, the API will respond with an error but will not cause any UX issues. In other words, if you skip a finite number of times (for example, you have 10 songs but call the skip functions 20 times) it will not cause any issues.

Unfortunately all very hacky. But unless there is a material update to the SDK, hacky is the way to go for now.

zallanx avatar Jun 07 '22 21:06 zallanx

Also, related to this note, the queue can no longer be cleared and enqueued songs would always stay in the queue unless they are played or the user manually hits clear queue. Is this also intended?

Also affected by this behavior change. Reported it through a couple different channels:

  • https://community.spotify.com/t5/Spotify-for-Developers/iOS-SDK-SPTAppRemotePlayerAPI-play-regression/td-p/5398699
  • https://twitter.com/PhilipTrauner/status/1542162973988454403

(@zallanx) I also experimented with your "pause and skip until skipping fails" workaround (on main thread), but said workaround ended up frequently inducing faulty state in the Spotify app itself, consequently preventing any further queue modification.

PhilipTrauner avatar Jun 29 '22 15:06 PhilipTrauner

Thanks for the heads up and for reporting the issue, @PhilipTrauner. Also, thanks for highlighting it to the Spotify team.

I have also found the delete songs in queue feature request posted on the Spotify community board (in 2020) - so far no action has been taken by the team to implement it.

If you find a more reliable workaround to clearing the queue, I would be keen to implement it on my end.

zallanx avatar Jun 29 '22 18:06 zallanx