【发布时间】:2015-10-05 18:38:25
【问题描述】:
我正在开发一个应用程序,该应用程序可以从用户那里获取输入语音,并且根据句子的不同,视频可以正常工作......但是视频每次只播放一个视频
public void onActivityResult(int request_code , int result_code , Intent i){
super.onActivityResult(request_code, result_code, i);
MediaController mediaController= new MediaController(this);
mediaController.setAnchorView(resultvid);
resultvid.setMediaController(mediaController);
CharSequence h1 = "hello";
CharSequence h2 = "i";
CharSequence h3 = "want";
CharSequence h4 = "water";
CharSequence h5 = "thank you";
switch (request_code){
case 100: if(result_code == RESULT_OK && i != null ){
ArrayList<String> result = i.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
resultTEXT.setText(result.get(0));
if (String.valueOf(result).contains(h1)) {
} else if (String.valueOf(result).contains(h2)) {
resultvid.setVideoPath("file:///storage/sdcard0/srtosl/me.mp4");
} else if (String.valueOf(result).contains(h3)) {
resultvid.setVideoPath("file:///storage/sdcard0/srtosl/want.mp4");
} else if (String.valueOf(result).contains(h4)) {
resultvid.setVideoPath("file:///storage/sdcard0/srtosl/water.mp4");
} else if (String.valueOf(result).contains(h5)) {
resultvid.setVideoPath("file:///storage/sdcard0/srtosl/thankyou.mp4");
}
resultvid.start();
break;
}
}
如果用户输入“我要水”,我需要所有视频一个一个播放。 谢谢
【问题讨论】:
标签: android video android-videoview