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

How to clear queue?

Open redphx opened this issue 7 years ago • 13 comments

I'm finding a way to clear all songs from queue but couldn't find it. Can we have this feature in the future? Thank you.

redphx avatar Sep 28 '18 03:09 redphx

Please this is annoying

alete89 avatar Dec 11 '18 03:12 alete89

Thanks for the suggestion! We'll post here if there are any updates.

arirawr avatar Jan 16 '19 11:01 arirawr

Any progress here? It's super difficult to develop anything involving queuing without this.

heyjamesknight avatar Feb 26 '20 15:02 heyjamesknight

Same, developing with queue is impossible without this feature. Are there any plans to make this happen soon?

jarjarfinks avatar Apr 09 '20 04:04 jarjarfinks

Hi there! :) Any progress on this?

marzuagacds avatar May 04 '20 15:05 marzuagacds

Not the best way, but what I do is send a specific track (can be a sound effect) to the queue and keep advancing (and removing items) as fast as possible to the "next" track until I find the "id" (the end of the playing queue). Here is the Js code of my recursive function. It can give you a rough idea of a possible solution:

static clearSpotifyQueue(init) { //Recursive
      let i=init;
      let id="0ICWP0NnWaJUCgp6EvgNmT"; //Mission Imposible, my 'tag' track. This can also be changed so that you can send an specific id to the function.
      let tId="";
      if(i>=25){setLoops(); return;} //Max number of tracks in the queue that will be removed
      if(i===0){  //the first time send the track to the queue
         clearInterval(theLoop);  //specific to my application. Stops updating the UI
         $.ajax({
            url: 'https://api.spotify.com/v1/me/player/queue?uri=spotify:track:'+id , method:'POST', 
            headers: Player.getHeaders()  //replace by corresponding headers
         }).done(setTimeout(function(){Queue.clearSpotifyQueue(i+1);},1000)); //adds some delay before calling the function again, otherwise it won't work
      } else {  
         $.ajax({ 
            url: 'https://api.spotify.com/v1/me/player', method: 'GET', headers: Player.getHeaders()
         }).done(function (data) {
            tId = data.item.id;
            if(tId===id) {
               Player.next(0);  //implements a simple player/next or eliminate if you want to play the 'tag' track 
               setLoops(); //specific to my application...change it.
            } else {
               $.ajax({
                  url: 'https://api.spotify.com/v1/me/player/next', method:'POST', headers: Player.getHeaders()  
               }).done(setTimeout(function(){Queue.clearSpotifyQueue(i+1);},2000));
            }
         });
      }

nelson-t avatar May 24 '20 15:05 nelson-t

Yes i gonna do the same, enqueue a specify song (hope user does not enqueue that song before). I think the api (web and sdk) are very limited.

egomezsumma avatar Sep 16 '20 14:09 egomezsumma

Dudes?

mixeden avatar Jan 11 '22 14:01 mixeden

The current state of the API gives very limited control of the playback.

I want to hold and control a playlist in my application and keep the playback in sync. I tried 2 different methods to achieve this:

  • Working with the queue gives no control over reordering tracks, clearing the queue.
  • Working with a custom playlist gave me the most control, except this gave me problems later on. The client automatically synchronises with changes being made by the API. Until x changes have been made, then the client gets 'throttle limited' and won't update anymore until you manually refresh the playlist (by switching to another playlist and back). That makes the playback uncontrollable.

I would love to hear suggestions/work arounds :)

PolygonFox avatar May 28 '22 13:05 PolygonFox

5 years later... please add support for this or at least explain why you won't

alexlwn123 avatar Sep 04 '23 20:09 alexlwn123

Spotify please we're starving over here

StuxVT avatar Sep 11 '23 04:09 StuxVT

So simple of implement, but they dont care about us :P

egomezsumma avatar Sep 11 '23 17:09 egomezsumma