Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Under what conditions will the browser cache <video> files?

Under what conditions will the browser cache files? Sometimes it does, sometimes it doesn't. If no one here knows, my next step will be to test the various file format, file size, and htaccess scenarios.

If you don't know, can you think of any other variables that you'd recommend testing?

Thanks in advance!

like image 819
Matrym Avatar asked Feb 24 '11 22:02

Matrym


People also ask

Does browser cache videos?

The cache is a temporary storage location for files that the browser downloads from websites every time you watch a video. So, when you revisit a website, the browser loads the files from the cache, which can save time and bandwidth.

Can videos be cached?

For video-on-demand streaming, in which the video is delivered from storage, caching the video is fairly simple: the CDN requests the stored video from the origin server, the origin server delivers it, and the CDN then caches the video. In live streaming, there is no stored version of the video ready to go.

What files does browser cache?

Browser caching is a process that involves the temporary storage of resources in web browsers. A visitor's web browser downloads various website resources and stores them in the local drive. These include images, HTML files, and JavaScript files.

How does video caching work?

Video caching, like any other type of data caching, temporarily stores frequently accessed videos or video segments close to where viewers are located on the network. Bandwidth optimization occurs because video no longer has to travel the entire length of the corporate network.


1 Answers

The following works to instruct the browser to cache the files. The last line was necessary to make the server deliver webm files with the correct header MIME type.

# Expires is set to a point we won't reach,
# Cache control will trigger first, 10 days after access
# 10 Days = 60s x 60m x 24hrs x 10days =  864,000
<FilesMatch "\.(webm|ogg|mp4)$">
Header set Expires "Mon, 27 Mar 2038 13:33:37 GMT"
Header set Cache-Control "max-age=864000"
</FilesMatch>
AddType video/webm .webm
like image 63
Matrym Avatar answered Sep 19 '22 19:09

Matrym