Announcements

Help Wizard

Step 1

NEXT STEP

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