OliverF / mjpeg-relay

Relays any given MJPEG stream
MIT License
66 stars 23 forks source link

Add idle timeout #26

Open Kartoffel opened 4 years ago

Kartoffel commented 4 years ago

Add a -T flag to specify an optional idle timeout.

If no client connects for T seconds, mjpeg-streamer will disconnect from the source. When a new client connects, they will see a 'connecting' frame until the software connects to the source again.

Implements #3

dermodmaster commented 4 years ago

Very nice work! There is one problem with the /snapshot route: after the server drops the source connection /snapshot will serve the last received image from source (which can be very old if nobody used /stream before) instead of establish a new connection and getting a fresh image.

Kartoffel commented 4 years ago

Thank you. I could add a workaround so it connects and fetches a new frame, but there's no clear nice way to do this at the moment and it might take seconds to respond to a single request. IMO it's better to check if the last frame is stale, and display a placeholder "not connected" image when a snapshot is requested and mjpeg-relay is not connected to the camera. Does that suit your use case?