feat: add video loop playback setting

Add a toggle in General Settings to enable/disable video loop playback,
following the same pattern as the existing autoplay setting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
codytseng 2026-02-18 13:55:53 +08:00
parent ae8a534103
commit 481603d0e8
23 changed files with 90 additions and 19 deletions

View file

@ -46,6 +46,7 @@ class LocalStorageService {
private accountFeedInfoMap: Record<string, TFeedInfo | undefined> = {}
private mediaUploadService: string = DEFAULT_NIP_96_SERVICE
private autoplay: boolean = true
private videoLoop: boolean = false
private translationServiceConfigMap: Record<string, TTranslationServiceConfig> = {}
private mediaUploadServiceConfigMap: Record<string, TMediaUploadServiceConfig> = {}
private dismissedTooManyRelaysAlert: boolean = false
@ -136,6 +137,7 @@ class LocalStorageService {
window.localStorage.getItem(StorageKey.MEDIA_UPLOAD_SERVICE) ?? DEFAULT_NIP_96_SERVICE
this.autoplay = window.localStorage.getItem(StorageKey.AUTOPLAY) !== 'false'
this.videoLoop = window.localStorage.getItem(StorageKey.VIDEO_LOOP) === 'true'
const translationServiceConfigMapStr = window.localStorage.getItem(
StorageKey.TRANSLATION_SERVICE_CONFIG_MAP
@ -475,6 +477,15 @@ class LocalStorageService {
window.localStorage.setItem(StorageKey.AUTOPLAY, autoplay.toString())
}
getVideoLoop() {
return this.videoLoop
}
setVideoLoop(videoLoop: boolean) {
this.videoLoop = videoLoop
window.localStorage.setItem(StorageKey.VIDEO_LOOP, videoLoop.toString())
}
getTranslationServiceConfig(pubkey?: string | null) {
return this.translationServiceConfigMap[pubkey ?? '_'] ?? { service: 'jumble' }
}