"use client"; import React, { useState } from "react"; import { Download, X } from "lucide-react"; export function VideoPreview({ src, alt }: { src: string; alt?: string }) { const [isOpen, setIsOpen] = useState(false); const handleDownload = async () => { try { const response = await fetch(src); const blob = await response.blob(); const url = window.URL.createObjectURL(blob); const link = document.createElement("a"); link.href = url; link.download = `generated-video-${Date.now()}.mp4`; document.body.appendChild(link); link.click(); document.body.removeChild(link); window.URL.revokeObjectURL(url); } catch (error) { console.error("下载失败:", error); } }; return ( <> {/* 视频预览 */}