"use client"; import { useAudioPlayer } from "@/hooks/useAudioPlayer"; interface AudioPlayerProps { audioUrl: string | null; } function formatTime(seconds: number): string { if (!isFinite(seconds) || isNaN(seconds)) return "0:00"; const m = Math.floor(seconds / 60); const s = Math.floor(seconds % 60); return `${m}:${s.toString().padStart(2, "0")}`; } export default function AudioPlayer({ audioUrl }: AudioPlayerProps) { const { isPlaying, currentTime, duration, volume, toggle, seek, setVolume } = useAudioPlayer(audioUrl); if (!audioUrl) return null; const progress = duration > 0 ? (currentTime / duration) * 100 : 0; const handleDownload = () => { const a = document.createElement("a"); a.href = audioUrl; a.download = "vibepod-output.wav"; a.click(); }; return (