gilbarbara / react-spotify-web-playback

A simple player for Spotify's web playback
https://react-spotify-web-playback.gilbarbara.dev/
MIT License
324 stars 69 forks source link

Playback is stopped when changing spotify uri (in dev mode) #149

Closed timrae closed 1 year ago

timrae commented 1 year ago

Describe the bug

Hi thanks for the really useful library. I'm experiencing the following issue.

Your minimal, reproducible example

https://github.com/gilbarbara/react-spotify-web-playback

Steps to reproduce

  1. Start demo app
    git clone https://github.com/gilbarbara/react-spotify-web-playback.git
    cd demo
    npm install
    npm run start
  2. Ignore the two errors that are shown there:
    ERROR
    [eslint] Failed to load config "@gilbarbara/eslint-config" to extend from.
    Referenced from: /home/tim/react/practice/react-spotify-web-playback/package.json
    ERROR in src/App.tsx:150:9
    TS2367: This comparison appears to be unintentional because the types 'ErrorType' and '"authentication_error"' have no overlap.
    148 |       if (
    149 |         state.status === STATUS.ERROR &&
    > 150 |         state.errorType === "authentication_error"
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    151 |       ) {
    152 |         localStorage.removeItem("rswp_token");
    153 |         setState({ token: "" });
  3. Paste spotify token
  4. Click "Play an Artist"
  5. Let song play for a few seconds
  6. Click "Play an Album"

The previous song pauses, and playback never resumes with the album

Expected behavior

Album starts playing

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Windows 11 Pro (version 22H2) Chrome 111.0.5563.111 also checked on Firefox 111.0

react-spotify-web-playback version

0.13.3

TypeScript version

No response

Build tool

npm

Additional context

I can't reproduce the problem on the production version that's deployed online:

https://react-spotify-web-playback.gilbarbara.dev/

only locally

Saif045 commented 1 year ago

i also have a problem changing music with 0.13.3 version it was working fine in older version, Playback is stopped when changing spotify uri , the package gets new uri according to the state but the playback is not always updating to the latest uri provided sometimes it does sometimes it does not
update : i returned to v "0.12.1" and everything works fine i can change tracks normally

jeadys commented 1 year ago

Facing the same issue in versions

This happens to me when navigating to a different page and selecting a new track on that page. It stops the playback. Version 0.12.1 seems indeed fine @Saif045 .

gilbarbara commented 1 year ago

Please try v0.13.4 and let me know if it solves the problem for you

jeadys commented 1 year ago

Please try v0.13.4 and let me know if it solves the problem for you

It's working for me, thanks for the quick fix.

Saif045 commented 1 year ago

yes problem solved thanks for your time and great work @gilbarbara