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

@ -6,7 +6,7 @@ import { useEffect, useRef, useState } from 'react'
import ExternalLink from '../ExternalLink'
export default function VideoPlayer({ src, className }: { src: string; className?: string }) {
const { autoplay } = useContentPolicy()
const { autoplay, videoLoop } = useContentPolicy()
const { muteMedia, updateMuteMedia } = useUserPreferences()
const [error, setError] = useState(false)
const videoRef = useRef<HTMLVideoElement>(null)
@ -79,6 +79,7 @@ export default function VideoPlayer({ src, className }: { src: string; className
ref={videoRef}
controls
playsInline
loop={videoLoop}
className={cn('max-h-[80vh] rounded-xl border sm:max-h-[60vh]', className)}
src={src}
onClick={(e) => e.stopPropagation()}