stephen / airsonos

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

Tunnel setup fails after selecting it. #373

Open melcarthus opened 7 years ago

melcarthus commented 7 years ago

When I run Airsonos in the terminal I can choose the source in my sound preferences. But as soon as I select it it fails.

I got his error.

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

Error: Invalid key length
    at Error (native)
    at new Decipheriv (crypto.js:232:16)
    at Object.Decipheriv (crypto.js:229:12)
    at Object.decryptAudioData (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/helper.js:141:25)
    at RtpServer.<anonymous> (/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 (dgram.js:540:8)
s3w47m88 commented 7 years ago

Same here.

MacOS Sierra 10.12.5 iMac (Retina 5K, 27-inch, Late 2015)

➜  ~ airsonos
Searching for Sonos devices on network...

Hallway (@ 192.168.1.154:1400, RINCON_5CAAFD54BCDE01400:37)
Patio (@ 192.168.1.163:1400, RINCON_5CAAFD534FFC01400:42)
Living Room (@ 192.168.1.156:1400, RINCON_5CAAFD0564BA01400:71)
Master Bedroom (@ 192.168.1.158:1400, RINCON_5CAAFD05A76001400:69)
Sound Bar (@ 192.168.1.155:1400, RINCON_5CAAFDAFAC4A01400:103)
Office (@ 192.168.1.157:1400, RINCON_5CAAFDAFAC4A01400:102)

Search complete. Set up 6 device tunnels.
crypto.js:265
  this._handle.initiv(cipher, toBuf(key), toBuf(iv));
               ^

Error: Invalid key length
    at new Decipheriv (crypto.js:265:16)
    at Object.Decipheriv (crypto.js:262:12)
    at Object.decryptAudioData (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/helper.js:141:25)
    at RtpServer.<anonymous> (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/rtp.js:32:23)
    at emitTwo (events.js:125:13)
    at Socket.emit (events.js:213:7)
    at UDP.onMessage [as onmessage] (dgram.js:623:8)
julianrendell commented 7 years ago

@melcarthus @s3w47m88 - root cause is a bug in nodetunes - https://github.com/stephen/nodetunes/pull/42

There are some instructions at the bottom of that issue that almost worked for me.

This is what I've done as a quick hack:

  1. Install airsonos as per regular directions
  2. cd to where airsonos has installed it's dependencies (eg /usr/local/lib/node_modules/airsonos/node_modules on my Mac)
  3. 'Hide' the broken nodetunes: mv nodetunes nodetunes-broken
  4. Install a fixed version of nodetunes: npm install -g git://github.com/Kolky/nodetunes.git#master
  5. run airsonos as usual. Note that it takes ~20 seconds for the airplay stream to start.
  6. ask @stephen to please merge the fix to nodetunes and update airsonos 😃
s3w47m88 commented 7 years ago

Thank you! This worked.

I would like to contribute an app so it can be started via clicking a dock icon. Is that ok?

Also, any plans to add support so it can work on multiple speakers at the same time?

chris-- commented 7 years ago

Had the same problem and Kolky's fork works for me. I added his branch in the package.json of the globally installed package:

  "dependencies": {
   (...)
    "nicercast": "0.1.0",
    "nodetunes": "https://github.com/Kolky/nodetunes#master",
    "sonos": "git://github.com/stephen/node-sonos.git#stephen-1.0.0"
  },

you can also just run this until @stephen fixes the issue in nodetunes:

cd `npm root -g`/airsonos && rm -rf node_modules/nodetunes && sed -i '' 's/"nodetunes": "^0.3.0",/"nodetunes": "https:\/\/github.com\/Kolky\/nodetunes#master",/g' package.json && npm install
chris-- commented 7 years ago

@s3w47m88 Good idea. IMO a daemon would be better suited for this task. I don't want to start the app every time I want to stream npr ;) Check out how to do that here.

Krishna commented 7 years ago

@julianrendell fix worked for me too. (macOS Sierra 10.12.6 (16G29))

Thanks!

Mountainallure commented 5 years ago

OSX Yosemite 10.10.1 Clover, works fine.