GithubHelp home page GithubHelp logo

spotify / spotify-web-playback-sdk-example Goto Github PK

View Code? Open in Web Editor NEW
139.0 15.0 184.0 26 KB

React based example app that creates a new player in Spotify Connect to play music from in the browse using Spotify Web Playback SDK.

License: Apache License 2.0

HTML 16.35% JavaScript 64.04% CSS 19.61%
spotify spotify-sdk spotify-web-playback-sdk

spotify-web-playback-sdk-example's Issues

Extremely deprecated Node version

When installing via NPM, in order to successfully run this package, I have to create a .nvmrc file and specify Node v16, otherwise I receive the following back-end error: "error:0308010C:digital envelope routines::unsupported". This appears to be due to upgrades since the publication of this package that filled a security hole created by digital envelope routines, though it is unclear if this is due to the package itself or one of its dependencies.

Front-End and Back-End Proxying is Insufficient to Remove CORS Errors

When attempting to launch this package, each attempt to fetch any existing user tokens and/or login failed with Error 403: Forbidden. I was only able to resolve these issues by installing and using cors middleware, then changing all relevant links to the actual back-end route instead of the port 3000 proxy that this app uses by default. This also required re-configuring the Spotify application dashboard to set the callback URI to the un-proxied address.

Spotify web playback sdk doesn't work with React 18

Well i was trying to implement spotify web sdk on react 18 ( with next 13 and others recent package). i spent an afternoon trying to debug error like

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://sdk.scdn.co') does not match the recipient window's origin ...

and this one https://stackoverflow.com/questions/76097035/spotify-sdk-throwing-this-streamer-is-null-error-when-trying-to-play-or-skip/76283570#76283570

in the end i found that the sdk doesn't work with React 18

INVALID_CLIENT: Invalid redirect URI

I haven't changed any files, I simply added the .env file with the credentials as per the readme. After authentication, the following text is displayed on screen:

INVALID_CLIENT: Invalid redirect URI

Spotify websdk not working on Safari for MacOS and iOS

Steps:

  • Run the repo as described in the README.
  • Everything runs as expected on Chrome.
  • On Desktop Safari -> playback does not start or work till you hit the next button. Play/pause functionality is broken. Once you pause a song it cannot be played again.
  • On Mobile Safari -> everything is broken.

Running on :
MacOS: macOS Ventura 13.3.1
Chrome: Version 112.0.5615.137 (Official Build) (arm64)
Safari: Version 16.4 (18615.1.26.110.1)

Please clarify life-cycle considerations of the Player object

Hi,

First of all, thanks for making the SDK available and the great documentation and this example!! I was able the get everything working rather quickly. However, a few questions arise which I cannot find answers to anywhere:

When my Single Page Application is open for a longer time, the player connection (usually when idle, i.e. not streaming, but also sometimes when streaming) will become broken eventually. That means, even though I don't receive any "not ready" event from the player, I cannot start streaming again. Some of the symptoms will be (a random combination of them):

  • I will see "502 Bad Gateway" errors for the web socket in the log which seem to come from the Web Playback SDK Javascript.
  • Trying to start playback may produce a "404" which refers to the Device ID that the Player instance was assigned, as the device will no longer be in the device list on the server side.
  • Trying to call disconnect() on the Player instance will just hang.
  • Simply calling connect() again may be "successful", but the connection is actually still broken.

Please note that I periodically refresh the access token, and that I give the Player instance a callback implementation that will always use the current access token.

I am perfectly fine with the Player instance becoming stale after a while. What I need is a way to 1) become aware of it reliably (like by receiving the "not ready" event, and 2) being able to recover from that without reloading the page.

I also observed that multiple instances of my application may be registered at the Spotify servers concurrently. For example, when I reload the page, I get a new device ID, and the previous instance may still exist in the Spotify devices list.

Thanks a lot for any clarification!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.