Releases: javaexception/VoiceAnnouncements
Releases · javaexception/VoiceAnnouncements
v1.2
VoiceAnnouncementsLibrary,主要更新了当用户同时推送了多条语音的时候,防止语音重叠。
首先在VoiceUtils类里加了下面代码:
public void SetIsPlay( boolean IsPlaying){
this.IsPlaying=IsPlaying;
}
public boolean GetIsPlay() {
return IsPlaying;
}
然后在语音开始和结束分别设置true和false。
防止重叠的调用:
private synchronized void Play(final String str) {
if (VoiceUtils.with(this).GetIsPlay()){
System.out.println("正在播放语音 ");
new Thread() {
@Override
public void run() {
super.run();
try {
Thread.sleep(100);//休眠0.1秒
Play(str);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
}else {
VoiceUtils.with(this).Play(str,true);
}
}
v1.0
VoiceAnnouncementsLibrary