我想一个接一个地播放视频。
此代码正常工作但在视频结束时,在开始播放第二个视频之前,我得到空白帧。
<VideoView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/video"
/>
int i = 0; 列出videoPathes = new ArrayList(); 私人VideoView视频;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
videoview = (VideoView) findViewById(R.id.video);
videoPathes.add("http://192.168.1.8/User_files/VID_20130422_124555.3gp");
videoPathes.add("http://192.168.1.8/User_files/VID_20130422_124609.3gp");
videoview.setVideoPath(videoPathes.get(i));
videoview.setMediaController(new MediaController(this));
videoview.start();
videoview.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(final MediaPlayer mp) {
i = (i + 1) % videoPathes.size();
videoview.setVideoPath(videoPathes.get(i));
videoview.start();
}
});