This project is an unofficial client for Spotify Connect. It uses Spotify Web Playback API running on a headless browser instance. Spotify requires Premium subscription to use the API.
- Register a new application to
Spotify Developer
- Redirect url is
http://[device ip]:5000/auth/callback - Web API and Web Playback API
- Redirect url is
- Create
.envfile to root of project:SPOTIFY_CLIENT_ID='your client id' SPOTIFY_CLIENT_SECRET='your client secret'
- In ideal cases:
npm install - To install Firefox, run
npx puppeteer browsers install firefox - Set up API access as instructed
- Change default config values if necessary
- Run
npm start - Using any device, go to
http://[server ip]:5000for authentication - After successful authentication, the device should show up in Spotify as target
- Defaults are in file
config/default.json, you can override them directly or inconfig/local.jsondeviceNameis how the device appears on Spotifybrowseris one of the predefined browser configurationschromeis defaultfirefoxuses Firefox (see known issues)raspberryis for Raspberry Pi (requiresfirefoxto be installed)raspberry_chromiumis legacy config for Raspberry Pi (requireschromium_browser)
- The application has some API endpoints for controlling the player via
HTTP POSTrequests/api/play-pausefor toggling between play and pause/api/nextfor skipping to next track/api/prevfor returning to previous track/api/resetfor resetting the Spotify Connection
- To get status info, there is
HTTP GETendpoint:/api/statusreturns WebPlaybackState object if available
- Audio lags/stutters relatively often when using Chromium on Raspberry Pi
- Older versions of Firefox may not work
- Spotify Web Playback API sample
- spotify-playback-sdk-node by Samuel Scheit
This project, including the code snippets provided, is not affiliated with or supported by Spotify. The project does not encourage or endorse any use that may violate Spotify's Terms of Service. Users are responsible for ensuring their usage of Spotify's APIs and services complies with the applicable terms and conditions set by Spotify.