feat: added autoplay setting (#1303)
closes https://github.com/elk-zone/elk/issues/1235
This commit is contained in:
parent
33b5947170
commit
126619be92
5 changed files with 13 additions and 1 deletions
|
@ -65,9 +65,11 @@ const video = ref<HTMLVideoElement | undefined>()
|
|||
const prefersReducedMotion = usePreferredReducedMotion()
|
||||
const isAudio = $computed(() => attachment.type === 'audio')
|
||||
|
||||
const enableAutoplay = usePreferences('enableAutoplay')
|
||||
|
||||
useIntersectionObserver(video, (entries) => {
|
||||
const ready = video.value?.dataset.ready === 'true'
|
||||
if (prefersReducedMotion.value === 'reduce') {
|
||||
if (prefersReducedMotion.value === 'reduce' || !enableAutoplay.value) {
|
||||
if (ready && !video.value?.paused)
|
||||
video.value?.pause()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue