Brandawg93 / homebridge-nest-cam_old

Use your Nest Cam as IP camera in HomeKit.
Apache License 2.0
92 stars 14 forks source link

Live stream crash after update #18

Closed taimurasad closed 6 years ago

taimurasad commented 6 years ago

Hi

Updated Homebridge updated Homebridge-Nest-cam

and now all of a sudden my live stream of cameras are crashing. Running the setup on RPi3. Was working fine before the update.

this is the crash:

/usr/lib/node_modules/homebridge-nest-cam/lib/streamer.js:339 let ssrc = crypto.randomBytes(4).readUInt32BE(0, true); ^

ReferenceError: crypto is not defined at NexusStreamer.prepareStream (/usr/lib/node_modules/homebridge-nest-cam/lib/streamer.js:339:18) at NestCam.prepareStream (/usr/lib/node_modules/homebridge-nest-cam/lib/nestcam.js:115:14) at StreamController._handleSetupWrite (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/StreamController.js:540:23) at Characteristic.SetupEndpoints. (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/StreamController.js:271:12) at emitMany (events.js:147:13) at Characteristic.SetupEndpoints.emit (events.js:224:7) at Characteristic.SetupEndpoints.Characteristic.setValue (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:319:10) at Accessory. (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:867:22) at Array.forEach () at Accessory._handleSetCharacteristics (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:807:8)

What could be the issue?

Here are the npm version details

{ npm: '5.5.1', ares: '1.10.1-DEV', cldr: '31.0.1', http_parser: '2.7.0', icu: '59.1', modules: '57', nghttp2: '1.25.0', node: '8.9.1', openssl: '1.0.2m', tz: '2017b', unicode: '9.0', uv: '1.15.0', v8: '6.1.534.47', zlib: '1.2.11' }

KhaosT commented 6 years ago

Sorry. Please try the updated v0.0.7.

taimurasad commented 6 years ago

Hi KhaosT

Thanks for such a quick reply and fixing the problem. The live stream is now working, but I have noticed that it is loading slower than it used to previously and also sometimes it's failing to load the stream with "No Response" message after taking more than 30s trying to load it. Although Homebridge doesn't crash and trying a couple of times does start the live stream again. This was something that wasn't happening before.

Here's what the console shows when the camera throws "No Response" after trying to start live stream for 30 seconds or so

[NexusStreamer]Ping undefined [NexusStreamer]Ping undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined

and something like this when it works after a few tries

[NexusStreamer]OK [NexusStreamer]Ping [NexusStreamer]Ping [NexusStreamer]Playback Begin [NexusStreamer]Ping [NexusStreamer]Ping ECONNRESET [NexusStreamer]OK [NexusStreamer]Playback Begin

taimurasad commented 6 years ago

just to add again, I can live with this, at least it's not crashing and does load live stream after couple of fail tries (sometimes load it perfectly even on first try). It's just that I feel it was more responsive before the update. Again, Thanks for your work and support!

KhaosT commented 6 years ago

Huh this is interesting. Would you mind give v0.0.9 a try?

taimurasad commented 6 years ago

Updated. Seems to be working much more reliably now. Tried loading 3 different streams from 3 different cameras and all loaded live stream in under 10 seconds on first try! Thank you so much for such quick response and fix!

KhaosT commented 6 years ago

No problem! Feel free to re-open the issue if this happens again.