[3.2.0][Fix]解决首次安装Tts不播报的问题
This commit is contained in:
@@ -121,6 +121,7 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
|
||||
// 单独的语音播放
|
||||
private boolean mHasAuth;
|
||||
private int retryCount;
|
||||
private volatile boolean isAuthing = false;
|
||||
|
||||
private void initFlushStatus() {
|
||||
if (!mHasFlush) {
|
||||
@@ -130,8 +131,10 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
|
||||
|
||||
@Override
|
||||
public void initTts(String sn) {
|
||||
if (!mHasAuth && sn != null && !sn.isEmpty()) {
|
||||
if (!mHasAuth && sn != null && !sn.isEmpty() && !isAuthing) {
|
||||
initTtsConfig(sn);
|
||||
} else {
|
||||
CallerLogger.INSTANCE.d(TAG, "不满足Tts初始化条件!" + mHasAuth + "," + sn + "," + isAuthing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +166,7 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
|
||||
}
|
||||
|
||||
private void initDUILiteSDK(AuthConfig.Builder onlineBuilder, EchoConfig echoConfig) {
|
||||
isAuthing = true;
|
||||
DUILiteSDK.init(mContext, new DUILiteConfig.Builder()
|
||||
.setApiKey("113cc31f6385113cc31f6385618c86f5")
|
||||
.setProductId("278586132")
|
||||
@@ -177,6 +181,7 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
|
||||
@Override
|
||||
public void success() {
|
||||
CallerLogger.INSTANCE.d(TAG, "授权成功");
|
||||
isAuthing = false;
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
mHasAuth = true;
|
||||
initTtsEngine();
|
||||
@@ -186,6 +191,7 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
|
||||
@Override
|
||||
public void error(String errorCode, final String errorInfo) {
|
||||
CallerLogger.INSTANCE.e(TAG, "error code : " + errorCode + " , error info :" + errorInfo);
|
||||
isAuthing = false;
|
||||
if (retryCount++ < 3) {
|
||||
initDUILiteSDK(onlineBuilder, echoConfig);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user