spotify-web-api-node icon indicating copy to clipboard operation
spotify-web-api-node copied to clipboard

Is it possible to make spotify player play some track by track uri/url ?

Open mihailk111 opened this issue 4 years ago • 2 comments

mihailk111 avatar Feb 27 '21 11:02 mihailk111

Yeah, This is what I did to get this to work. spotifyAPI is the auth'd client.

spotifyApi.addToQueue('spotify:track:4cOdK2wGLETKBW3PvgPWqT') //track URI = spotify:track: ID .then(function(data) { spotifyApi.skipToNext() .then(data => { console.log(data);}) .catch(err => {console.log(err);}); })

Noelg14 avatar Jul 14 '21 07:07 Noelg14

I tried this, and was not disappointed. Well done @Noelg14 🤣

Formatted a bit more cleanly:

spotifyApi
  .addToQueue('spotify:track:4cOdK2wGLETKBW3PvgPWqT')
  .then(function () {
    spotifyApi
      .skipToNext()
      .then((data) => {
        console.log(data);
      })
      .catch((err) => {
        console.log(err);
      });
  });

phoebejaffe avatar Feb 02 '22 17:02 phoebejaffe