I have a Raspberry Pi 4 with Raspberry Pi OS installed. I want to use it as a kiosk-Terminal to display some video that will be updated with new information on a regular base. The video file is stored on a network drive that will be mounted under /mnt/Drive_P/.
It’s working well besides the fact that it keeps showing the same video after a refresh, no matter if I replace the mp4-file or even delete it. It always requires a reboot to actually load the new material!
I have the following shell-script in the autostart:
firefox file:///mnt/Drive_P/Kiosk/VideoViewer.html?"Kiosk/Videos/Test.mp4" -kiosk -new-window
And this is the code of my VideoViewer.html
<!DOCTYPE html>
<html>
<head>
<title>VideoViewer</title>
<script>
function BodyOnLoad()
{
var URL = location.href;
var Extension = URL.split("?")[1];
window.setInterval(CheckVideoTimer, 10000);
document.getElementById("VideoPlayerSourceMP4").src="/mnt/Drive_P/" + Extension;
document.getElementById("VideoPlayer").addEventListener('ended', VideoEnded, false);
document.getElementById("VideoPlayer").load();
}
function VideoEnded(e)
{
<!-- Instead of looping the video I want to reload the page so it should load the latest video file again -->
location.reload();
}
function CheckVideoTimer()
{
var Vid = document.getElementById("VideoPlayer");
if ((Vid.paused && (Vid.duration == Vid.currentTime)) || (Vid.readyState == 0))
{
<!-- there is no video-file at the given location, reload and try again -->
location.reload();
}
}
</script>
</head>
<body onload="BodyOnLoad()">
<video id="VideoPlayer" width="100%" height="100%" autoplay preload="none">
<source id="VideoPlayerSourceMP4" src="" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
I found many older threads about reloading a page without cached contents by using “location.reload(true);” but this sadly does not work any longer.