bencevans / node-sonos

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

not able to play URI directly #422

Closed jpoeppelman1 closed 5 years ago

jpoeppelman1 commented 5 years ago
const Sonos = require('../').Sonos
const sonos = new Sonos(process.env.SONOS_HOST || '192.168.1.21')

sonos.play('https://archive.org/download/testmp3testfile/mpthreetest.mp3').then(success => {
  console.log('Yeay')
}).catch(err => { console.log('Error occurred %j', err) })

ERROR:

C:\Users\jlpoeppe\node_modules\sonos>node examples\playthis.js
Error occurred {"message":"Request failed with status code 500","name":"Error","stack":"Error: Request failed with status code 500\n    at createError (C:\\Users\\jlpoeppe\\node_modules\\sonos\\node_modules\\axios\\lib\\core\\createError.js:16:15)\n    at settle (C:\\Users\\jlpoeppe\\node_modules\\sonos\\node_modules\\axios\\lib\\core\\settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (C:\\Users\\jlpoeppe\\node_modules\\sonos\\node_modules\\axios\\lib\\adapters\\http.js:237:11)\n    at IncomingMessage.emit (events.js:205:15)\n    at endReadableNT (_stream_readable.js:1154:12)\n    at processTicksAndRejections (internal/process/task_queues.js:84:9)","config":{"url":"http://192.168.1.21: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}}

VERSION STUFF:

C:\Users\jlpoeppe\node_modules\sonos>npm -v 6.9.0

C:\Users\jlpoeppe\node_modules\sonos>node -v v12.4.0

C:\Users\jlpoeppe\node_modules\sonos>

svrooij commented 5 years ago

@jpoeppelman1 you're missing one important version number. What is the version number of your sonos system? And what is the OS you're using.

Just checked today that the playthis.js sample still works here if I type:

SONOS_HOST=192.168.X.X node examples/playthis.js

Which is effectively the same code as you're using.

Sonos version: 10.2 OS: Mac

I'm closing this issue for now, if you got extra information you can re-open the issue.

jpoeppelman1 commented 5 years ago

Still have the same issue. I'm using the following Sonos version. OS is Win10 Pro.

Version: 10.2 (build 50165071) Hardware Version: 1.26.1.6-1 Series ID: A200 WM: 0

bencevans commented 5 years ago

@jpoeppelman1 are you sure to be using the most current version of node-sonos (v1.12.0)? npm ls --depth=0