Closed jeantristan closed 5 years ago
From what I have seen, this error is raised when you do not have a Spotify Premium account connected to your Sonos system.
I was able to run your example and the song played fine for me.
I also tested another track and had success.
device.play("spotify:track:0aersVHlGGXcHeRvHtuaSt")
@jeantristan could hou verify you have a premium spotify account. It might also be an issue with the Spotify region, you can set it to EU.
I managed to make it work! The problem was that the queue was not empty. Were you aware of that issue?
With this code it's working perfectly:
const Sonos = require('sonos')
// Set up the master if a group, otherwise 500 error
const device = new Sonos.Sonos('192.168.1.17')
const spotify_id = req.params.spotify_id
device.setSpotifyRegion(Sonos.SpotifyRegion.EU)
const spotifyUri = 'spotify:album:' + spotify_id
device.flush().then(result => {
device.queue(spotifyUri).then(result => {
device.selectQueue()
device.play()
});
});
Hmm, interesting. When I tested it, I had a non-empty queue and did not have any issues.
Having the same problem, I can not use play(uri)
on a non-empty queue (throws 500)
Hello,
For the record I have the same issue with sonos-cli (https://github.com/bencevans/sonos-cli/issues/20)
Expected Behavior
I want to be able to play a spotify song based on URI as mentioned in the documentation.
Current Behavior
I have a 500 exception raised when trying to play a spotify song based on URI
Possible Solution
I can't manage to find a workaround.
Sample code or executed example
When i try to execute the following code:
I have the following result:
Versions (and Environment)
Node version: 10.1.0 node-sonos version: 1.8.1 OS: MacOs