This commit is contained in:
weipengfei 2023-10-13 21:42:43 +08:00
parent fcba21d708
commit 9670a54747
1 changed files with 13 additions and 10 deletions

View File

@ -110,10 +110,11 @@ 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){
for(let i=ttsList.length;i<tts.length;i++){
let res = await http(tts[i]) let res = await http(tts[i])
const a = new Audio(res.data.mp3) const a = new Audio(res.data.mp3)
a.addEventListener('ended', () => { a.addEventListener('ended', () => {
@ -123,6 +124,8 @@ async function loadTTS(){
if (i == 0) if (i == 0)
playAudio() playAudio()
} }
ttsList = tts;
}
} }
// //