Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

API - playback timestamp

API - playback timestamp

Hi there,


This is a Problem regarding the web api get playback state /v1/me/player

the timestamp field is inconsistent. I am trying to accurately get users playback / progress time


The documentation says : timestamp [integer] - Unix Millisecond Timestamp when data was fetched.

however I am finding that

1. if i start playing a track, the timestamp comes back as the time when the song started. with the current time this allows you to infer the current time accurately, however

2. if playback is paused, or skipped to a different time, the timestamp is now this new time when it was resumed. without knowing the progress at that time however you can't really infer (precisely) the playback time.

3. using the progress_ms field and counting the time since the data was received is not precise and varies in accuracy as it takes a while until the data is received and processed in the endpoint.


Shouldn't the timestamp (as per documentation) always be the current time of the data request, i.e. when it was fetched? then the frontend / endpoint could accurately know at what time the response was send and determine how much time has passed since
i.e. accurate progress = progress_ms + ( time_now - timestamp )


If there is another way to accurately know the playback time I am all ears, but it seems to me this timestamp field is not quite what it is supposed to be / as described.


Thanks in advance for any help,


Cheers,

Thomas

Reply
2 Replies

I'm also having this issue and I have been trying workaround for weeks now.

From what I have seen online, the "timestamp field not acting as it should" issue has been going for years now (see https://github.com/spotify/web-api/issues/1073).

I tried to estimate the actual timestamp field by getting the average value of the Date.now() before and after doing the API call but it isn't consistent either.

As you realized, in the API, timestamp is only modified when there is an update on the player, not when the API call has been processed, sadly.

If you, or anybody else, has found a fix for this or any workaround, I'd be interested to be alerted.

Thanks

Sadly still an issue 😞

Suggested posts