GithubHelp home page GithubHelp logo

gilbarbara / react-spotify-web-playback Goto Github PK

View Code? Open in Web Editor NEW
310.0 8.0 65.0 2.01 MB

A simple player for Spotify's web playback

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

License: MIT License

TypeScript 100.00%

react-spotify-web-playback's Introduction

react-spotify-web-playback

npm version CI Quality Gate Status Coverage

A Spotify player with Spotify's Web Playback SDK.

View the demo

Check the supported browser list. This library will try to use the user's devices to work with unsupported browsers.

Setup

npm i react-spotify-web-playback

Getting Started

import SpotifyPlayer from 'react-spotify-web-playback';

<SpotifyPlayer
  token="BQAI_7RWPJuqdZxS-I8XzhkUi9RKr8Q8UUNaJAHwWlpIq6..."
  uris={['spotify:artist:6HQYnRM4OzToCYPpVBInuU']}
/>;

Client-side only

This library requires the window object.
If you are using an SSR framework, you'll need to use a dynamic import or a Client Component to load the player.

Spotify Token

It needs a Spotify token with the following scopes:

  • streaming
  • user-read-email
  • user-read-private
  • user-read-playback-state (to read other devices' status)
  • user-modify-playback-state (to update other devices)

If you want to show the Favorite button (💚), you'll need the additional scopes:

  • user-library-read
  • user-library-modify

Please refer to Spotify's Web API docs for more information.

This library doesn't handle token generation and expiration. You'll need to handle that by yourself.

Props

callback (state: CallbackState) => void
Get status updates from the player.

Type Definition
type ErrorType = 'account' | 'authentication' | 'initialization' | 'playback' | 'player';
type RepeatState = 'off' | 'context' | 'track';
type Status = 'ERROR' | 'IDLE' | 'INITIALIZING' | 'READY' | 'RUNNING' | 'UNSUPPORTED';
type Type =
  | 'device_update'
  | 'favorite_update'
  | 'player_update'
  | 'progress_update'
  | 'status_update'
  | 'track_update';

interface CallbackState extends State {
  type: Type;
}

interface State {
  currentDeviceId: string;
  deviceId: string;
  devices: SpotifyDevice[];
  error: string;
  errorType: ErrorType | null;
  isActive: boolean;
  isInitializing: boolean;
  isMagnified: boolean;
  isPlaying: boolean;
  isSaved: boolean;
  isUnsupported: boolean;
  needsUpdate: boolean;
  nextTracks: SpotifyTrack[];
  playerPosition: 'bottom' | 'top';
  position: number;
  previousTracks: SpotifyTrack[];
  progressMs: number;
  repeat: RepeatState;
  shuffle: boolean;
  status: Status;
  track: SpotifyTrack;
  volume: number;
}

components CustomComponents
Custom components for the player.

Type Definition
interface CustomComponents {
  /**
   * A React component to be displayed before the previous button.
   */
  leftButton?: ReactNode;
  /**
   * A React component to be displayed after the next button.
   */
  rightButton?: ReactNode;
}

getOAuthToken (callback: (token: string) => void) => Promise<void>
The callback Spotify SDK uses to get/update the token.
Use it to generate a new token when the player needs it.

Example
import { useState } from 'react';
import SpotifyPlayer, { Props } from 'react-spotify-web-playback';

import { refreshTokenRequest } from '../some_module';

export default function PlayerWrapper() {
  const [accessToken, setAccessToken] = useState('');
  const [refreshToken, setRefreshToken] = useState('');
  const [expiresAt, setExpiresAt] = useState(0);

  const getOAuthToken: Props['getOAuthToken'] = async callback => {
    if (expiresAt > Date.now()) {
      callback(accessToken);

      return;
    }

    const { acess_token, expires_in, refresh_token } = await refreshTokenRequest(refreshToken);

    setAccessToken(acess_token);
    setRefreshToken(refresh_token);
    setExpiresAt(Date.now() + expires_in * 1000);

    callback(acess_token);
  };

  return <SpotifyPlayer getOAuthToken={getOAuthToken} token={accessToken} uris={[]} />;
}

getPlayer (player: SpotifyPlayer) => void
Get the Spotify Web Playback SDK instance.

hideAttribution boolean ▶︎ false
Hide the Spotify logo.

hideCoverArt boolean ▶︎ false
Hide the cover art

initialVolume number between 0 and 1. ▶︎ 1
The initial volume for the player. It's not used for external devices.

inlineVolume boolean ▶︎ true
Show the volume inline for the "responsive" layout for 768px and above.

layout 'compact' | 'responsive' ▶︎ 'responsive'
The layout of the player.

locale Locale
The strings used for aria-label/title attributes.

Type Definition
interface Locale {
  currentDevice?: string; // 'Current device'
  devices?: string; // 'Devices'
  next?: string; // 'Next'
  otherDevices?: string; // 'Select other device'
  pause?: string; // 'Pause'
  play?: string; // 'Play'
  previous?: string; // 'Previous'
  removeTrack?: string; // 'Remove from your favorites'
  saveTrack?: string; // 'Save to your favorites'
  title?: string; // '{name} on SPOTIFY'
  volume?: string; // 'Volume'
}

magnifySliderOnHover: boolean ▶︎ false
Magnify the player's slider on hover.

name string ▶︎ 'Spotify Web Player'
The name of the player.

offset number
The position of the list/tracks you want to start the player.

persistDeviceSelection boolean ▶︎ false
Save the device selection.

play boolean
Control the player's status.

showSaveIcon boolean ▶︎ false
Display a Favorite button. It needs additional scopes in your token.

styles object
Customize the player's appearance. Check StylesOptions in the types.

syncExternalDevice boolean ▶︎ false
If there are no URIs and an external device is playing, use the external player context.

syncExternalDeviceInterval number ▶︎ 5
The time in seconds that the player will sync with external devices.

token string REQUIRED
A Spotify token. More info is below.

updateSavedStatus (fn: (status: boolean) => any) => any
Provide you with a function to sync the track saved status in the player.
This works in addition to the showSaveIcon prop, and it is only needed if you keep track's saved status in your app.

uris string | string[] REQUIRED
A list of Spotify URIs.

Spotify API

The functions that interact with the Spotify API are exported for your convenience.
Use them at your own risk.

import { spotifyApi } from 'react-spotify-web-playback';

checkTracksStatus(token: string, tracks: string | string[]): Promise<boolean[]>

getDevices(token: string): Promise<SpotifyApi.UserDevicesResponse>

getPlaybackState(token: string): Promise<SpotifyApi.CurrentlyPlayingObject | null>

getQueue(token: string): Promise<SpotifyApi.UsersQueueResponse>

pause(token: string, deviceId?: string): Promise<void>

play(token: string, options: SpotifyPlayOptions): Promise<void>

interface SpotifyPlayOptions {
  context_uri?: string;
  deviceId: string;
  offset?: number;
  uris?: string[];
}

previous(token: string, deviceId?: string): Promise<void>

next(token: string, deviceId?: string): Promise<void>

removeTracks(token: string, tracks: string | string[]): Promise<void>

repeat(token: string, state: 'context' | 'track' | 'off', deviceId?: string): Promise<void>

saveTracks(token: string, tracks: string | string[]): Promise<void>

seek(token: string, position: number, deviceId?: string): Promise<void>

setDevice(token: string, deviceId: string, shouldPlay?: boolean): Promise<void>

setVolume(token: string, volume: number, deviceId?: string): Promise<void>

shuffle(token: string, state: boolean, deviceId?: string): Promise<void>

Styling

You can customize the UI with a styles prop.
If you want a transparent player, you can use bgColor: 'transparent'.
Check all the available options here.

<SpotifyWebPlayer
  // ...
  styles={{
    activeColor: '#fff',
    bgColor: '#333',
    color: '#fff',
    loaderColor: '#fff',
    sliderColor: '#1cb954',
    trackArtistColor: '#ccc',
    trackNameColor: '#fff',
  }}
/>

rswp-styles

Issues

If you find a bug, please file an issue on our issue tracker on GitHub.

License

MIT

react-spotify-web-playback's People

Contributors

gilbarbara avatar graysoncadams avatar zzikkzzakk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-spotify-web-playback's Issues

Initial autoplay does not work

Hi,

The first time a song is loaded into the player's uris prop, the player does not automatically play despite giving it the prop autoplay={true}. The web player will only play if you click the play button located on the web player.

In addition, when only one track uri specifically is on the first load of a uri into the player, playback does not work at all.

Are there any suggestions for these issues?

Thanks,
Michelle

NPE in demo

I was testing out the demo and I get a `Cannot read property 'length' of undefined' in Devices.js after inputting my access token.

image

Also running into this issue when using the React component.

Thanks!

Set volume to 0 return error

Cant set volume to 0. Get this error in console

index.js:79 Uncaught (in promise) TypeError: Failed to set the 'volume' property on 'HTMLMediaElement': The provided double value is non-finite.
    at t.setVolume (index.js:79)
    at index.js:139

Not working on mobile

Works fine in desktop/laptop browser, but on safari and google chrome on mobile it says error: No Player.

403 err when changing list of uris of length > 1 while player is playing

If you change the list of uris to a list of size greater than 1 while the player is playing, you'll get a 403 error indicating that the device is unavailable.

PUT https://api.spotify.com/v1/me/player/play?device_id=XXXXXXXXXXXX 403

Some more info here:
https://developer.spotify.com/documentation/web-api/guides/using-connect-web-api/#:~:text=If%20you%20receive%20the%20403,%2Fme%2Fplayer%2Fdevices%20.

Note: To determine if you should send controlling commands to a certain device, check the is_restricted flag on a device object. If you receive the 403 FORBIDDEN code back, this means that the currently active device (or targeted device) is not controllable through the Web API.

I think what is happening is spotify thinks two players are trying to play on same device because the re-render is too fast.

Issue playing songs

I have an issue playing a song from the uris prop, when I connect to a device to play from, it just starts playing whatever I was previously listening to and does not start playing whatever was passed into the component. I also get an error in the Spotify app saying 'Can't play the current song'. I've been debugging for a couple of days now and I can't tell if this is a bug from here or in my code...
My code looks like this:

<SpotifyPlayer
    token={user.accessToken}
    uris={['spotify:track:5BvGdjGZKbsrtfA05Yg23W']}
    name='TestingPlayer'
    showSaveIcon={true}
    magnifySliderOnHover={true}
    styles={{
        activeColor: '#4b5dfc',
        sliderColor: '#4b5dfc',
        sliderHandleColor: '#4b5dfc',
    }}
/>

Component does not accept track uri's

I've been trying to pass in a specific track's uri ("spotify:track:1gahyBwl7jWJ91m052fgxU" for example) and I keep getting a "400 Non supported context uri" error. In the headers, I can see that the component is passing in the uri as the "context_uri" key rather than "uri", which does not support playing specific tracks. Is there any way around this?

props / state help

Could you give an example code snippet of how to access the props and state, I cant seem to affect anything and I'm pretty sure it's just a syntax thing.

Bump to React 17

Thanks for the fantastic package!

It would be great to upgrade dependencies and peer dependencies to the latest 17.0.1 React and react-dom.

need some additional clarity when no uris are provided.

On initial load the callback function fires twice with 2 status_updates. once with INITIALIZING , and then READY however this READY will fire regardless of if there are default URIs provided. and with the same data shape as when then a URI is provided.

This means that the a user can click on the play button and they will be greeted with this text in the player Cannot perform operation; no list was loaded. But that doesn't actually fire an event, so I have no way to know that the user needs assistance. to guide them on how to connect.

One thing I was thinking I could do is track the URIs internally, and use CSS to disable the play buttons, and give the user some instruction for how to connect to the Spotify player, but there is no callback for that, so I would never know that they completed it. I thought perhaps if I used syncExternalDevice I would get some additional callbacks but that didn't work.

So I am hoping that there is away to add that and/or have the READY status let me know that I don't have any URIs

please let me know if there is some other way to accomplish what I have set forth.

thanks

Access token not working in demo

I am not a Spotify premium user . Does this mean i cannot use this API ? as token generated from my account failed authentication in your demo

Songs not loaded when player is paused

Hello! This is an amazing library and I really appreciate all of the work you have put into this! The only question I have/issue I see is about the player behavior when it is paused.

URI changes are handled wonderfully while the player is currently playing, however it seems that when the player is paused and new URIs are passed down, the player is unresponsive. It would be great if the player began autoplaying the newly passed URIs when it is updated or if the URIs were queued and accessible when the next track is activated.

Steps to reproduce in the published demo:

  1. When the autoplay starts for the album, pause the player.
  2. Click play an artist - the player remains unaffected, but new URIs are passed down
  3. Resume play. Skip to the next track. The album is still playing.
  4. Click play an artist again - the player still remains unaffected because the URIs have not changed - they were changed in step 2.
  5. Click the next track button in the player - the original album is still playing
  6. The only way to switch to playing the artist is to click on one of the other 3 options (album, playlist, or tracks) and then click back onto the artist. The URIs that were passed in step 2 are never played/accessible.

Is there currently any support for this functionality that I am missing? If I understand it correctly, it seems that the only way to change the track is to make sure that the player is currently playing a track.

Thank you!

addition of seek, noticed some bugs

Thank you so much for this making this! I made a simple react app with the Spotify API and am trying to use this instead of the SDK to finish it off. Here's where I use it in my project: https://github.com/kristinyim/smookify/blob/master/src/components/Study.js#L50

A couple of questions:

  1. For my specific project, I need to be able to seek to a random part of the song. Would it be possible to add this feature?

  2. Sometimes on initialization, pressing the Play button doesn't start the music and you get a 403 error. If you go to devices and reselect the Spotify Web Player then things work fine. I think the 403 is because its currently being played on another device. To recreate, try having multiple tabs open.

  3. The URIs list isn't working for me. It just starts playing whatever song was last played on another device, disregarding the URI list I send it. Maybe this is related to (2)?

Thanks for your help in advance!

multiple errors in react

TypeError: this._getTokenRequests[t.ref] is undefined
index.js:9:8936
_onToken https://sdk.scdn.co/embedded/index.js:9
self-hosted:1011
_handleMessages https://sdk.scdn.co/embedded/index.js:9
self-hosted:1013
_receiveMessage https://sdk.scdn.co/embedded/index.js:9
self-hosted:1009

TypeError: this._streamer is null
3 index.js:9:9029
_onGetCurrentState https://sdk.scdn.co/embedded/index.js:9
self-hosted:1011
_handleMessages https://sdk.scdn.co/embedded/index.js:9
self-hosted:1013
_receiveMessage https://sdk.scdn.co/embedded/index.js:9
self-hosted:1009

The above error occurred in the component:
in Devices (created by Actions)
in div (created by style(ActionsRSWP))
in style(ActionsRSWP) (created by Actions)
in Actions (created by SpotifyWebPlayer)
in div (created by style(ContentRSWP))
in style(ContentRSWP) (created by Content)
in Content (created by SpotifyWebPlayer)
in div (created by style(PlayerRSWP))
in style(PlayerRSWP) (created by Player)
in Player (created by SpotifyWebPlayer)
in SpotifyWebPlayer (at App.js:190)
in div (at App.js:157)
in App (at src/index.js:7)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries. index.js:1375

TypeError: devices is undefined
Devices.js:120
render Devices.js:120
React 10
renderRoot self-hosted:1110
runRootCallback React
runRootCallback self-hosted:1110
flushSyncCallbackQueueImpl React
unstable_runWithPriority scheduler.development.js:674
React 6
updateState index.js:996
handlePlayerStatus index.js:635
step index.js:162
verb index.js:93
fulfilled index.js:45

TypeError: this._client is null
index.js:9:9666
_onDisconnect https://sdk.scdn.co/embedded/index.js:9
self-hosted:1011
_handleMessages https://sdk.scdn.co/embedded/index.js:9
self-hosted:1013
_receiveMessage https://sdk.scdn.co/embedded/index.js:9
self-hosted:1009

TypeError: devices is undefined

Read a track's seek time in milliseconds

Hi there! Thank you so much for making this!

I would like to read how far along the track the player is at any given time in milliseconds. My goal is to trigger text / color changes in an element when the chords change in a track the user is playing (given the millisecond marks of chord changes in a JSON).

I would also like to be able to seek with arrow keys. In another part of my application this would help the user enter in chords at certain times in the song without having to click and drag the slider.

Are either of these operations supported? If not, I would consider adding them myself, though I'm a younger developer and would like some kind of a pointer to where I would start. Thanks for reading.

Source for demo

Was wondering if you could provide the source for the demo? Would be useful for reference

Expose the current duration somehow

This is an awesome component. I have no qualms there.

However, I'm not able to access the current play location (elapsed duration) of the song. An app I'm working on is a visualization tool... and it's necessary to know the current position in the track whenever I'm animating a frame to get the proper audio analysis data.

Is there anyway that could be propagated backup as an event?

Question on Update Saved Status

I am just a little confused on how to use the updateSaveStatus prop. I am trying to change the song that is playing by clciccking on a another button and I am not sure how to do so.

Error 403 trying to play the song

I am getting a 403 error. Has anyone come across this? I searched the web, and it seems to be something about the account be disabled. However, my account is fully functional. When I click on the console, it says no token provided, but I added that to the player. Any ideas what might be causing this?

Unhandled Rejection (TypeError): Cannot read property 'Player' of undefined

Hi,

Having trouble simply running the demo in my webapp, it seems very straightforward, however I'm unsure why I'm getting the following error
image

Here is the barebones code below:

import { SpotifyAuth, Scopes } from "react-spotify-auth";
import { SpotifyApiContext } from "react-spotify-api";
import "react-spotify-auth/dist/index.css";
import SpotifyPlayer from "react-spotify-web-playback";
import Cookies from "js-cookie";

import Episodes from "./Episodes";

function App() {
const token = Cookies.get("spotifyAuthToken");

return (


{token ? (
<SpotifyApiContext.Provider value={token}>
<SpotifyPlayer
token={token}
uris={["spotify:artist:7A0awCXkE1FtSU8B0qwOJQ"]}
/>

      <Episodes token={token} />
    </SpotifyApiContext.Provider>
  ) : (
    // Display the login page
    <SpotifyAuth
      redirectUri="http://localhost:3000/callback/"
      clientID="1d54f201e7a04ba689f81a469340ea22"
      scopes={[
        Scopes.streaming,
        Scopes.userReadEmail,
        Scopes.userReadPrivate,
        Scopes.userLibraryRead,
        Scopes.userLibraryModify,
        Scopes.userModifyPlaybackState,
        Scopes.userFollowModify,
        Scopes.userReadPlaybackState,
      ]}
    />
  )}
</div>

);
}

Note: Using another package, react-spotify-auth for OAuth. I've tested the key(s) obtained from there in your demo and am able to play the demo songs from Jamie XX.

Error when trying to play URI in Create-React-App Typescript project

I wanted to test out this package so I created a fresh typescript project with Create React App and installed this package with "npm install --save react-spotify-web-playback".

Then I edited the App component to include the Spotify player:

import React from 'react';
import SpotifyPlayer from 'react-spotify-web-playback';
import './App.css';

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <SpotifyPlayer
  token="MY_TOKEN"
  uris={['spotify:artist:6HQYnRM4OzToCYPpVBInuU']}
/>
      </header>
    </div>
  );
}

export default App;

When I run this, the player shows up but I get the following error when trying to play:

Spotify Web Player: undefined is not an object (evaluating 'player.device.volume_percent')

In Chrome I get this stack trace:
Screen Shot 2020-12-11 at 4 04 24 AM

Any ideas?

Example snippet doesn't appear to work (Restriction violated)

Cool looking tool - thanks foor putting this together. Having an issue creating the bare example, however.

Authentication seems to work fine, requests are all 200s etc. so token is OK.

import SpotifyPlayer from "react-spotify-web-playback";
<SpotifyPlayer
    token={mySpotifyToken}
    uris={["spotify:artist:6HQYnRM4OzToCYPpVBInuU"]}
/>

Clicking 'play' results in a failed request which sends a request of Content-Length 0 to the play endpoint (e.g. the valid requests in your demo apps send a request payload with uris, context_uri etc.). Feels something along the lines of not picking up the uris data provided.

This request returns -

{
  "error" : {
    "status" : 403,
    "message" : "Player command failed: Restriction violated",
    "reason" : "UNKNOWN"
  }
}

Perhaps I'm missing something?

Might be useful if you could give a link to your demo apps source.

Queue

Hi!
There's the "add to queue" functionality? I'm trying to use dynamic uris but the player always back to first song when I add a new uri
Ex: uris={this.state.uris}

403 error premium only device

I'm not able to use player it's giving following error
{"error_type":"INVALID_LICENSE","message":"Device registration is not allowed: premium_only_device","error_code":9}

Sync player to connect api devices playback state on init

Given that the player has just been initialized and is not supplied with an array of uri to play. But different device is detected as playing using the spotify connect api.
Would it be possible to have the play auto select the currently playing device and sync to its playback status?

If not that would be a great feature to add.

Adding 'currently playing on' functionality

I was thinking it would be cool to add a currently playing on functionality to the player.

Currently if you load a player with no URIs, it doesn't indicate that the music is player on another device (along with the song). Usually if you load up spotify on your phone or desktop and the music is playing on the other device, it will tell you. Pressing play would result in automatically switching playback to that current device.

It looks like this player already performs that if you select on devices and select the web player. Would just implement that for pressing play on a player that has no URIs

Properly check end of songs

Hi,
I try to modify the code to allow explicit controls for the player (i.e. random shuffles on songs). I currently use progressMs, track durationMs and position within updateSeekBar() to determine when is the end of the song. However, I notice sometimes song ended with position less than 100 or duration - progress > 3000ms.l I wonder if there is anyway to better determine the end of the song?

Also, in some cases (i.e.) when mac's screen off and the player is running in the background, the player progressMs will not update anymore when log back in the system. I wonder what can be the cause.

Thank you.

create compact 'vertical' display mode

First off - this is AMAZING thank you so much for providing this for the community!

I'm looking at trying to fit the player into a side panel on my website, so it would look more like this:

player_preview

From pulling down the repo and perusing, looks like I need to modify the Info component and then move it so it's above the Slider component in the index.tsx render. I would attempt this myself but thought:

  1. maybe this was already an enhancement that you were thinking about
  2. I can't build (Invalid switch - "*". while cleaning? I didn't try super hard diagnose - probably my fault)
  3. I am a junior dev and this looks . . like a professional made it. not like my projects :)

Anyways just wanted to get your input before looking into this anymore.

Thanks again!

Passing volume as a prop?

As the title suggests, is there any way to pass a volume (decimal between 0 and 1) as a prop to the SpotifyPlayer component?

EMEError: Platform does not support navigator.requestMediaKeySystemAccess

I have created a Spotify app and trying to run it locally on my WIFi. However, when I use SpotifyPlayer, I am getting the following error:

Uncaught (in promise) EMEError: Platform does not support navigator.requestMediaKeySystemAccess
    at new e (https://sdk.scdn.co/embedded/index.js:119:253)
    at Function.e.fatal (https://sdk.scdn.co/embedded/index.js:119:516)
    at https://sdk.scdn.co/embedded/index.js:55:2946
    at new Promise (<anonymous>)
    at Function.r.create (https://sdk.scdn.co/embedded/index.js:55:2867)
    at Function.t.create (https://sdk.scdn.co/embedded/index.js:79:6011)
    at https://sdk.scdn.co/embedded/index.js:137:2839
    at new Promise (<anonymous>)
    at createPlayer (https://sdk.scdn.co/embedded/index.js:137:2217)
    at Object.createStreamerForClient (https://sdk.scdn.co/embedded/index.js:271:2104)

The same app did work on localhost. I also tried disabling Chrome's Hardware Media Key Handling which might be causing the issue but no luck.

Can't change volume in firefox, TouchEvent is not defined

Hi. just wanted to say this is really cool! However, it seems like changing the volume or scrubbing through the song isn't working in firefox at the moment. Doing so gives us this error log:

Uncaught ReferenceError: TouchEvent is not defined getCoordinates utils.ts:4 handleClickTrack index.tsx:104 React 14 unstable_runWithPriority scheduler.development.js:646 React 4 getCoordinates utils.ts:4 handleClickTrack index.tsx:104 React 14 bind_applyFunctionN self-hosted:1359 dispatchEvent self-hosted:1322 unstable_runWithPriority scheduler.development.js:646 React 4 bind_applyFunctionN self-hosted:1359 dispatchDiscreteEvent self-hosted:1322

It seems like an issue with FireFox requiring additional code for handling TouchEvents, perhaps in the src/components/ClickOutside.tsx file?

Thanks!

SpotifyPlayer component keeps showing loading animation

Sometimes (especially when I render the component on a page, change pages, then come back), the components never actually loads and is stuck in the loading animation until I manually refresh the page. Is anyone else having this issue?

Invalid durationMs for current track

The durationMs for the track from the callback prop is the same as the track that was previously played. Thus, the first track durationMs will be correct, but all subsequent tracks will be incorrect.
From the callback prop
image

Actual
image

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.