This commit is contained in:
parent
fcba21d708
commit
9670a54747
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听到文本数据改变
|
// 监听到文本数据改变
|
||||||
|
|
Loading…
Reference in New Issue