JMPerez / spotify-web-api-js

A client-side JS wrapper for the Spotify Web API
https://jmperezperez.com/spotify-web-api-js/
MIT License
1.86k stars 260 forks source link

Spotify player object giving me a non existent player id #196

Closed shaunwhyte closed 3 years ago

shaunwhyte commented 3 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce

spotify-web-api-js this.player = new (window as any).Spotify.Player({ name: 'SpotiPod', getOAuthToken: cb => { cb(this.spotifyAuth.getToken()); } , volume: 1 });

Once this connects and i get the player id using this

player._options.id

I get a different Id to if i call the end point https://api.spotify.com/v1/me/player/device Id from player._options.id doesnt work eg when i play a song it says device cannot be found

Expected behavior The real player id, the same as which is returned when i call the get devices call under my account (https://api.spotify.com/v1/me/player/devices)

Windows, Chrome Version 89.0.4389.90 (Official Build) (64-bit)

JMPerez commented 3 years ago

@shaunwhyte the Spotify.Player object is not part of this library. The library only fetches information through the API and the is returned by the Player is out of scope.

You might want to fetch the list of devices through the API to control the playback using the device id.

shaunwhyte commented 3 years ago

i thought about fetching the device id but i use Spotify.Player.seek as well...

shaunwhyte commented 3 years ago

this one was on me, i had an old spotify js sdk