fix(tts): play() must return a promise that resolves when audio finishes

Without this, await audio.play() resolves immediately after source.start(),
so the playQueue chains the next sentence before the current one finishes,
causing overlapping / interrupted playback.
This commit is contained in:
2026-04-03 14:21:44 -04:00
parent c81a499e6e
commit 0a913045a8
@@ -39,11 +39,14 @@ export function useVoiceAudio() {
currentSource = source currentSource = source
playing.value = true playing.value = true
return new Promise<void>((resolve) => {
source.onended = () => { source.onended = () => {
playing.value = false playing.value = false
currentSource = null currentSource = null
resolve()
} }
source.start(0) source.start(0)
})
} }
function stop(): void { function stop(): void {