以下是我一直在处理的代码,它只播放视频,我需要在单个视频中播放多个视频。或者任何想法如何以其他方式?
protected void onCreate(Bundle savedInstanceState) {
// list of mp4 files
fileNameList = getFileListfromSDCard();
final VideoView mVideoView2 = (VideoView)findViewById(R.id.videoView);
// as of now it plays single video and repeat it over and over again
String uriPath2 = secStore+"/Videos/test.mp4";
Uri uri2 = Uri.parse(uriPath2);
mVideoView2.setVideoURI(uri2);
mVideoView2.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion( MediaPlayer mp ) {
mVideoView2.start();
}
});
mVideoView2.start();
MediaController mc = new MediaController(this);
mc.setMediaPlayer(mVideoView2);
mVideoView2.setMediaController(mc);
}
答案 0 :(得分:0)
尝试在mVideoView2.start()之前添加这些内容;在onCompletion
uriPath2 = secStore +“/ Videos / test2.mp4”;
uri2 = Uri.parse(uriPath2);
mVideoView2.setVideoURI(URI2);