fix: autoplay video only when on screen (#624)
parent
4787250df0
commit
121c90fc3a
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue