spotify / web-api

This issue tracker is no longer used. Join us in the Spotify for Developers forum for support with the Spotify Web API ➡️ https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer
982 stars 79 forks source link

recently-played endpoint not up-to-date for Sonos streams #1196

Open lodedf opened 5 years ago

lodedf commented 5 years ago

Title: recently-played endpoint not up-to-date for Sonos streams

Issue found on March 14 2019.

Endpoint(s):

Scope(s):

Steps to reproduce:

  1. Stream Spotify music on a Sonos device.
  2. Call the recently-played endpoint

Expected behaviour:

Real time info on recent plays. Also for streams on Sonos devices.

Actual behaviour:

One update per day. Not real time. Not complete.

Background:

Hi there,

This is about an issue related to Spotify streaming on Sonos and failing/incorrect/incomplete last.fm scrobbling. I am a Sonos/Spotify/Last.fm enduser. I am not a developper for last.fm.

I recently purchased a pretty extensive Sonos system. (4xplay1; 1xONE; 2xplay5) Spotify streaming on them works perfectly. However, I also have a last.fm account on which I keep track of my listening history and statistics. As you might know, since about a year, last.fm has been better integrated with Spotify by linking your Spotify account within last.fm. Last.fm then retrieves my recent Spotify plays from Spotify via an API endpoint. This wayn there is no longer a need for any Spotify streaming client to actively scrobble to last.fm. Now, that works perfectly from any device, except when you stream Spotify on a Sonos system. There is no difference whether I start the stream within the Sonos app, or within the Spotify app via Spotify connect. The problem is as follows:

  1. When I let Sonos actively scrobble to last.fm, I get to see each play twice (active scrobble + API read-out). This makes my statistics unusable.
  2. When I don't let Sonos scrobble, I don't get to see any real-time scrobbles in last.fm. The plays will come through eventually, after a day or so, but often they are not complete and always limited to only the last 50 songs.

I learned that last.fm uses the "Get Current User's Recently Played Tracks" API endpoint at Spotify with the following call: "GET "https://api.spotify.com/v1/me/player/recently-played". This call indeed only passes on the 50 last played songs, as documented. It looks like the Sonos streams are only synced one time in a day instead of just real-time as on any other device that can stream Spotify.

Is spotify aware of this problem and is there a fix coming up?

Thanks in advance for your answer! Kind regards, Lode

christianmat commented 5 years ago

I am experiencing the same issue.

Kaprow commented 5 years ago

I'm having a somewhat similar issue with the endpoint: Looks like the "played_at" property is being set to the end time rather than start time and results are delayed even after the track has completed playing. Anyone else seeing this behavior?

I'm pretty sure we saw the same thing in 2017 or '18 and it was determined to be a bug.