diff --git a/src/components/sections/VideoSection.tsx b/src/components/sections/VideoSection.tsx index 8c51f93..bfdcac9 100644 --- a/src/components/sections/VideoSection.tsx +++ b/src/components/sections/VideoSection.tsx @@ -1,7 +1,7 @@ 'use client' /* eslint-disable @next/next/no-img-element */ -import { useState } from 'react' +import { useRef, useState } from 'react' import type { Media } from '@/types/globals' const DEFAULT_MP4 = '/videos/shumiland-reels.mp4' @@ -27,9 +27,18 @@ interface VideoSectionProps { export function VideoSection({ poster, src }: VideoSectionProps) { const [ytPlaying, setYtPlaying] = useState(false) + const [muted, setMuted] = useState(true) + const videoRef = useRef(null) const posterUrl = getMediaUrl(poster) ?? undefined const youtubeEmbed = src ? getYouTubeEmbedUrl(src) : null + function toggleMute() { + const video = videoRef.current + if (!video) return + video.muted = !video.muted + setMuted(video.muted) + } + // If CMS src is a YouTube URL → use click-to-play embed if (youtubeEmbed) { return ( @@ -69,19 +78,38 @@ export function VideoSection({ poster, src }: VideoSectionProps) { return (
- +
+ + +
)