Version 2.0.0

This commit is contained in:
Erik Thiele
2026-04-17 14:06:24 +02:00
parent bd99563892
commit caebdf8eb9
8 changed files with 702 additions and 0 deletions

84
templates/player.html Normal file
View File

@@ -0,0 +1,84 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>CANCOM Simple Signage Player</title>
<style>
html, body {
margin: 0;
padding: 0;
background: black;
width: 100%;
height: 100%;
overflow: hidden;
}
#image, #video {
position: fixed;
inset: 0;
width: 100vw;
height: 100vh;
object-fit: contain;
background: black;
}
</style>
</head>
<body>
<img id="image" hidden>
<video id="video" hidden muted autoplay playsinline></video>
<script>
const files = {{ files | tojson }};
const interval = {{ interval }} * 1000;
const screen = "{{ screen }}";
let index = 0;
let lastHash = null;
const img = document.getElementById("image");
const video = document.getElementById("video");
function isVideo(name) {
return name.toLowerCase().endsWith(".mp4");
}
function showNext() {
if (files.length === 0) return;
const file = files[index];
index = (index + 1) % files.length;
if (isVideo(file)) {
img.hidden = true;
video.hidden = false;
video.src = `/media/${screen}/${file}`;
video.load();
video.play();
} else {
video.pause();
video.hidden = true;
img.hidden = false;
img.src = `/media/${screen}/${file}`;
setTimeout(showNext, interval);
}
}
video.addEventListener("ended", showNext);
async function checkForUpdate() {
const r = await fetch(`/playlist/${screen}/hash`, { cache: "no-store" });
const hash = await r.text();
if (lastHash && hash !== lastHash) location.reload();
lastHash = hash;
}
setInterval(checkForUpdate, 5000);
showNext();
</script>
</body>
</html>