Fix Firefox streaming: use browser-detected format instead of hardcoded mp3

This commit is contained in:
russell@unturf.com 2026-01-27 09:51:24 -05:00
parent 4ae6b4fbbd
commit 46048a3251

View file

@ -149,9 +149,8 @@ export async function speakTextStreaming(text, voice = "alloy", rate = 0.9, mode
// Determine if we can use MediaSource for true streaming
const mseMime = AUDIO_FORMAT.mseMime;
const canStream = mseMime && window.MediaSource && MediaSource.isTypeSupported(mseMime);
// For streaming via MSE, request mp3 (only format MSE supports well)
// For buffered fallback, use detected format (opus for Firefox)
const requestFormat = canStream ? 'mp3' : AUDIO_FORMAT.format;
// Request the browser's preferred format (mp3 for Chrome, webm for Firefox)
const requestFormat = AUDIO_FORMAT.format;
console.log(`TTS streaming: canStream=${canStream}, format=${requestFormat}, mseMime=${mseMime}`);