From 3a4a2fd7e1a05972f50669ba6bf1e7f3c2e15d34 Mon Sep 17 00:00:00 2001 From: ThaUnknown <6506529+ThaUnknown@users.noreply.github.com> Date: Wed, 21 Aug 2024 00:00:23 +0200 Subject: [PATCH] fix: trailer on website --- web/src/lib/components/PreviewCard.svelte | 28 +++++++++-------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/web/src/lib/components/PreviewCard.svelte b/web/src/lib/components/PreviewCard.svelte index 23a5fa1d..ced58d27 100644 --- a/web/src/lib/components/PreviewCard.svelte +++ b/web/src/lib/components/PreviewCard.svelte @@ -20,9 +20,6 @@ } const playButtonText = getPlayButtonText(media) - function volume (video) { - video.volume = 0.1 - } let muted = true function toggleMute () { muted = !muted @@ -31,19 +28,19 @@ function play () { open('miru://anime/' + media.id) } - function lazyload (video) { + function lazyload (iframe) { if ('IntersectionObserver' in window) { const lazyVideoObserver = new IntersectionObserver(entries => { for (const { target, isIntersecting } of entries) { if (isIntersecting) { - video.src = video.dataset.src + iframe.src = iframe.dataset.src lazyVideoObserver.unobserve(target) } } }) - lazyVideoObserver.observe(video.parentNode) + lazyVideoObserver.observe(iframe.parentNode) } else { - video.src = video.dataset.src + iframe.src = iframe.dataset.src } } @@ -55,18 +52,15 @@
{muted ? 'volume_off' : 'volume_up'}
-