how to show video loop in videoview no android studio

1

I have a videoview in my android application and the background video is set that way

String uri = "android.resource://" + getPackageName() + "/" + R.raw.oceans;
 VideoView mVideoView  = (VideoView)findViewById(R.id.video_login);
 if (mVideoView != null)
 {  mVideoView.setVideoURI(Uri.parse(uri));
     mVideoView.requestFocus();
     mVideoView.start();
 }

How can I make this video looped?

    
asked by anonymous 14.05.2018 / 21:03

1 answer

1

If the video is defined within the activity, the following code snippet works:

mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
            }
        });
    
16.05.2018 / 19:52