Android: Video View: how to play a video on a loop
Use setLooping(true) on your MediaPlayer instance.
--Edit--
How about using setOnPrepareListener instead of setOnCompletionListener? This gives you access to the MediaPlayer object.
vv.setOnPreparedListener (new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});
You Can take reference form below codes, Where setup_welcome_video is video file.
myVideo = findViewById(R.id.VideoView);
Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.setup_welcome_video);
myVideo.setVideoURI(uri);
myVideo.start();
myVideo.requestFocus();
myVideo.setOnPreparedListener (mp -> mp.setLooping(true));