"use client"; import { useEffect, useRef, useState } from "react"; import { synthesizeVoice } from "../lib/api"; type PlaybackState = "idle" | "loading" | "playing" | "unavailable"; interface VoicePlaybackButtonProps { characterId: string; userId: string; text: string; } // P-6:語音播放介面——呼叫 /voice/:characterId/:userId/synthesize 取得合成結果後播放。 // TTS_PROVIDER=mock 回傳的 audioRef 是 `mock://` 佔位字串(非真實音檔),改用計時器模擬播放時長; // 之後接上真實供應商、audioRef 變成可播放網址時走真正的