'use client'; import React, { useEffect, useRef } from 'react'; import { Radio } from 'lucide-react'; interface Props { hlsUrl?: string; thumbnailUrl?: string; } export default function VideoPlayer({ hlsUrl, thumbnailUrl }: Props) { const videoRef = useRef(null); useEffect(() => { if (!hlsUrl || !videoRef.current) return; const video = videoRef.current; if (video.canPlayType('application/vnd.apple.mpegurl')) { video.src = hlsUrl; return; } import('hls.js').then(({ default: Hls }) => { if (Hls.isSupported()) { const hls = new Hls(); hls.loadSource(hlsUrl); hls.attachMedia(video); return () => hls.destroy(); } }); }, [hlsUrl]); if (!hlsUrl) { return (

Stream offline — no source available

{thumbnailUrl && ( // eslint-disable-next-line @next/next/no-img-element Stream thumbnail )}
); } return (
); }