defvol / Paparazzo.js

A high performance web proxy for serving MJPG streams to the masses.
197 stars 38 forks source link

Add stop feature #21

Open defvol opened 10 years ago

defvol commented 10 years ago

WIP

Dayjo commented 10 years ago

I have been trying to test stopping and starting. Stopping seems to work fine, however restarting doesn't.

I'm doing the following;

paparazzo.on "update", (image) =>
    updatedImage = image
    count++
    console.log count
    if count is 10
      paparazzo.stop()
      setTimeout paparazzo.start, 2000

and receive the following error when the start function runs;

http.js:1839
  if (options.protocol && options.protocol !== 'http:') {
             ^
TypeError: Cannot read property 'protocol' of undefined
    at Object.exports.request (http.js:1839:14)
    at Object.exports.get (http.js:1847:21)
    at Paparazzo.start [as _onTimeout] (/paparazzo/src/paparazzo.coffee:36:27)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

Neither @options or emitter are working in the scope when the function is run for a second time

@ returns the following in the paparazzo start function; { _idleTimeout: 2000, _idlePrev: null, _idleNext: null, _idleStart: 1394498719169, _onTimeout: [Function], _repeat: false }