From e3f2fd696060de3d6f70c6eab77bd5d358c82c87 Mon Sep 17 00:00:00 2001 From: tdro Date: Sat, 13 Jan 2024 20:33:21 -0500 Subject: static/js/autoplay: Set attributes Some browsers only understand attributes --- assets/js/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'assets') diff --git a/assets/js/index.js b/assets/js/index.js index ef35f63..491cf59 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -607,14 +607,19 @@ "DOMContentLoaded" ].forEach(function(event) { self.addEventListener(event, function() { - const videos = document.querySelectorAll("video"); let first = true; + let videos = document.querySelectorAll("video"); for(i = 0; i < videos.length; i++){ videos[i].autoplay = true; videos[i].controls = true; videos[i].loop = true; videos[i].muted = true; videos[i].playsinline = true; + videos[i].setAttribute("autoplay", true); + videos[i].setAttribute("controls", true); + videos[i].setAttribute("loop", true); + videos[i].setAttribute("muted", true); + videos[i].setAttribute("playsinline", true); const onscreen = viewport(videos[i]); if (first && onscreen) { videos[i].play(); -- cgit v1.2.3