Automatically Refresh MJPEG Streams on Resume

Branching off the discussion in a separate thread related to iOS errors occurring after the device auto-locks and is subsequently unlocked.

@josh I think you were right about updating the iOS - I tried loading the dashboard on my iPhone 15 which has 17.1.1 and indeed the same issue presents itself there:

Assuming there is not some existing custom code that could be entered in the theme that would automatically execute that RELOAD action that’s shown on the pop-up?

Thanks

No, it’s a new feature in preparation for our next-generation realtime connection, but ideally you shouldn’t see the ‘Background worker disconnected’ message at all.

As noted in the other thread, I suspect the underlying reason for seeing the ‘Background worker disconnected’ thread and the streams stopping could be related.

In the other post, you mentioned having the option set to refresh the media items. Are you referring to the ‘Auto refresh’ setting within the media item? If so, what is the refresh interval you have set? And is the ‘force refresh’ setting enabled too?

As a test, can you try editing the media tile instance on your dashboard and configure the ‘Action’ to ‘Refresh’? I’m curious if you tap that when the media items aren’t loaded if it will kick start them again.

This is how the media tiles are currently configured.

Okay I am going to make a copy of the dashboard that I can safely tinker around with, and change the action of a couple of the tiles to refresh and see what that does. Be back shortly.

1 Like

Same result, the two tiles that I changed the action to refresh as well as the others that I left alone were timed out (and the same Background Worker Disconnected error message showed up).

I tried that once with just the iPad, and also tested it a second time with the dashboard open on my PC throughout the time that it took for the iPad to go to sleep and then unlock. The cameras on the PC continued on forever, and the same result was had on the iPad.

And after they timed out, did you try tapping the tile so it would kick off the refresh action?

yes, tapping on the tile immediately refreshed the tile that i tapped. coincidentally, about 10-15 seconds later all the other tiles refreshed as well (including the ones that i didn’t modify or tap).

Tried it a second time, and only the tile that I tapped refreshed. So wasn’t able to reproduce the remaining tiles also subsequently refreshing consistently.

Also tried un-checking the “Force refresh” option - no change.

I have an idea on how we can improve things. It seems like a bug to me that Safari doesn’t automatically resume the MJPEG stream if it was responsible for stopping it in the first place.

I’m thinking we might be able to detect when Safari reopens and refresh the streams in that case. Of course, there may be other implications of it and some people might not want Media Items to refresh whenever they resume their browsing session (especially on devices that aren’t impacted by this bug), so I’ll need to think through it a bit more.

In the meantime, I’ve renamed the topic title and moved this into the Feature Requests section so we can better track the enhancement request.

Perhaps creating a second type of media tile so that there are two different options that people could use, one that functions as it currently does today and another that has the ability to detect safari re-opening and forces the refresh.

Also, not sure how relevant this is, but immediately when the iPad is unlocked you can still see the images on the cameras for a split second before they turn into that question mark icon. I was trying to determine if that was a live image for that split second, or more likely - a stale image from when the iPad went to sleep. So I let the iPad go to sleep, and then moved one of my PTZ cameras so that it would be looking at something else. This way, when I unlocked the iPad I’d be able to tell (based on what I could see in that split second) whether it was a live image or from when the iPad went to sleep. As I suspected, it was a stale image from before the iPad went to sleep and I moved the PTZ camera.

Not sure if that helps narrow down the timing of where things are going wrong currently.

1 Like