Announcements

Playing with an offset is not working when element in URI list appears multiple times

Reply

Playing with an offset is not working when element in URI list appears multiple times

Casual Listener

I am trying to start playing a list of URIs with the offset parameter. Some of the URIs are contained multiple times.

 

Issue found on 2020-06-25.

 

Scope(s):

"streaming", "user-read-email", "user-read-private", "user-modify-playback-state"

 

Steps to reproduce:

 

curl --location --request PUT 'https://api.spotify.com/v1/me/player/play' \
--header 'Authorization: Bearer <<MY_TOKEN>> \
--header 'Content-Type: application/json' \
--data-raw '{
    "uris": [
        "spotify:track:3uww8tj9hlPUbUsJXcOJuc",
        "spotify:track:3uww8tj9hlPUbUsJXcOJuc",
        "spotify:track:3uww8tj9hlPUbUsJXcOJuc"
    ],
    "offset": {
        "position": 0
    }
}'

 

 

Expected behaviour:

204 No Content -> song is playing

 

 

Actual behaviour:

 

{
  "error" : {
    "status" : 403,
    "message" : "Player command failed: Restriction violated",
    "reason" : "UNKNOWN"
  }
}

 

It seems to be working only when the last index of a reoccuring item is provided by the offset parameter (in this case "offset" : { "position" : 2 }). The values 0 and 1 are not working. All values work fine if I use 3 different URIs.

 

I already filed an issue on Github but the repository seems to be archived.

>>> https://github.com/spotify/web-playback-sdk/issues/123

 

4 Replies
Highlighted

Re: Playing with an offset is not working when element in URI list appears multiple times

Casual Listener

I have the same exact issue. Have you found a fix? I have been at this bug for weeks and I just do not know what to do next.

 

I am trying to start playback with a context uri, not a list of track uris. I am not trying to offset playback, just start playing at the very beginning of the album.

Highlighted

Re: Playing with an offset is not working when element in URI list appears multiple times

Casual Listener

No, I did not find any solution on this yet. Please let me know if you've found a way.

Highlighted

Re: Playing with an offset is not working when element in URI list appears multiple times

Casual Listener

Hey, I don't know if you fixed this, but I have come up with a makeshift solution.

 

I have decided I will play an album from a number. Let's say this number is 4. I input 4 to the program and it opens a text file, 4.txt, and reads out something like this:

['spotify:track:7GhIk7Il098yCjg4BQjzvb', 'spotify:track:5qUAdDl59w0Vbu4Gi6ecSX', 'spotify:track:6ZiVaOE4ikIsYbuhVHizz9', 'spotify:track:5BDOCu3gk2HrHqEherdl27', 'spotify:track:65Q2A0pUf2lznsMaBvieqW']. Then I plug that list of songs (instead of the album id it is the song id for each song in the album) into the uris variable and play with an offset of 0. I'm hoping it works.

 

EDIT: I realize you are trying to play the same songs, not different ones. You could do something similar with a program that starts playback of the same song once it detects that the song is over. Thanks for your post it was a life saver for me 🙂

Highlighted

Re: Playing with an offset is not working when element in URI list appears multiple times

Casual Listener

Hey, thank you for your post. I did something similar for my current solution, but if I could play with the offset the "skip back" button would lead to the previous song in the URI list. So let's say I play the song with offset 4 then press the "skip back" button and then I wanted to let the song at offset 3 to be playing. Maybe the Spotify team is fixing this issue sometime.

 

 

SUGGESTED POSTS