|
|
|
@ -101,7 +101,7 @@ public class WebViewActivity extends BaseActivity { |
|
|
|
static final int TYPE_HINT_PASSWORD = 3;//隐藏密码输入框
|
|
|
|
static final int TYPE_START_SERVER = 4;//重新启动web服务
|
|
|
|
static String HtmlUrl = "http://127.0.0.1:8080/index.html";//webServer服务地址 http://192.168.1.218:5173/
|
|
|
|
//static String HtmlUrl = "http://192.168.1.218:5173/";
|
|
|
|
//static String HtmlUrl = "http://192.168.1.196:5500/index.html";
|
|
|
|
int time = 0; |
|
|
|
private VideoView currentVideo; |
|
|
|
SocketClient localSocketClient; |
|
|
|
@ -190,10 +190,15 @@ public class WebViewActivity extends BaseActivity { |
|
|
|
binding.bgVideo.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { |
|
|
|
@Override |
|
|
|
public void onPrepared(MediaPlayer mp) { |
|
|
|
mp.setLooping(true); // 可选:设置循环播放
|
|
|
|
if(isplay){ |
|
|
|
binding.bgVideo.start(); |
|
|
|
} |
|
|
|
mp.setLooping(true); // 可选:设置循环播
|
|
|
|
binding.bgVideo.start(); |
|
|
|
} |
|
|
|
}); |
|
|
|
binding.bgVideo.setOnErrorListener(new MediaPlayer.OnErrorListener() { |
|
|
|
@Override |
|
|
|
public boolean onError(MediaPlayer mp, int what, int extra) { |
|
|
|
LoggerUtil.e("changeVideo: ","bgVideo 播放失败"); |
|
|
|
return true; // 返回true表示已处理,不会弹出系统默认提示
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
@ -204,6 +209,14 @@ public class WebViewActivity extends BaseActivity { |
|
|
|
@Override |
|
|
|
public void onPrepared(MediaPlayer mp) { |
|
|
|
mp.setLooping(true); |
|
|
|
binding.helloVideo.start(); |
|
|
|
} |
|
|
|
}); |
|
|
|
binding.helloVideo.setOnErrorListener(new MediaPlayer.OnErrorListener() { |
|
|
|
@Override |
|
|
|
public boolean onError(MediaPlayer mp, int what, int extra) { |
|
|
|
LoggerUtil.e("changeVideo: ","helloVideobo 播放失败"); |
|
|
|
return true; // 返回true表示已处理,不会弹出系统默认提示
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
@ -214,6 +227,14 @@ public class WebViewActivity extends BaseActivity { |
|
|
|
@Override |
|
|
|
public void onPrepared(MediaPlayer mp) { |
|
|
|
mp.setLooping(true); |
|
|
|
binding.speekVideo.start(); |
|
|
|
} |
|
|
|
}); |
|
|
|
binding.speekVideo.setOnErrorListener(new MediaPlayer.OnErrorListener() { |
|
|
|
@Override |
|
|
|
public boolean onError(MediaPlayer mp, int what, int extra) { |
|
|
|
LoggerUtil.e("changeVideo: ","speekVideo 播放失败"); |
|
|
|
return true; // 返回true表示已处理,不会弹出系统默认提示
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
@ -241,12 +262,12 @@ public class WebViewActivity extends BaseActivity { |
|
|
|
} |
|
|
|
|
|
|
|
// 新视频淡入动画
|
|
|
|
AlphaAnimation fadeIn = new AlphaAnimation(0f, 1f); |
|
|
|
AlphaAnimation fadeIn = new AlphaAnimation(0.3f, 1f); |
|
|
|
fadeIn.setDuration(300); |
|
|
|
fadeIn.setFillAfter(true); |
|
|
|
// 旧视频淡出动画
|
|
|
|
AlphaAnimation fadeOut = new AlphaAnimation(1f, 0f); |
|
|
|
fadeOut.setDuration(300); |
|
|
|
AlphaAnimation fadeOut = new AlphaAnimation(1f, 0.5f); |
|
|
|
fadeOut.setDuration(150); |
|
|
|
fadeOut.setFillAfter(true); |
|
|
|
fadeOut.setAnimationListener(new Animation.AnimationListener() { |
|
|
|
@Override |
|
|
|
@ -254,18 +275,18 @@ public class WebViewActivity extends BaseActivity { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onAnimationEnd(Animation animation) { |
|
|
|
currentVideo.pause(); |
|
|
|
currentVideo.setVisibility(View.GONE); |
|
|
|
currentVideo.clearAnimation(); |
|
|
|
currentVideo = nextVideo; |
|
|
|
currentVideo.start(); |
|
|
|
} |
|
|
|
@Override |
|
|
|
public void onAnimationRepeat(Animation animation) {} |
|
|
|
}); |
|
|
|
// 执行切换
|
|
|
|
currentVideo.pause(); |
|
|
|
nextVideo.setVisibility(View.VISIBLE); |
|
|
|
nextVideo.startAnimation(fadeIn); |
|
|
|
nextVideo.start(); |
|
|
|
currentVideo.startAnimation(fadeOut); |
|
|
|
} |
|
|
|
|
|
|
|
@ -455,7 +476,14 @@ public class WebViewActivity extends BaseActivity { |
|
|
|
public void startRecord() { |
|
|
|
LoggerUtil.e(TAG,"JS调用了Android的方法:startRecord()"); |
|
|
|
if("sbc".equals(Constant.TTSFac)) { |
|
|
|
localSocketClient.send(StringUtil.strSplice("{\"method\":\"/tts/stop\"}")); |
|
|
|
localSocketClient.send(StringUtil.strSplice("{\"method\":\"/asr/start\"}")); |
|
|
|
runOnUiThread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
changeVideo("bg"); |
|
|
|
} |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
if(isrun){ |
|
|
|
return; |
|
|
|
|