import { useEffect, useRef } from "react"; interface VideoPlayerModalProps { videoId: string; title: string; onClose: () => void; localVideoPath?: string | null; } export default function VideoPlayerModal({ videoId, title, onClose, localVideoPath }: VideoPlayerModalProps) { const videoRef = useRef(null); useEffect(() => { const handleKey = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); }; document.addEventListener("keydown", handleKey); document.body.style.overflow = "hidden"; return () => { document.removeEventListener("keydown", handleKey); document.body.style.overflow = ""; }; }, [onClose]); useEffect(() => { if (videoRef.current && localVideoPath) { videoRef.current.play().catch(() => {}); } }, [localVideoPath]); return (
e.stopPropagation()} >

{title}

{localVideoPath ? (