Closed m4dm4rtig4n closed 3 years ago
That is all placeholder until someone with a Spotify account comes along to finish the implementation. You cannot currently make use of it.
I have premium account, what are you missing for the setup?
Its just not implemented in the code. Spotify does not use a standard cast protocol implementation, they invented their own strategy. If you've ever wondered why their cast support is janky... well thats why....
If I understand correctly, the cast protocol would only be used to launch their app, and then past that all interactions are meant to be done against their API directly specifying your "device id" for queue commands, and then their API talks to their app running on the cast device, bypassing the entire cast protocol.
Frankly, I should rip out the custom Spotify stuff because there's a pretty nasty crash opportunity in there due to some code I didn't comment out if you happened to get it to attempt to auth...
What would essentially need to be done is:
Point 2 is kind of where I left it because I (a) didn't have an account to try with and (b) I thought the client credentials flow wouldn't work, and the other auth mechanisms are no-gos. If that is the case, then this is dead and I just need to remove the code.
But the skeleton is there for someone else to attempt.
Note also, it might be possible to do something like LAUNCH the app using this node, waiting a second for it to start and register with Spotify's API, and then using the node-red-contrib-spotify node to get the device ID and send control commands. Actually, if that worked, I almost like that BETTER because it allows this node to stay "pure" instead of having to implement one off "because we could" implementations for companies like Spotify that refuse to do things the normal way... worth experimenting with at least.
Note also, it might be possible to do something like LAUNCH the app using this node, waiting a second for it to start and register with Spotify's API, and then using the node-red-contrib-spotify node to get the device ID and send control commands. Actually, if that worked, I almost like that BETTER because it allows this node to stay "pure" instead of having to implement one off "because we could" implementations for companies like Spotify that refuse to do things the normal way... worth experimenting with at least.
This mode could suit me personally, I do not currently have the skills and especially the time to work on the integration part of Spotify :/
Yeah, its essentially the auth requirements that limit this. I think Im just going to back off Spotify support altogether as I am not keen on adding app specific OAuth support for a generic cast solution. If Spotify allowed client credential flows to access user resources like devices and playlists, etc., it could be done close to how I was envisioning support before... but because they require a full auth code handshake for those operations, my hands are a little tied.
Frankly I'd almost say this functionality would be better in the node-red-contrib-spotify node, but even that's a little hard to stomach, making their node cast aware... but that's kind of where Spotify has put us here... it looks like in order to even start the Spotify app, you have to follow it up by setting the current auth token credentials in a custom cast directive to tell the Spotify cast app who it should be running as, so I'm not even sure just "launching Spotify" from this node would be sufficient because it has an INHERENT requirement for auth token access. Which is why I think making it a function of the spotify specific node, or some hybrid of both our nodes in a NEW one, makes the most sense. They essentially built their solution around "Spotify cast can only be started from the Spotify app".
Sorry man, I was trying to make an exception for Spotify, but they really don't make it easy.
Closing as explicit support for Spotify has been removed.
Hi,
Where to find this config to test spotify ?