fix: add script that autoplays videos after view transitions as they did

not load in before.
This commit is contained in:
2026-04-08 08:35:40 -04:00
parent ffd0ad8320
commit 9d0e3b86c2

View File

@@ -51,6 +51,20 @@ const {
})(); })();
</script> </script>
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="/rss.xml" /> <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="/rss.xml" />
<script is:inline>
document.addEventListener('astro:page-load', () => {
document.querySelectorAll('video[autoplay]').forEach((video) => {
if (video.readyState >= 2) {
video.play().catch(() => {})
} else {
video.addEventListener('loadeddata', () => {
video.play().catch(() => {})
}, { once: true })
video.load()
}
})
})
</script>
</Head> </Head>
<body> <body>
<div class="flex h-fit min-h-screen w-full max-w-full flex-col gap-y-4 sm:gap-y-6 font-sans overflow-x-hidden"> <div class="flex h-fit min-h-screen w-full max-w-full flex-col gap-y-4 sm:gap-y-6 font-sans overflow-x-hidden">