import Hls from 'hls.js/light'; import { useEffect, useRef } from 'react'; export function VideoPlayer({ src, title, }: { src: string | null; title: string; }) { const videoRef = useRef(null); useEffect(() => { const video = videoRef.current; if (!video || !src) { return; } if (video.canPlayType('application/vnd.apple.mpegurl')) { video.src = src; return; } if (!Hls.isSupported()) { return; } const hls = new Hls(); hls.loadSource(src); hls.attachMedia(video); return () => { hls.destroy(); }; }, [src]); if (!src) { return (
Offline
); } return (