Reloading video in javascript every minute, but cache is preventing it

42 Views Asked by At

In a directory on server I have a number of videos (mp4 files). Every video is presented on its own web page, and all web pages are controled by javasript file. Videos in source directory change every minute, i.e. new file with a same name overwrites old file. I would like to create javascript that will refresh video on the web page, but it seems that cache is preventing it.

To disable cache, in the head of the webpage I entered:

<meta http-equiv="Cache-Control" content="no">

To reload video every 60 seconds, in the JS I entered:

// to select video and its source
const video = document.querySelector("video");
const videoUrl = video.src

// to reload video every minute
setTimeout( function() {
   video.setAttribute('src', videoUrl);
   video.load();
}, 60000);

However, the video does not refresh on the webpage. Does anyone have an idea how can I resolve this problem?

0

There are 0 best solutions below