Answered: Discussion Open

mjpeg cache control?

Adam 6 years ago in Media Tiles / Video Camera Feeds updated 6 years ago 2

I've been plagued with issues streaming my cameras for a while now, and every now and then I try to do some more investigation to see what I can come up with.

Today I discovered something about Cache Control, and wanted to know if ActionTiles was configured to present media in a format that blocked caching, so that the loading page would never try to open the file from cache, or even store the file to cache.


I'm no expert, so I apologise if I'm going over ground already covered.

when I "curl" the address of my panel, I don't see the suggested content headers (although I know my curl isn't logged in to the panel)



Answered: Discussion Open

Interesting question, Adam.

ActionTiles uses a long-life cache setting for the overall app and resources since it is a "one page" AJAX-type app that updates all front-end information on an as-requested basis.

Media Tiles, however, get their content directly from the specified "http" sources, which will respond with their own cache headers for your browser to follow.

To the best of my knowledge, we do not block caching of these external resources (i.e., resources served from your cameras or other image sources that are not coming from our own cloud / CDN).

I personally have not experienced any caching issues with my video sources. However, if you are accessing 3rd party services like radar weather feeds, for example, they will often reject refresh attempts in order to secure their bandwidth. These resources belong to the 3rd party: not you and not ActionTiles.

Make sense?



It does make sense, but I wonder just how many mjpeg streams are configured not to cache... I know if I curl one of my mjpeg streams, I certainly don't get the no-cache header that is suggested in that blog post, I get :

Content-Type: image/jpeg

Content-Length: 15913

And that's all. 

Looking at the Implementation section of that post, I can see that it's possible to have Java re-write the stream to present the  data with the correct content headers for mjpeg so that it doesn't cache, and it expires immediately. I know with local LAN streams, there's no way that the ActionTiles server can do that (and probably wouldn't want to in bulk), but there must be a way to get AJAX to do it at the time of loading the image/media tile? 

EDIT: https://stackoverflow.com/questions/35130250/what-is-the-correct-way-to-prevent-caching-on-ajax-calls

The point being, If I clear my browser's cache, I get my streams back instantly... but then they eventually go away again... until the cache has expired, and the browser decides it's time to load them again.