Webcam stream stops in iOS

When I access OctoPrint from my iPhone, the webcam stream works as expected.
When I however switch to a different app and back, the stream does not update anymore. This happens when using both Chrome and Safari. Only after a forced refresh the stream works again, until the next switch.

This problem is actually caused by MJPG-Streamer: the demo page shows the same behaviour.
Does anyone know how to resolve this?

Additional information about my setup:

  • OctoPrint Version 1.3.10, running on Raspberry Pi 3B+
  • Pi Cam
  • iOS 12.2
  • MJPG-Streamer v0.1 (Oct 22, 2007)

Webcam support is supplied as part of the OctoPi image rather than OctoPrint itself. And if the underlying mjpg_streamer has the problem then there's not much that we could do.

You might consider opening an issue on the author's repository.

I have created an issue as suggested, with following response:

I'm pretty sure the browser/os will be closing the connection when you switch away from the browser. The stream works by http multipart, once the connection is closed you will need to reload it.

Would it be possible to open a new connection whenever focus is switched to the webcam stream?

Please note that I am using OctoPrint with TouchUI directly from the iOS homescreen. This then acts app-like, but it is not even possible to do a refresh to reestablish a new connection.