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
.env
file 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]:5000
for 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.json
deviceName
is how the device appears on Spotifybrowser
is one of the predefined browser configurationschrome
is defaultfirefox
uses Firefox (see known issues)raspberry
is for Raspberry Pi (requiresfirefox
to be installed)raspberry_chromium
is legacy config for Raspberry Pi (requireschromium_browser
)
- The application has some API endpoints for controlling the player via
HTTP POST
requests/api/play-pause
for toggling between play and pause/api/next
for skipping to next track/api/prev
for returning to previous track/api/reset
for resetting the Spotify Connection
- To get status info, there is
HTTP GET
endpoint:/api/status
returns 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.