Announcements

Help Wizard

Step 1

NEXT STEP

Spotify web api : event/item_ready or resume queries error 400

Spotify web api : event/item_ready or resume queries error 400

Plan

Premium

Country

France

Device

windows browser

Operating System

windows 10

My Question or Issue

This problem made me crazy, I have to present my app in 2 days, today morning everything was working well, then after lunch, without touching anything I have the event error and my app doen't work anymore this is very very frustrating.

The errors happen when I call the Play endpoint of the spotify Api :

 

 

 

 

$("#playSong").click(()=> {
        const deviceId = sessionStorage.getItem("deviceId")
        $.ajax({
            url: "https://api.spotify.com/v1/me/player/play?device_id="+ deviceId,
            type: "put",
            data: JSON.stringify({
                uris : ["spotify:track:0adsXJdRMoumQY1ECzEjWf"]
            }),
            headers: {
                "Content-Type":"application/json" ,
                Authorization: "Bearer " + sessionStorage.getItem("idPlateforme")
            }
        })
    })

 

 

 

 

Token and deviceId are correct and working fine.

The query above returns a success response, though it seems that the web playback sdk sends internally 2 queries that returns 400 not every time

the first query : 

https://cpapi.spotify.com/v1/client/90f40750108390a7ed2b62af9e94e58a4763bd15/event/item_ready

with these datas :

 

 

 

 

{"timestamp":1662798866395,"player_state":{"playback_id":"454eba51905ada7d8e086bda7726f6d2","duration":278181,"current_position":0,"paused":false,"playbackQuality":{"hifi_status":"NONE","audio_quality":"VERY_HIGH"}},"playback_descriptor_id":"CIDQDxANGgVBVURJTw==","initial_loading_stats":{}}

 

 

 

 

Its error message is this : 

Playback updates are only acceptable once the playback has started

The second one which also returns 400 error : 

https://cpapi.spotify.com/v1/client/90f40750108390a7ed2b62af9e94e58a4763bd15/event/resume

with datas :

 

 

 

 

{"timestamp":1662798867712,"player_state":{"playback_id":"454eba51905ada7d8e086bda7726f6d2","duration":278229,"current_position":0,"paused":false,"playbackQuality":{"hifi_status":"NONE","audio_quality":"VERY_HIGH"}},"playback_descriptor_id":"CIDQDxANGgVBVURJTw=="}

 

 

 

 

everything was tested on a simple HTML page like the example here on all known browsers  : https://developer.spotify.com/documentation/web-playback-sdk/quick-start/

and still doesn't work on any

I know it's nothing to do with MY code, a possible bug ?

I attached my working test (assuming someone changes the token)

Please I need help 

Reply
0 Replies

Suggested posts