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
+8 -5
View File
@@ -39,11 +39,14 @@ export function useVoiceAudio() {
currentSource = source
playing.value = true
source.onended = () => {
playing.value = false
currentSource = null
}
source.start(0)
return new Promise<void>((resolve) => {
source.onended = () => {
playing.value = false
currentSource = null
resolve()
}
source.start(0)
})
}
function stop(): void {