Reputation: 3641
To keep it short.
I have a video which is set to autoplay and loop via attributes in the video tag. It works great- the video gets autoplay in a loop over and over again.
<video autoplay loop>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
</video>
The only weird behaviour is that everytime the video starts over, it is being retreived as GET request as if the video would be loaded for the first time. Can this be prevented ? This results in a huge traffic if a couple of people will be on the website.
Upvotes: 2
Views: 11398
Reputation: 1066
Check your Chrome Dev Tools network settings, you most likely had Disable cache
checked, so with every loop it would fetch the video again.
Upvotes: 1
Reputation: 723
Try to add caching headers to response of video file. Best combination of attributes is ETag + Cache-Control:max-age
Note: Maximum value for max-age is 31536000
When resource expires by age, browser will send conditional request based on ETag value.
Upvotes: 0