diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/js/autoplay.ts | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/static/js/autoplay.ts b/static/js/autoplay.ts index 70f372a..5987576 100644 --- a/static/js/autoplay.ts +++ b/static/js/autoplay.ts @@ -12,16 +12,22 @@ ["scroll", "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].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) { |