From 121c90fc3a7673dabbe801c1fa6039b59f1867e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Thu, 29 Dec 2022 00:13:20 +0100 Subject: [PATCH] fix: autoplay video only when on screen (#624) --- components/status/StatusAttachment.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/status/StatusAttachment.vue b/components/status/StatusAttachment.vue index 96f5dfdc..0f947d93 100644 --- a/components/status/StatusAttachment.vue +++ b/components/status/StatusAttachment.vue @@ -66,12 +66,12 @@ useIntersectionObserver(video, (entries) => { return entries.forEach((entry) => { - if (entry.intersectionRatio !== 1 && !video.value!.paused) - video.value!.pause() + if (entry.intersectionRatio <= 0.75) + !video.value!.paused && video.value!.pause() else video.value!.play() }) -}, { threshold: 1 }) +}, { threshold: 0.75 })