aboutsummaryrefslogtreecommitdiff
path: root/src/component
diff options
context:
space:
mode:
Diffstat (limited to 'src/component')
-rw-r--r--src/component/VideoAuto.astro11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/component/VideoAuto.astro b/src/component/VideoAuto.astro
index c8b0fe6..38282f6 100644
--- a/src/component/VideoAuto.astro
+++ b/src/component/VideoAuto.astro
@@ -2,6 +2,15 @@
const { src } = Astro.props;
---
-<video muted autoplay loop>
+<video muted loop>
<source src={src} />
</video>
+
+<script>
+ window.addEventListener('load', () => {
+ document.querySelectorAll('video').forEach(video => {
+ if (window.screen.width < 1000) return;
+ video.autoplay = true;
+ });
+ })
+</script>