import { useState, useRef } from "react"; import type { VideoDetail } from "../types/video"; import { formatRunTime } from "../api/client"; export default function VideoPlayer({ video }: { video: VideoDetail }) { const [loaded, setLoaded] = useState(false); const [error, setError] = useState(false); const videoRef = useRef(null); return (
{} {!loaded && !error && (
{video.thumbnailUrl && ( )}
Loading video…
)} {} {error && (
{video.thumbnailUrl && ( )}
Failed to load video
)}
.mtv replay {formatRunTime(video.runTime)}
); }