Seems like a simple thing to do, but I haven't been able to find a solution
Standard HTML file calling video tag
I want to automate an upload with a new(er) movie with the same name to replace the file
However, the browser will continue to play the cached file even when the page is refreshed
I would like to be able to possibly append the filename with Date.now() to differentiate it and make the browser call the file again using Javascript. I have been able to do this with images, but not with the video.
My Image Code that works:
With this, I can hotswap an image and it refreshes at the designated interval (1 sec here) without a page refresh. With the video, I don't even need hotswapping, I just want to be able to upload a new video with the same name, refresh the page and have the new video play instead of the cached video.
I've Googled a lot of partial and/or vague solutions, but nothing definitive that meets what I am trying to do. Seems simple, but I am out of ideas.
Thoughts?
Standard HTML file calling video tag
Code:
<video width="1920" height "1080" autoplay loop src="movie.mp4">
I want to automate an upload with a new(er) movie with the same name to replace the file
However, the browser will continue to play the cached file even when the page is refreshed
I would like to be able to possibly append the filename with Date.now() to differentiate it and make the browser call the file again using Javascript. I have been able to do this with images, but not with the video.
My Image Code that works:
Code:
<script language="javascript">
function updateImage() {
obj = document.imagename;
obj.src = obj.src.split("?")[0] + "?" + Date.now();
setTimeout("updateImage()",1000);
</script>
<body onload="updateImage();">
<img name="imagename" src="image.png" />
With this, I can hotswap an image and it refreshes at the designated interval (1 sec here) without a page refresh. With the video, I don't even need hotswapping, I just want to be able to upload a new video with the same name, refresh the page and have the new video play instead of the cached video.
I've Googled a lot of partial and/or vague solutions, but nothing definitive that meets what I am trying to do. Seems simple, but I am out of ideas.
Thoughts?