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

Loading…
Cancel
Save