Announcements

Help Wizard

Step 1

NEXT STEP

Adding a Playlist to Queue Using Spotify API

Adding a Playlist to Queue Using Spotify API

Using ''add_to_queue(uri, device_id=None)'' only lets the user add Tracks or Episodes to the playback queue. I was wondering if there is a secret way to add an entire playlist to the queue? Looking at the Add Item to Playback Queue (https://developer.spotify.com/documentation/web-api/reference/#/operations/add-to-queue) it also only says, 'Tracks or Episodes'.

 

Even if it currently is not possible, why isn't it? You can easily go to any Playlist, click on the three dots (e.g., More Options) and add a Playlist to the queue. So, what is restricting the API from being able to do this?

 

Reply
6 Replies

Hi @ogernugget, welcome to the forum. It's not possible right now to add an entire playlist to the queue in a single API call. Apps can look up a playlist's tracks and then add each track to the queue one by one. 

Thank you for the info! Is there a way to Clear the Queue, using the API? (besides skipping though every single track in the Queue)

 

Also, is there a way to add a song, linked to a specific playlist, to the queue? So if you start playing that song, and then start playing the playlist, it will just continue playing the playlist from whatever point in the song you requested is.

(e.g., with a URL or URI such as these: 

URL: https://open.spotify.com/track/1uN7FXCu0SDfV2Lb3SlahC?context=spotify%3Aplaylist%3A7DP7AU926fGTJ00Php2NON
URI: spotify:track:1uN7FXCu0SDfV2Lb3SlahC?context=spotify%3Aplaylist%3A7DP7AU926fGTJ00Php2NON

where the General format would be:

URL: https://open.spotify.com/track/TRACK_ID?context=spotify%3Aplaylist%3APLAYLIST_ID
URI: spotify:track:TRACK_ID?context=spotify%3Aplaylist%3APLAYLIST_ID

 (using the API of course)

I think you are looking for this (if the users are Premium): Start/Resume Playback (console)

If the device_id is not supplied, the user's currently active device is the target. To get the device_id, you can use Get Available Devices (console) for all available devices or Get Playback State (console) for the current device.

Cheers,

In addition to my previous answer: I see you are using SpotiPy.

You can use the command start_playback(device_id=None, context_uri=None, uris=None, offset=None, position_ms=None)

Also, you can use devices() or current_playback(market=None, additional_types=None) to get the device_id you want.

Cheers,

I’m aware if all of that, but I’m looking to make transitions between songs seamless. Adding a song to the queue allows cross-fade to occur, which is what I’m looking to do, but I’m wishing to play a playlist after a song without the song either abruptly ending to start the next song or having to wait for the current playing song to come to an end, and then starting to play the playlist.

 

I have scoured the API board, so I’m just wondering if there is some secret technique to achieve what I am looking to do.

 

Edit: To be clear, i am trying to add a song from a specific playlist to the queue, and as it is playing I will start playing the playlist it is in [WITHOUT stopping or resetting the current playing track], so once the song ends, it will cross-fade into the next in the playlist.

@spotifyjosh , I have one more question. Using the API, I know you can add songs to the Queue, but when you go into Spotify and look at your Queue it is blank, and the songs in the Queue are either hidden or stored somewhere else. Is there a way to view songs added to the Queue through the API?

Suggested posts