bencevans / node-sonos

🔈 Sonos Media Player Interface/Client
https://www.npmjs.com/package/sonos
MIT License
704 stars 147 forks source link

Playback broken with latest sonos version? #452

Closed AUTplayed closed 4 years ago

AUTplayed commented 4 years ago

Expected Behavior

device.play(https://example.com/music.mp3) should play the music

Current Behavior

it returns a 500 Internal Server Error

Error: Request failed with status code 500 at createError (...\node_modules\axios\lib\core\createError.js:16:15) at settle (...\node_modules\axios\lib\core\settle.js:17:12) at IncomingMessage.handleStreamEnd

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>701</errorCode></UPnPError></detail></s:Fault></s:Body></s:Envelope>

Versions (and Environment)

Node version: 10.16.0 node-sonos version: 1.12.5 OS: windows

SoftwareVersion: '54.2-72031', DisplaySoftwareVersion: '10.6', HardwareVersion: '1.22.1.5-2',

Grouping and everything works great, but not playing a file...

svrooij commented 4 years ago

Your node-sonos version seems incorrect, should be something like 1.1x.y

Can you try this example https://github.com/bencevans/node-sonos/blob/master/examples/playthis.js and share the results with us?

AUTplayed commented 4 years ago

oh, i made a typo for the version there, I'll try the example anyway tho

AUTplayed commented 4 years ago

Error occurred {"message":"Request failed with status code 500","name":"Error","stack":"Error: Request failed with status code 500\n at createError (D:\\Philipp\\LocalPrgrms\\sonosPi\\node_modules\\axios\\lib\\core\\createError.js:16:15)\n at settle (D:\\Philipp\\LocalPrgrms\\sonosPi\\node_modules\\axios\\lib\\core\\settle.js:17:12)\n at IncomingMessage.handleStreamEnd (D:\\Philipp\\LocalPrgrms\\sonosPi\\node_modules\\axios\\lib\\adapters\\http.js:237:11)\n at IncomingMessage.emit (events.js:203:15)\n at endReadableNT (_stream_readable.js:1129:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)","config":{"url":"http://10.0.0.6:1400/MediaRenderer/AVTransport/Control","method":"post","data":"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:AddURIToQueue xmlns:u=\"urn:schemas-upnp-org:service:AVTransport:1\"><InstanceID>0</InstanceID><EnqueuedURI>https://archive.org/download/testmp3testfile/mpthreetest.mp3</EnqueuedURI><EnqueuedURIMetaData></EnqueuedURIMetaData><DesiredFirstTrackNumberEnqueued>0</DesiredFirstTrackNumberEnqueued><EnqueueAsNext>1</EnqueueAsNext></u:AddURIToQueue></s:Body></s:Envelope>","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"text/xml; charset=utf8","SOAPAction":"\"urn:schemas-upnp-org:service:AVTransport:1#AddURIToQueue\"","User-Agent":"axios/0.19.0","Content-Length":498},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1}}

but yeah, still the same

I even switched to the version of your github master, but no changes

svrooij commented 4 years ago

This seems a case of WOMM (works on my machine) mac|node 12.13.1|sonos Version: 10.6 (build 54272031) Current version from repository. did an npm install before trying.

node-sonos % SONOS_HOST=192.168.96.56 node examples/playthis.js 
Yeay
AUTplayed commented 4 years ago

huh, I figured out that it only works for me if the device is ungrouped, pretty weird.. I'll try some other stuff in the following days..

svrooij commented 4 years ago

What the play command does is sending an item to the queue, this can only be used if the device is using the queue.

Each group of Sonos speakers has one "coordinator" managing the queue and streaming it to all other speakers. You should be able to send the play command to the coordinator.

The coordinator is always the player you picked when you created the group. So if you clicked the kitchen speaker and added the living room the kitchen speaker is the boss managing the queue. This is also the player that would be able to handle the next, previous..... Commands.

Closing this issue for now, you can re-open if you think you still have an issue with this.

AUTplayed commented 4 years ago

doesn't work when sending play command to group master..