diff options
author | tdro <tdro@noreply.example.com> | 2024-01-13 20:33:21 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2024-01-13 20:33:21 -0500 |
commit | e3f2fd696060de3d6f70c6eab77bd5d358c82c87 (patch) | |
tree | 08611d5db03e8d0089c854b79e9262a354616856 /static | |
parent | 8b53662def693a97ee5e0b5697841cf7859b6704 (diff) | |
download | canory-e3f2fd696060de3d6f70c6eab77bd5d358c82c87.tar.gz canory-e3f2fd696060de3d6f70c6eab77bd5d358c82c87.tar.bz2 canory-e3f2fd696060de3d6f70c6eab77bd5d358c82c87.zip |
static/js/autoplay: Set attributes
Some browsers only understand attributes
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) { |