fix: add script that autoplays videos after view transitions as they did
not load in before.
This commit is contained in:
@@ -51,6 +51,20 @@ const {
|
||||
})();
|
||||
</script>
|
||||
<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>
|
||||
<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">
|
||||
|
||||
Reference in New Issue
Block a user