Skip to main content

Harness Web Player - Spotify

Status: beta. Unofficial integration — Spotify does not provide or support it.

Spotify played through a Harness Web Player, shown on the same Spotify source page the Spotify Web API and Spotify (Autonomic Mirage) drivers use — the page does not know which one it is bound to. The player holds the Spotify session, so there is no Spotify application, OAuth flow or Connect target to configure, and no Web API user limit.

What it does​

  • Your library — Playlists, Liked Songs, Albums, Followed Artists and Podcasts of the account signed in on the player.
  • Drill-down — a playlist or album opens its tracks; an artist opens their top tracks and albums; a podcast opens its episodes.
  • Search — tracks, albums, artists, playlists, podcasts and episodes.
  • Play — a tile's play button plays the whole list; a track keeps playing through the album or playlist it was picked from. Re-sending the list already playing resumes it.
  • Now playing — written to current_media while Spotify is the service playing on the player; another service on the same player does not overwrite it.

What it does not do​

The source page hides these buttons on this backend:

  • Save or remove from the library, and artist radio.
  • Recently played.

Setup​

  1. Sign in to Spotify once on the player (npm run login on the player).
  2. Create a device with this driver. Enter the player's IP and HTTP port (8686 unless the instance was started on another).
  3. Create an AV source for the device and set its component to spotify.

A plain Harness Web Player device may use the same player for the other services.

Attributes​

AttributePurpose
ip, portPlayer address; default port 8686.
current_mediaRead-only. Now playing as the Spotify page consumes it: name, artist, album, image_url, shuffle, repeat, context, spotify_id.

The Web Player attributes (now_playing, sign_in_needed, service_status …) are written too.

Commands​

CommandNotes
get_listentity of playlist, album, artist, show, saved_track, or playlist_tracks / album_tracks / artist_albums / artist_tracks / show_episodes with an id; start and count page the list. Any other entity returns an empty list.
searchentity of track, album, artist, playlist, show or episode and a query.
playcontext_uri (a spotify: uri, or saved_tracks for Liked Songs) plays that list; uris plays the first track, continuing through the list it was picked from; neither resumes.
get_now_playing, get_devicesThe media object, and the player as the single device with the page's capabilities.
pause, play_pause, stop, next, previous, seekTransport.
set_volumevolume 0-100. Refused when the player's volume_mode is fixed.
shuffle_toggle, repeat_toggleShuffle on or off; repeat steps off, the list, the track, as Spotify's own button does (current_media.repeat is true for either). Needs a player from 0.1.17 on.
shuffle, repeatAs on the Web Player: state on, off or toggle; mode off, all, one or toggle.

Known quirks​

  • Spotify allows one stream per account: two zones playing Spotify at once need two accounts and two player instances.

Troubleshooting​

SymptomCheck
Lists are empty or report signed outSign Spotify in on the player, or from a plain Web Player source page.
Device stays disconnectedOpen http://<ip>:<port>/status in a browser on the GEM network.
Playback starts in the wrong roomEach zone needs its own player instance; check this device's port.