diff --git a/src/ui.js b/src/ui.js index f477093..81da52f 100644 --- a/src/ui.js +++ b/src/ui.js @@ -2290,11 +2290,18 @@ export function openTTSModal() { const result = await speakText(currentText, selectedVoice, selectedSpeed); ttsAudio = result.audio; ttsBlob = result.blob; - playButton.textContent = "Pause Text"; playButton.disabled = false; - // Auto-play the audio - ttsAudio.play(); + // Auto-play the audio (handle browser auto-play policies) + try { + await ttsAudio.play(); + console.log("TTS audio auto-playing"); + playButton.textContent = "Pause Text"; + } catch (error) { + console.log("Auto-play prevented by browser policy:", error.message); + playButton.textContent = "Play Text"; + // Don't throw error, just log it - user can manually click play + } // Add download button if not exists let downloadButton = article.querySelector(".download-btn");