diff --git a/web/src/lib/components/PreviewCard.svelte b/web/src/lib/components/PreviewCard.svelte index 23a5fa1..ced58d2 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'}
-