'use client' import { useState } from 'react' import Image from 'next/image' import { cn, extractYouTubeId, getPrivacyYouTubeUrl, getYouTubeThumbnail } from '@/lib/utils' import type { VideoBlock as VideoBlockType } from '@/lib/types' type VideoBlockProps = Omit export function VideoBlock({ title, videoUrl, thumbnailImage, aspectRatio = '16:9', }: VideoBlockProps) { const [isPlaying, setIsPlaying] = useState(false) const videoId = extractYouTubeId(videoUrl) const thumbnailUrl = thumbnailImage?.url || (videoId ? getYouTubeThumbnail(videoId) : null) const embedUrl = videoId ? getPrivacyYouTubeUrl(videoId) : null const aspectClasses = { '16:9': 'aspect-video', '4:3': 'aspect-[4/3]', '1:1': 'aspect-square', } if (!embedUrl) { return null } return (
{title && (

{title}

)}
{isPlaying ? (