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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user