fix: autoplay video only when on screen (#624)

pull/626/head
Joaquín Sánchez 2022-12-29 00:13:20 +01:00 zatwierdzone przez GitHub
rodzic 4787250df0
commit 121c90fc3a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -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 })
</script>
<template>