MJPEG Camera - Solution for ad-hoc stream?

Hi there! :slight_smile:

I am building a RPi doorbell and, apart from the SIP integration (another thread), I would like to be able to capture a video image when someone rings. After a specific amount of time, or when the SIP call ends, I would like to terminate the video feed.
Please note that I am not able to send video via the SIP, so I have setup a picamera2 python script that gets invoked when I detect the GPIO event.

Using the MJPEG Camera integration, I can get image just fine. The problem is what happens when the stream is terminated.

  1. The image gets stuck in the last frame that was streamed
  2. It doesn’t seem that there’s a if then else mechanism, so that the stream is not available it would use the static image
  3. In these situations, if the stream is resumed, I have to force a refresh in the browser, or the companion app.
    3.1. Actually, in the companion app, it seems that after 60 seconds it resumes the new stream, but I need to first change into a new section and then come back.

Is it possible to modify the timeout of a retry? Is it possible to switch to the static image if the stream is no longer available?

I’ve tried configuring the camera in “auto” vs “live”, but in auto in never shows the feed, unless I click on the image, which opens a popup with the stream (not necessarily a bad solution or workaround). And in the live mode, it gets stuck, as mentioned above.

Thanks for your insights and suggestions :smiley: