2

In an ASP.NET MVC application I'm playing a video in a loop using this code:

<video id="video" name="media" class="container" preload="auto" autoplay loop   controls>
        <source src="@Model.VideoFilename" type="video/mp4">
        Your browser does not support HTML5 video.
</video>

It works, but the problem is that the video is being downloaded from the server on each iteration.

The page hosting this video has this:

Cache-Control:private, max-age=432000

The video file itself doesn't have any Cache-Control header in the response:

enter image description here

How do I enable caching of this video?

EDIT I have added a web.config file to the folder containing the video and added

<clientCache cacheControlMaxAge="07.00:00:00" cacheControlMode="UseMaxAge" />

it added Cache-Control to the response, but the behavior didn't change.

EDIT 2 After trying several solutions which didn't work I ended up using this solution: https://stackoverflow.com/a/18294706/500105 which in my scenario worked good.

Community
  • 1
  • 1
SuperFrog
  • 7,631
  • 9
  • 51
  • 81

0 Answers0