Spotify Web Playback Sdk Example

0 views
Skip to first unread message

Baudilio Eliason

unread,
Aug 5, 2024, 8:28:21 AM8/5/24
to wildhobbdela
Dont worry - it's quick and painless! Just click below, and once you're logged in we'll bring you right back here and post your question. We'll remember what you've already typed in so you won't have to do it again.

I cannot transfer playback to my web app. This used to work just fine, but is throwing a new error I haven't seen before. I'm able to create the player, successfully connect to Spotify, and get a device ID. I can see it as expected when I call GET /devices.


Yes, all types of content are unplayable, since the Transfer User Playback PUT did not actually transfer playback. The device is not "active" if I call get all devices, even after a successful PUT. What is the Descriptor ID the error message is asking for?


@spotifyjosh is there any update here? I've contacted the support team three times and done my best to dig into this error, I have no idea how to fix it. This is broken on a live project for me and affecting hundreds of users.


I started by creating a new Web Playback SDK instance (note that this instance does not receive the playback automatically). Then, I do a GET to /me/player/devices to see if the instance has been correctly registered. The response looks similar to this:


Hi alvaron, by sending method POST to the /me/player will return a 405 error, the only accepted method is PUT, as described in the official documentation. In the past, I've encountered the same problem which the server returns 202 and the playback device is still not activated. By clicking "Try It" button on the official documentation, it somehow works and now my script no longer returns 204, which is odd. Now that I updated in my project settings (I added a new redirect url), the problem came back (returns 202). To make matter worse, as of now (2-June) the "Try It" button is no longer available in the Transfer Playback section of the documentation, which leaves me no room to figure out this issue. Below is the approach I've taken.


I clicked the play button, even switching to another song on the web spotify while audio were connected to the Playback, it won't play. But it do switches the music. I even tried other methods such as /me/play?device_id=XXX and it runs as expected. 204 on the web spotify and 202 on the Web Playback SDK. I suspect something may happening on the backend-side here.


I am frustrated, to say the least, I am even willing to host an online meeting (**bleep**) for you guys to see what could potentially be the problem. I might try to create a new project with new client id to see if this issue still persists.


More wanted to bring this up as not sure if anyone else has this issue or a work around. I noticed when I did 32bit 384000 Hz audio quality that the spotify application would not play anything. You could select a song and it would look like it was trying to start a song and it wouldnt play and skip to the next song, wait a second like it was trying to play and then skip to the next song, and simply repeat these steps. Lowering audio quality on my sound card to 32bit 192000 Hz resolves the issue. Then increasing back up to 384000 Hz breaks it again so it was repeatable. I'm no audiophile and loweirng to 192000 Hz would be fine a solution but maybe I'm being stubborn as I don't want to do that just for one application. I realize this is probably more a spotify limitation since the max output might be lower like 320000 Hz but would be nice if it was possible to add some logic that could be added to the application to fix this issue.


I noticed and tested all this about a month ago and already uninstall the spotify application so not sure what version this was on. I've just simply just been using the webplayer as an alternative to the desktop application. Just curious if this affected anyone else as a small inconvenience.


It has been confirmed by other users that any sample rate above 192kHz breaks Spotify's audio playback. Here you can see an Issue thread created by a Soundblaster user who can use similar output options, and Spotify's answer to it.


Spotify works with 16/24/32bit and up to 192kHz audio stream. My guess is pretty much all music brought to Spotify is definitely under 192kHz. I'm not sure why higher sample rates break Spotify itself though.


I also read about having huge sample rates, apparently there is no much reason to set your sample rate much higher than 192 (or even less), since ad/da converters already operate at elevated sample rates and almost no-one (in commercial music at least) makes use of making music at such high sample rates. Creating, yes, but it's very likely down to 44.1 or 48 after mastering.

Classical music could be an exception (in some cases), when it comes to recording it.


Hi, it's been a while since you pointed out this issue but Spotify's answer to it in the linked thread ("we don't support it so it's a non-issue", okay den) not being very helpful I raise you a solution that I found, maybe It'll help some other users as well.


After having openend Spotify I start playing a song at a low sample rate (any lower than 192k, eg 88k). While it is playing I go in the sound settings of my DAC through the Windows control panel and change the sampling rate up to 384k. For me, it doesn't crash and I get the expected result but ymmv.


Anyway, I have to do this every time I start Spotify (not a big deal since it's virtually always running on my PC). But more annoying, If I start playing a song towards another device and then I switch back to the PC it crashes and I have to do the 'trick' all over again. It doesn't take time but it's not convenient..


While I appreciate you reaching out with an option to upvote an old request for lossless music, I would like to say that this is more of a functional issue for Spotify rather than a feature request. The heart of this issue lies within how Spotify handles devices that can handle higher sampling rates. While I would love lossless audio from Spotify, I originally chose Spotify because of the convenience (family plan), easy-to-use UI, plethora of podcasts, etc. However, I had to cancel services because it just will not work with my setup and it is an absolute pain to have to constantly go into my device settings prior to starting Spotify up. I'm certain I could just automate a workaround that could adjust the settings automatically each time I start up Spotify, but why wouldn't Spotify just fix the issue itself? We're not asking for higher sampling rate here, we're just asking to let us use what we have.


FiiO K5 Pro user here. It's unbelievable that this issue was diagnosed by NoIDontWantto1 in 2019 and it still hasn't been fixed, in 2021.



I came here from another community post which flagged this issue as "Solved". After reading the aforementioned posts, it could hardly be defined as "Solved". The two solutions that worked for me are:

(1) The one that zuperlemonhazze cited.



(2) Using Spotify's Web Player.



I'd classify both of them as "Hacks" and not actual "Solutions", as Team Spotify dubs it.



Question for Team Spotify: What's taking you this long to fix this issue? I mean it has been 3 years since it was diagnosed, for God's sake!


Just got my Fiio K3 and spent over an hour trying to find out why won't Spotify work. So yeah 384kHz still not supported. I wonder if they will ever do anything about this issue, especially when or if they ever release the Spotify HiFi...


Let me reiterate. Your solved solution is incorrect. The problem: Spotify will not play when DAC set to 384khz. That's it. Spotify does not work properly with certain Completely Valid hardware settings. Since I can't change the setting for just Spotify, and Spotify wants to be the contrarian, it's a bug, and it's not fixed. This is not solved. Please escalate. This isn't a feature request, it's a bug report.


Yes noticed that today. Used my FiiO K3 on maximum bit and sample rates and spotify app went absolutely n*ts. Interesting tho is that audio playback went on after switching between outputs (laptop speakers) and back to DAC in windows without changing any sample rates (above 192khz). But as soon as you close spotify app or restart computer, issue returns. Found the solution by trying back and forth and 192kHz is indeed the limit. Now I at least know that nothing is wrong with my hardware. Well, 32bit 192khz should be more than enought for Spotify. At least until they release Hifi. Thanks for your informative post.


2024 and this is still an issue. the easiest solution (more like a bandage :) that i have found is to start playback, switch to a different audio device which uses a bitrate that spotify accepts via your operating system's audio device switcher, then switch back and you should be able to hear it. ridiculous that this still hasn't been fixed though, as it surely can't be that hard. it's not like we are asking them to supply 384khz versions of all their music, their negligence would be understandable if that were the case. we are simply asking them to fix this bug so users don't have to use wack workarounds.

3a8082e126
Reply all
Reply to author
Forward
0 new messages