diff --git a/components/status/StatusAttachment.vue b/components/status/StatusAttachment.vue index 2c8c7d70..96f5dfdc 100644 --- a/components/status/StatusAttachment.vue +++ b/components/status/StatusAttachment.vue @@ -57,13 +57,33 @@ const type = $computed(() => { } return 'unknown' }) + +const video = ref() +const prefersReducedMotion = usePreferredReducedMotion() + +useIntersectionObserver(video, (entries) => { + if (prefersReducedMotion.value === 'reduce') + return + + entries.forEach((entry) => { + if (entry.intersectionRatio !== 1 && !video.value!.paused) + video.value!.pause() + else + video.value!.play() + }) +}, { threshold: 1 })