@finsweet/attributes-autovideo

Auto-play videos only in viewport.

Usage no npm install needed!

<script type="module">
  import finsweetAttributesAutovideo from 'https://cdn.skypack.dev/@finsweet/attributes-autovideo';
</script>

README

autovideo Attribute

Auto-play videos only in viewport.

The script detects all videos on the page (Background Video components & <video> elements used in HTML Embeds) and plays/pauses them based on if they are visible in the viewport.

CDN Import

<!-- [Attributes by Finsweet] CMS Display Values -->
<script defer src="https://cdn.jsdelivr.net/npm/@finsweet/attributes-autovideo@1/autovideo.js"></script>