stephen / airsonos

:musical_note: AirPlay to Sonos
MIT License
2.1k stars 256 forks source link

Crashes when I select Airsonos from iphone #346

Open djrobsd opened 7 years ago

djrobsd commented 7 years ago

Running it on OSX 10.9.5. Launches successfully "Search complete. Set up 1 device tunnel." and it shows up on my iphone. As soon as I stream something to the speakers the app shuts down on the mac with this:

/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/rtspmethods.js:233 debug('uncaptured SET_PARAMETER method: %s', req.content.toString().trim ^ TypeError: Cannot call method 'toString' of undefined at setParameter (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/rtspmethods.js:233:64) at RtspServer. (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/rtsp.js:60:7) at ServerParser.EventEmitter.emit (events.js:98:17) at ServerParser._emitMessage (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/node_modules/httplike/lib/server-parser.js:28:8) at ServerParser.Parser._write (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/node_modules/httplike/lib/parser.js:91:14) at doWrite (_stream_writable.js:226:10) at writeOrBuffer (_stream_writable.js:216:5) at ServerParser.Writable.write (_stream_writable.js:183:11) at write (_stream_readable.js:582:24) at flow (_stream_readable.js:591:7) at Socket.pipeOnReadable (_streamreadable.js:623:5) at Socket.EventEmitter.emit (events.js:92:17) at emitReadable (_stream_readable.js:407:10) at emitReadable (_stream_readable.js:403:5) at readableAddChunk (_stream_readable.js:165:9) at Socket.Readable.push (_stream_readable.js:127:10)

codingsnippets commented 7 years ago

same here but with different error (OS X 10.11.3)

$ airsonos Searching for Sonos devices on network...

Library (@ 192.168.1.22:1400, RINCON_949F3E13ADA001400:0)

Search complete. Set up 1 device tunnel. crypto.js:241 this._handle.initiv(cipher, toBuf(key), toBuf(iv)); ^

Error: Invalid key length at new Decipheriv (crypto.js:241:16) at Object.Decipheriv (crypto.js:238:12) at Object.decryptAudioData (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/helper.js:141:25) at RtpServer. (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/rtp.js:32:23) at emitTwo (events.js:106:13) at Socket.emit (events.js:191:7) at UDP.onMessage [as onmessage] (dgram.js:547:8) master:~ Kevin$ airsonos Searching for Sonos devices on network...

Library (@ 192.168.1.22:1400, RINCON_949F3E13ADA001400:0)

Search complete. Set up 1 device tunnel. crypto.js:241 this._handle.initiv(cipher, toBuf(key), toBuf(iv)); ^

Error: Invalid key length at new Decipheriv (crypto.js:241:16) at Object.Decipheriv (crypto.js:238:12) at Object.decryptAudioData (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/helper.js:141:25) at RtpServer. (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/rtp.js:32:23) at emitTwo (events.js:106:13) at Socket.emit (events.js:191:7) at UDP.onMessage [as onmessage] (dgram.js:547:8)

codingsnippets commented 7 years ago

apparently my issue is fixed by: https://github.com/stephen/nodetunes/pull/42/commits/816ff4c9d8cba0b3355b72332ca809e046264537

djrobsd commented 7 years ago

Looks like someone posted a fix for nodetunes here, but it's not part of the official build (yet?): I would suggest changing

debug('uncaptured SET_PARAMETER method: %s', req.content.toString().trim());

to:

var debugString; if ("content" in req) { debugString = req.content.toString().trim(); } else { debugString = req.getHeader('Content-Type'); } debug('uncaptured SET_PARAMETER method: %s', debugString);

djrobsd commented 7 years ago

BTW, the above fix worked for me, I edited the /usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/rtspmethods.js line 233 and changed the entire line to the text I posted above. :)

djrobsd commented 7 years ago

Aparently the issue stems from streaming an item with no cover art.