This commit is contained in:
parent
fcba21d708
commit
9670a54747
|
@ -110,18 +110,21 @@ const http = (text: any)=>{
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
let ttsList = [];
|
||||||
async function loadTTS(){
|
async function loadTTS(){
|
||||||
let tts = props.tts?JSON.parse(props.tts):[]
|
let tts = props.tts?JSON.parse(props.tts):[]
|
||||||
for(let i=0;i<tts.length;i++){
|
if(tts.length>ttsList.length){
|
||||||
let res = await http(tts[i])
|
for(let i=ttsList.length;i<tts.length;i++){
|
||||||
const a = new Audio(res.data.mp3)
|
let res = await http(tts[i])
|
||||||
a.addEventListener('ended', () => {
|
const a = new Audio(res.data.mp3)
|
||||||
onAudioEnd()
|
a.addEventListener('ended', () => {
|
||||||
})
|
onAudioEnd()
|
||||||
audioElements.push(a)
|
})
|
||||||
if (i == 0)
|
audioElements.push(a)
|
||||||
playAudio()
|
if (i == 0)
|
||||||
|
playAudio()
|
||||||
|
}
|
||||||
|
ttsList = tts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue