Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onSpotifyWebPlaybackSDKReady is not defined #94

Open
cpurev opened this issue Nov 21, 2023 · 2 comments
Open

onSpotifyWebPlaybackSDKReady is not defined #94

cpurev opened this issue Nov 21, 2023 · 2 comments

Comments

@cpurev
Copy link

cpurev commented Nov 21, 2023

In official Spotify API documents there is Web Playback sdk that uses window.onSpotifyWebPlaybackSDKReady.

I tried mimicking the example but cannot quite get it working in my Next/React application. I'm wondering how would I be able to set my application as a media player? It seems that my application does not have device_id thus I cannot use all the Player endpoints.

I'm new to this.
Thank you so much!

@fostertheweb
Copy link
Contributor

fostertheweb commented Dec 11, 2023

You can install @types/spotify-web-playback-sdk and it will be much more pleasant to work with the playback SDK. You would need to listen for the ready event on your player instance:

player.addListener('ready', ({ device_id }) => {
  console.log('Ready with Device ID', device_id);
});

This is a snippet from the documentation here.

@inanc-can
Copy link

@fostertheweb Does your respond supposed to answer my question at #124 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants