Browse Source

fix: ci

dejiAi
高志龙 8 months ago
parent
commit
6c76042f53
  1. 2
      app/build.gradle
  2. 18
      app/src/main/java/qianmu/container/activity/H5/WebViewActivity.java

2
app/build.gradle

@ -10,7 +10,7 @@ android {
minSdkVersion 22 minSdkVersion 22
targetSdkVersion 30 targetSdkVersion 30
versionCode 6 versionCode 6
versionName "V2.0.7.33"
versionName "V2.0.7.34"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro' consumerProguardFiles 'consumer-rules.pro'

18
app/src/main/java/qianmu/container/activity/H5/WebViewActivity.java

@ -483,6 +483,7 @@ public class WebViewActivity extends BaseActivity {
@JavascriptInterface @JavascriptInterface
public void startRecord() { public void startRecord() {
LoggerUtil.e(TAG,"JS调用了Android的方法:startRecord()"); LoggerUtil.e(TAG,"JS调用了Android的方法:startRecord()");
try{
if("sbc".equals(Constant.TTSFac)) { if("sbc".equals(Constant.TTSFac)) {
if (localSocketClient == null) initLocalSocketClient(); //------------------------------- if (localSocketClient == null) initLocalSocketClient(); //-------------------------------
localSocketClient.send(StringUtil.strSplice("{\"method\":\"/tts/stop\"}")); localSocketClient.send(StringUtil.strSplice("{\"method\":\"/tts/stop\"}"));
@ -504,6 +505,9 @@ public class WebViewActivity extends BaseActivity {
isrun = true; isrun = true;
} }
} }
}catch (Exception e){
LoggerUtil.e(TAG,e.getMessage());
}
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -515,34 +519,48 @@ public class WebViewActivity extends BaseActivity {
@JavascriptInterface @JavascriptInterface
public void stopRecord() { public void stopRecord() {
LoggerUtil.e(TAG,"JS调用了Android的方法:stopRecord()"); LoggerUtil.e(TAG,"JS调用了Android的方法:stopRecord()");
try{
if("sbc".equals(Constant.TTSFac)) { if("sbc".equals(Constant.TTSFac)) {
if (localSocketClient == null) initLocalSocketClient(); //------------------------------- if (localSocketClient == null) initLocalSocketClient(); //-------------------------------
localSocketClient.send(StringUtil.strSplice("{\"method\":\"/asr/stop\"}")); localSocketClient.send(StringUtil.strSplice("{\"method\":\"/asr/stop\"}"));
}else{ }else{
stopAsr(); stopAsr();
} }
}catch (Exception e){
LoggerUtil.e(TAG,e.getMessage());
}
} }
// h5调用android:开始合成语音 // h5调用android:开始合成语音
@JavascriptInterface @JavascriptInterface
public void startTTS(String txt) { public void startTTS(String txt) {
LoggerUtil.e(TAG,"JS调用了Android的方法:startTTS()"); LoggerUtil.e(TAG,"JS调用了Android的方法:startTTS()");
try{
if("sbc".equals(Constant.TTSFac)) { if("sbc".equals(Constant.TTSFac)) {
if (localSocketClient == null) initLocalSocketClient(); //------------------------------- if (localSocketClient == null) initLocalSocketClient(); //-------------------------------
localSocketClient.send(StringUtil.strSplice("{\"method\": \"/tts/start\",\"params\": {\"text\":\"", txt, "\", \"mode\":\"autoPlay\"}}")); localSocketClient.send(StringUtil.strSplice("{\"method\": \"/tts/start\",\"params\": {\"text\":\"", txt, "\", \"mode\":\"autoPlay\"}}"));
}else{ }else{
ttsUtil.startTTs(txt); ttsUtil.startTTs(txt);
} }
}catch (Exception e){
LoggerUtil.e(TAG,e.getMessage());
}
} }
// h5调用android:停止合成语音 // h5调用android:停止合成语音
@JavascriptInterface @JavascriptInterface
public void stopTTS() { public void stopTTS() {
LoggerUtil.e(TAG,"JS调用了Android的方法:stopTTS()"); LoggerUtil.e(TAG,"JS调用了Android的方法:stopTTS()");
try{
if("sbc".equals(Constant.TTSFac)){ if("sbc".equals(Constant.TTSFac)){
if (localSocketClient == null) initLocalSocketClient(); //------------------------------- if (localSocketClient == null) initLocalSocketClient(); //-------------------------------
localSocketClient.send(StringUtil.strSplice("{\"method\":\"/tts/stop\"}")); localSocketClient.send(StringUtil.strSplice("{\"method\":\"/tts/stop\"}"));
}else{ }else{
ttsUtil.stopTTs(); ttsUtil.stopTTs();
} }
}catch (Exception e){
LoggerUtil.e(TAG,e.getMessage());
}
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {

Loading…
Cancel
Save