aboutsummaryrefslogtreecommitdiff
path: root/src/component/VideoAuto.astro
blob: 38282f69e42264a8cf9e63065814aacc871ed138 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
const { src } = Astro.props;
---

<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>