spotify / web-api

This issue tracker is no longer used. Join us in the Spotify for Developers forum for support with the Spotify Web API ➡️ https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer
981 stars 79 forks source link

/v1/me/player/play - First track is played twice #661

Open Kaiser1989 opened 7 years ago

Kaiser1989 commented 7 years ago

Issue found on February 19th 2015.

Endpoint(s):

Scope(s):

Steps to reproduce:

  1. Set two songs to playlist with: /v1/users/{user_id}/playlists/{playlist_id}/tracks
  2. play playlist with endpoint from above /v1/me/player/play

Expected behaviour:

First Track is played, when first track ends, the second track in the playlist should run.

Actual behaviour:

First Track is played as expected. But when first track ends, first track is played again. After the second run of the first track the second track is played. (Repeat option is set to off/context, but not track).

This only happens when playlist is started with endpoint. Manually double-clicking on the playlist in the spotify windows client works as expected.

This happens on my windows client and also on my android smartphone

markstuartwalker commented 7 years ago

I cannot get this to work successfully at all, perhaps you can help by detailing the json part of the message that you are sending? I am currently sending:

"{offset:\"{uri: \"spotify:track:4WrwO9Un3ji5wnNySDGHwQ\"}\",uris:[\"spotify:track:4WrwO9Un3ji5wnNySDGHwQ\",\"spotify:track:6KWr4NGmLfxKZgUQEXToIQ\",\"spotify:track:2fF7mQOxo1SZuIMHTQgQD8\",\"spotify:track:1R2SZUOGJqqBiLuvwKOT2Y\"]}"

Kaiser1989 commented 7 years ago

First i set two songs to a playlist: path: "/v1/users/112xxxx088/playlists/6bouL4o1eL00ZMcWQRdObB/tracks" jsonBody: "{\"uris\":[\"spotify:track:4XJlxK37u9x4m1MU1MPkop\",\"spotify:track:7kY3UKc3QMAgu2VriSWDpR\"]}"

Then i start playing that playlist: path: "/v1/me/player/play" jsonBody: "{\"context_uri\":\"spotify:user:112xxxx088:playlist:6bouL4o1eL00ZMcWQRdObB\"}"

I've hidden my spotify id, but i think that doesn't matter

markstuartwalker commented 7 years ago

I do the same but I do it in a single transaction. It does work.

On 19 Sep 2017, at 23:27, Kaiser1989 notifications@github.com<mailto:notifications@github.com> wrote:

First i set two songs to a playlist: path: "/v1/users/112xxxx088/playlists/6bouL4o1eL00ZMcWQRdObB/tracks" jsonBody: "{"uris":["spotify:track:4XJlxK37u9x4m1MU1MPkop","spotify:track:7kY3UKc3QMAgu2VriSWDpR"]}"

Then i start playing that playlist: path: "/v1/me/player/play" jsonBody: "{"context_uri":"spotify:user:112xxxx088:playlist:6bouL4o1eL00ZMcWQRdObB"}"

I've hidden my spotify id, but i think that doesn't matter

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/spotify/web-api/issues/661#issuecomment-330691718, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYiBk74ma28Y7tDhUREaMorZoCUSo8hLks5skD_DgaJpZM4PZmfz.

markstuartwalker commented 7 years ago

The second parameter should just be uri.

On 19 Sep 2017, at 23:27, Kaiser1989 notifications@github.com<mailto:notifications@github.com> wrote:

First i set two songs to a playlist: path: "/v1/users/112xxxx088/playlists/6bouL4o1eL00ZMcWQRdObB/tracks" jsonBody: "{"uris":["spotify:track:4XJlxK37u9x4m1MU1MPkop","spotify:track:7kY3UKc3QMAgu2VriSWDpR"]}"

Then i start playing that playlist: path: "/v1/me/player/play" jsonBody: "{"context_uri":"spotify:user:112xxxx088:playlist:6bouL4o1eL00ZMcWQRdObB"}"

I've hidden my spotify id, but i think that doesn't matter

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/spotify/web-api/issues/661#issuecomment-330691718, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYiBk74ma28Y7tDhUREaMorZoCUSo8hLks5skD_DgaJpZM4PZmfz.

markstuartwalker commented 7 years ago

My apologies, I still wasn’t reading this properly.

I use this API in 2 ways

  1. playing a playlist. This uses context_uri parameter. It starts to play from the first track
  2. playing a collection of tracks. This uses the uris and uri parameters. It starts to play from the named uri tracks

The only problem that I had was that the IPA seems to be very fussy about having quotes around the parameter name e.g. "context_uri"

Mark Stuart-Walker markstuartwalker@hotmail.commailto:markstuartwalker@hotmail.com

On 19 Sep 2017, at 23:27, Kaiser1989 notifications@github.com<mailto:notifications@github.com> wrote:

First i set two songs to a playlist: path: "/v1/users/112xxxx088/playlists/6bouL4o1eL00ZMcWQRdObB/tracks" jsonBody: "{"uris":["spotify:track:4XJlxK37u9x4m1MU1MPkop","spotify:track:7kY3UKc3QMAgu2VriSWDpR"]}"

Then i start playing that playlist: path: "/v1/me/player/play" jsonBody: "{"context_uri":"spotify:user:112xxxx088:playlist:6bouL4o1eL00ZMcWQRdObB"}"

I've hidden my spotify id, but i think that doesn't matter

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/spotify/web-api/issues/661#issuecomment-330691718, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYiBk74ma28Y7tDhUREaMorZoCUSo8hLks5skD_DgaJpZM4PZmfz.

Kaiser1989 commented 7 years ago

I also do it in the same transaction.

The Qotes should't be the problem. Everything works fine, adding, starting playist. Except that the first song is played twice. I also tried a SkipToNext query (This also works fine).

But for me, the first song in the playlist is always played twice. When i skipToNext after the queries from above, the first song starts again. The second skipToNext work. This is the same, as when i use the buttons in the spotify client.

For now, i need to add that skipToNext hardcoded to startPlaylist as poststatement, so that one of the first track doubles is skipped. With that it works as expected.

I'm wondering, why no other has that issue.

markstuartwalker commented 7 years ago

I don’t know. My debug trace shows:

PUT https://api.spotify.com/v1/me/player/play Body {"offset":{"uri":"spotify:track:1aBO5KPwxqLESNTTJBR6VP"},"uris":["spotify:track:1aBO5KPwxqLESNTTJBR6VP","spotify:track:5Feu0AyHLrW0mCRAyUnZ6W”]}

The play queue gets 2 items and the first plays just once.

Mark Stuart-Walker markstuartwalker@hotmail.commailto:markstuartwalker@hotmail.com

On 20 Sep 2017, at 12:45, Kaiser1989 notifications@github.com<mailto:notifications@github.com> wrote:

I also do it in the same transaction.

The Qotes should't be the problem. Everything works fine, adding, starting playist. Except that the first song is played twice. I also tried a SkipToNext query (This also works fine).

But for me, the first song in the playlist is always played twice. When i skipToNext after the queries from above, the first song starts again. The second skipToNext work. This is the same, as when i use the buttons in the spotify client.

For now, i need to add that skipToNext hardcoded to startPlaylist as poststatement, so that the first track double of the first track playing is skipped. With that it works as expected.

I'm wondering, why no other has that issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/spotify/web-api/issues/661#issuecomment-330827029, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYiBk6x9JtF9NB17VMII1T9PQ9Ts8rinks5skPrxgaJpZM4PZmfz.

Kaiser1989 commented 7 years ago

Ok i tried it with the api console:

When i use v1/me/player/play with "uris" parameter, it's working fine. But then you have no context to add new songs to this playlist later. If you only use "context_uri" to play a playlist, all my first tracks are played twice. Can someone reproduce this?

jstlnd commented 7 years ago

@Kaiser1989 It definitely looks like something is not right here. We'll look into it. Thanks for reporting.

jstlnd commented 7 years ago

This should now be fixed and deployed. Thanks for your report!

Kaiser1989 commented 7 years ago

Thank you so much for your efforts.

But the Problem still exists. First track is played twice, when using context_uri for playing a playlist!

jstlnd commented 7 years ago

@Kaiser1989 You are right. Well, it was fixed for some time and then we had to roll back because of an unrelated issue. I hope we can get this fix out soon again. I'll let you know. Sorry for the back and forth. :-)

halvorson commented 7 years ago

Yeah, just updated my mac's Spotify, and problem started (it was happening on my iOS and Windows machines).

More info: it also occurs when hitting the first track of a playlist using {"offset": {"position": 0}},

jbuerklin commented 6 years ago

Also, when using context_uri and an offset > 0, the corresponding track will be played, but then the playlist will just start from the beginning instead of continuing with offset+1.

This also happens with {"offset": {"uri": }}

tpict commented 6 years ago

could this be related to https://github.com/spotify/web-api/issues/630?

sevi-l commented 6 years ago

same problem still happening for me. Looking at the play queue in the desktop app, i see the song under 'now playing' as well as 'next up'. it seems to load it twice for some reason.