Announcements

Help Wizard

Step 1

NEXT STEP

Is there a distinction between normal tracks and tracks within a playlist?

Solved!

Is there a distinction between normal tracks and tracks within a playlist?

Plan

Premium

 

Device

Web SDK/WEB API

Operating System

(iOS 10, Android Oreo, Windows 10,etc.)

 

My Question or Issue

Im having this issue where i get a playlist, then the tracks from that playlist.

I play a song using https://api.spotify.com/v1/me/player/play

the song plays as spected, as soon as the song ends the music stops.

Checking the Spotify desktop app i see that the queue has only the song i selected.

 

The behabior that im wanting is that if i select a song to play from within a playlist the queue should update starting from the selected song and naturally progress tru the rest of the playlist.

 

Reply

Accepted Solutions
Marked as solution

this is the correct way thanx anyway
$.ajax({
url: "https://api.spotify.com/v1/me/player/play",
type: "PUT",
data: '{"context_uri":"' + contextoPlaylist + '","offset":{"uri": "' + id + '"}}',
beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + token); },
success: function (data) {
console.log(data)
}
});

View solution in original post

3 Replies

Hmm reviewing my code i wonder if uris means that i have to manually give all the playlist tracks??? im currently only sending one at the time. if that's the case is there a more efective way to signal this to the api???
$.ajax({
url: "https://api.spotify.com/v1/me/player/play",
type: "PUT",
data: '{"uris": ["' + id + '"]}',
beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + token); },
success: function (data) {
console.log(data)
}
});

OHHHHHH so there is a context parameter duh! my bad for not reading
Marked as solution

this is the correct way thanx anyway
$.ajax({
url: "https://api.spotify.com/v1/me/player/play",
type: "PUT",
data: '{"context_uri":"' + contextoPlaylist + '","offset":{"uri": "' + id + '"}}',
beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + token); },
success: function (data) {
console.log(data)
}
});

Suggested posts