diff --git a/components/status/StatusAttachment.vue b/components/status/StatusAttachment.vue index 7d5519f7..c4e60a89 100644 --- a/components/status/StatusAttachment.vue +++ b/components/status/StatusAttachment.vue @@ -65,9 +65,11 @@ const video = ref() 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() diff --git a/composables/settings/definition.ts b/composables/settings/definition.ts index cd050316..68989690 100644 --- a/composables/settings/definition.ts +++ b/composables/settings/definition.ts @@ -8,6 +8,7 @@ export interface PreferencesSettings { hideFavoriteCount: boolean hideFollowerCount: boolean grayscaleMode: boolean + enableAutoplay: boolean experimentalVirtualScroller: boolean experimentalGitHubCards: boolean experimentalUserPicker: boolean @@ -58,6 +59,7 @@ export const DEFAULT__PREFERENCES_SETTINGS: PreferencesSettings = { hideFavoriteCount: false, hideFollowerCount: false, grayscaleMode: false, + enableAutoplay: true, experimentalVirtualScroller: true, experimentalGitHubCards: true, experimentalUserPicker: true, diff --git a/locales/de-DE.json b/locales/de-DE.json index f865209f..f3a3405b 100644 --- a/locales/de-DE.json +++ b/locales/de-DE.json @@ -330,6 +330,7 @@ }, "notifications_settings": "Benachrichtigungen", "preferences": { + "enable_autoplay": "Autoplay aktivieren", "github_cards": "GitHub Cards", "hide_boost_count": "Boost-Zähler ausblenden", "hide_favorite_count": "Favoritenzahl ausblenden", diff --git a/locales/en-US.json b/locales/en-US.json index 779100a0..8300c3c4 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -366,6 +366,7 @@ }, "notifications_settings": "Notifications", "preferences": { + "enable_autoplay": "Enable Autoplay", "github_cards": "GitHub Cards", "grayscale_mode": "Grayscale mode", "hide_boost_count": "Hide boost count", diff --git a/pages/settings/preferences/index.vue b/pages/settings/preferences/index.vue index e2ea0191..0ed9de73 100644 --- a/pages/settings/preferences/index.vue +++ b/pages/settings/preferences/index.vue @@ -39,6 +39,12 @@ const userSettings = useUserSettings() > {{ $t('settings.preferences.grayscale_mode') }} + + {{ $t('settings.preferences.enable_autoplay') }} +

{{ $t('settings.preferences.title') }}