Skip to content

Commit

Permalink
get slideshow for videos working
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunsi committed Oct 1, 2024
1 parent d23c3cf commit abcea64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
22 changes: 9 additions & 13 deletions static/slideshow.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,27 +102,23 @@ window.setInterval(function() {
if (next_asset['type'] == 'image') {
img = document.createElement("img");
img.onload = function() {
video.stop();
video.style.display = "none";
image.style.display = "none";

image.src = this.src;
image.style.display = "block";
}
img.src = next_asset['url'];
} else /* if (next_asset['type'] == 'video') {
vid = document.createElement("video");
vid.onload = function() {
image.style.display = "none";
video.getElementsByTagName("source")[0].src = this.src;
video.style.display = "block";
video.play();
}
vid.src = next_asset['url'];
} else*/ {
/*
} else if (next_asset['type'] == 'video') {
image.style.display = "none";
video.src = next_asset["url"];
video.style.display = "block";
video.play();
} else {
document.getElementById("slideshow").style.display = "none";
document.getElementById("error").style.display = "block";
document.getElementById("error-text").innerHTML = "unknown asset type " + next_asset["type"];
*/

console.warn("unknown asset type " + next_asset["type"] + " for asset " + next_asset["url"]);
}
}, 10000);
3 changes: 1 addition & 2 deletions templates/slideshow.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
<body>
<div id="slideshow">
<img src="" id="slideshow-image">
<video id="slideshow-video" autoplay muted loop>
<source src="">
<video src="" id="slideshow-video" autoplay muted loop controls>
</video>
</div>
<div id="error">
Expand Down

0 comments on commit abcea64

Please sign in to comment.