I\'m trying to develop an android application that plays more than one video in one videoview. When one is finished, the second has to start and so on.
My videos are
Try something like that - it works perfect for me.
public class MainActivity extends Activity {
private VideoView videoView = null;
String[] videoArray = {"video1", "video2"};
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Uri videoUri = Uri.parse("android.resource://" + MainActivity.this.getPackageName() + "/raw/" + videoArray[0]);
videoView = (VideoView)findViewById(R.id.videoView);
videoView.setVideoURI(videoUri);
videoView.start();
videoView.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp)
{
Uri videoUri = Uri.parse("android.resource://" + MainActivity.this.getPackageName() + "/raw/" + videoArray[1]);
videoView.setVideoURI(videoUri);
videoView.start();
}
});
}
}