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
983 stars 79 forks source link

The context is null for Recently Played tracks #966

Open mavvari opened 6 years ago

mavvari commented 6 years ago

Hi,

According to the API documentation, the 'recently-played' tracks API is supposed to return Context Object in the response But it is always seems to be NULL.

https://developer.spotify.com/documentation/web-api/reference/player/get-recently-played/

BTW, I am only testing Album/Playlist/Artist, I understand the context could be NULL for Radio/Podcast and other types.

Is this a bug ?

Thanks,

bih commented 6 years ago

Hi @mavvari,

I can confirm that I can reproduce this issue. It is not expected behaviour, and I will mark this as a bug. We'll investigate and get back to you with updates. Cheers!

bih commented 6 years ago

Hello @mavvari,

I can confirm this issue has been fixed. I'll close this issue, but feel free to re-open if you continue to have issues 🙂 Thank you for reporting!

mavvari commented 6 years ago

Hello @bih

I confirm that playing a track from any Playlist is showing up as type 'playlist_v2' as context. Thanks for taking care of that.

But playing a track from an Artist or Album still returning context as null. Can you please look into it ?

Not sure how to re-open this issue, can you do that for me ?

Thanks,

bih commented 6 years ago

@mavvari Sorry for that, I've reopened the issue and we'll reinvestigate 👍

mavvari commented 6 years ago

@bih Any update ? Thanks.

mavvari commented 6 years ago

@bih Appreciate if you could respond with any update. Thanks,

mmontag commented 6 years ago

Hi @mavvari, I'm having trouble reproducing this behavior. Can you provide some steps to replicate the null album/artist/playlist context? How do you trigger playback? What client are you using (mobile, desktop, etc.)?

mavvari commented 6 years ago

Hi @mmontag just choose an artist on your desktop app and play song from that artist. Go to Spotify developer console to call the recently-played API. You can see the song in the response but context would be set to null

elijaholmos commented 5 years ago

Any progress on this issue?

tjcuddihy commented 4 years ago

Also looking to get this bug resolved. For me the context is almost always null

nathan3882 commented 4 years ago

Hi there @bih, I hope you are well :)

I'm having this issue too and am hopeful you can look into it / get someone else at spotify to do a little investigation.

I just thought I'd give you some reproduction steps as there seems to be a lack of it on this thread.

Handy tips for reviewer:

  1. I've ommitted some fields.
  2. Handy formatter https://jsonformatter.curiousconcept.com/

1) Step one, start playing a song in one of your own playlists; then send a request to get the currently playing song @ https://api.spotify.com/v1/me/player and recieve a response like so:

{ "device": { "id": "{device_id_was_here", "is_active": true, "is_private_session": false, "is_restricted": false, "name": "NATHAN-PC", "type": "Computer", "volume_percent": 100 }, "shuffle_state": false, "repeat_state": "off", "timestamp": 1585999085648, "context": { "external_urls": { "spotify": "https://open.spotify.com/playlist/0FJIib6OHRc9mCXzwcQe88" }, "href": "https://api.spotify.com/v1/playlists/0FJIib6OHRc9mCXzwcQe88", "type": "playlist", "uri": "spotify:user:11149448484:playlist:0FJIib6OHRc9mCXzwcQe88" },"disc_number": 1, "duration_ms": 213573, "explicit": false, "external_ids": { "isrc": "GBARL9300135" }, "external_urls": { "spotify": "https://open.spotify.com/track/4uLU6hMCjMI75M1A2tKUQC" }, "href": "https://api.spotify.com/v1/tracks/4uLU6hMCjMI75M1A2tKUQC", "id": "4uLU6hMCjMI75M1A2tKUQC", "is_local": false, "name": "Never Gonna Give You Up", "popularity": 75, "preview_url": "https://p.scdn.co/mp3-preview/a69cabb16c6c3333db903d1f538e808493689e40?cid=774b29d4f13844c495f206cafdad9c86", "track_number": 1, "type": "track", "uri": "spotify:track:4uLU6hMCjMI75M1A2tKUQC" }

2) Step two, note the track ID 4uLU6hMCjMI75M1A2tKUQC and the track name of Never Gonna Give You Up - wait for the song to finish, then send a request to https://api.spotify.com/v1/me/player/recently-played?limit=1

3) Step 3, receive the response, and compare the track number and name, however, context is null unlike before with currently playing. { "items": [ { "track": { "album": { "album_type": "album", "artists": [ { "external_urls": { "spotify": "https://open.spotify.com/artist/0gxyHStUsqpMadRV0Di1Qt" }, "href": "https://api.spotify.com/v1/artists/0gxyHStUsqpMadRV0Di1Qt", "id": "0gxyHStUsqpMadRV0Di1Qt", "name": "Rick Astley", "type": "artist", "uri": "spotify:artist:0gxyHStUsqpMadRV0Di1Qt" } ], "external_urls": { "spotify": "https://open.spotify.com/album/6N9PS4QXF1D0OWPk0Sxtb4" }, "href": "https://api.spotify.com/v1/albums/6N9PS4QXF1D0OWPk0Sxtb4", "id": "6N9PS4QXF1D0OWPk0Sxtb4", "images": [ { "height": 640, "url": "https://i.scdn.co/image/ab67616d0000b273255e131abc1410833be95673", "width": 640 }, { "height": 300, "url": "https://i.scdn.co/image/ab67616d00001e02255e131abc1410833be95673", "width": 300 }, { "height": 64, "url": "https://i.scdn.co/image/ab67616d00004851255e131abc1410833be95673", "width": 64 } ], "name": "Whenever You Need Somebody", "release_date": "1987-11-12", "release_date_precision": "day", "total_tracks": 10, "type": "album", "uri": "spotify:album:6N9PS4QXF1D0OWPk0Sxtb4" }, "artists": [ { "external_urls": { "spotify": "https://open.spotify.com/artist/0gxyHStUsqpMadRV0Di1Qt" }, "href": "https://api.spotify.com/v1/artists/0gxyHStUsqpMadRV0Di1Qt", "id": "0gxyHStUsqpMadRV0Di1Qt", "name": "Rick Astley", "type": "artist", "uri": "spotify:artist:0gxyHStUsqpMadRV0Di1Qt" } ], "external_urls": { "spotify": "https://open.spotify.com/track/4uLU6hMCjMI75M1A2tKUQC" }, "href": "https://api.spotify.com/v1/tracks/4uLU6hMCjMI75M1A2tKUQC", "id": "4uLU6hMCjMI75M1A2tKUQC", "name": "Never Gonna Give You Up", "preview_url": "https://p.scdn.co/mp3-preview/a69cabb16c6c3333db903d1f538e808493689e40?cid=774b29d4f13844c495f206cafdad9c86", "track_number": 1, "type": "track", "uri": "spotify:track:4uLU6hMCjMI75M1A2tKUQC" }, "played_at": "2020-04-04T11:21:38.091Z", "context": null } ], "limit": 1, "href": "https://api.spotify.com/v1/me/player/recently-played?limit=1" }

Expect: the context to be equal to the context in which currently playing returned. Received: null.

I'm sending these requests from postman's desktop client with my Bearer auth token with the following priviliges: user-read-playback-state,user-modify-playback-state,user-read-recently-played

Hopefully you can shed some light, thanks!