diff --git a/src/components/sections/VideoSection.tsx b/src/components/sections/VideoSection.tsx index 7856254..dc4a72a 100644 --- a/src/components/sections/VideoSection.tsx +++ b/src/components/sections/VideoSection.tsx @@ -4,7 +4,8 @@ import { useState } from 'react' import type { Media } from '@/types/globals' -const IMG_POSTER_DEFAULT = '/images/figma/video-preview.webp' +const DEFAULT_MP4 = '/videos/shumiland-reels.mp4' +const DEFAULT_WEBM = '/videos/shumiland-reels.webm' const IMG_PLAY = '/images/figma/btn-video-play.svg' function getMediaUrl(img: Media | string | null | undefined): string | null { @@ -25,32 +26,32 @@ interface VideoSectionProps { } export function VideoSection({ poster, src }: VideoSectionProps) { - const [playing, setPlaying] = useState(false) - const posterUrl = getMediaUrl(poster) ?? IMG_POSTER_DEFAULT + const [ytPlaying, setYtPlaying] = useState(false) + const posterUrl = getMediaUrl(poster) ?? undefined const youtubeEmbed = src ? getYouTubeEmbedUrl(src) : null - return ( -
- Відео про Шуміленд - - {!playing && ( - - )} - - {playing && src && ( -
- {youtubeEmbed ? ( + // If CMS src is a YouTube URL → use click-to-play embed + if (youtubeEmbed) { + return ( +
+ {posterUrl && ( + Відео про Шуміленд + )} + {!ytPlaying && ( + + )} + {ytPlaying && ( +