Announcements

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

Prevent playback api from making a new device every connect

Prevent playback api from making a new device every connect

I'm trying to create a web player but every time a user connects to the player it creates a new device. Is there a way to prevent this so every time a user connects it doesn't do this?

 

Dustindowell22_0-1664103153764.png

 

Edit: Additionally I can't remove these web players. Even when I log out of all devices. There should be an easier way to delete these.

Reply
2 Replies

I've discovered a work around for this. If you call disconnect on your webplayer and then attempt to select that device for playback, you'll get a 404 and the device will be removed. Kinda clunky to manage but it works:

 

I'm managing it server side, but could probably be done in the client onbeforeunload

 

In your app:

let webplayerId = "XXXXX"

this.webPlayer.disconnect();

method: "PUT",
headers: {
    Authorization"Bearer " access_token,
    "Content-Type": "application/json",
},
body: JSON.stringify({
    device_ids: [webplayerId],
    play: false,
}),
}).then((res) => {
    // res.status will be 404
})

Update: This seems to no longer work.

Suggested posts

Staff
Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

Staff
ModeratorStaff / Moderator/ 4 years ago  in Social & Random

Type a product name