Home > front end >  How to achieve speech after end?? Whether one or more
How to achieve speech after end?? Whether one or more

Time:03-03

Var newUrl=[];
Var url="http://tts.baidu.com/text2audio? LAN=zh& Ie=utf-8 & amp; The SPD=3 & amp; Text="+ encodeURI (STR);
The console. The log (" url: "+ url);
NewUrl. Push (url);
The console. The log (" audioUrl - 111: "+ JSON. Stringify (newUrl));
this.audio.srchttps://bbs.csdn.net/topics/="";
This. Audio. onl oadstart=()=& gt; {
//the console. The log (" TTS start: "+ url);
The console. The log (" TTS start: "+ newUrl);
};
This. Audio. AddEventListener (' ended, ()=& gt; {
for(let i=0; I & lt; NewUrl. Length; I++) {
If (newUrl. Length===1) {
This. Audio. SRC=https://bbs.csdn.net/topics/newUrl [0];
//the console. The log (" time: "+ this. Audio. Duration).
//this.audio.srchttps://bbs.csdn.net/topics/="";
} else {
This. Audio. SRC=https://bbs.csdn.net/topics/newUrl [I];
}
}
this.audio.srchttps://bbs.csdn.net/topics/="";
}, false);
This. Audio. The autoplay=true;
//this. Audio. Pause ();
This. Audio. The load ();
I think excuse me I need how to modify the code above, in order to meet the SRC address change of voice broadcast after the speech, end play
?Note: data is multiple, not single
  • Related