Search code examples
androidandroid-videoview

VideoView is not looping in SDK 19


The Video loops on my tested SDK 27&28 however it doesn't loop on my SDK 19 Real device. Any idea why?

VideoView videoView2 = new VideoView(mContext);
     Uri uri2 = Uri.parse(urlLink);
     videoView2.setVideoURI(uri2);
     videoView2.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
         @Override
           public void onPrepared(MediaPlayer mp) {
           mp.setLooping(true);
           videoView2.start();
        }
   });

Solution

  • Couldn't figure out why the video wasn't looping in SDK 19, but looping on my SDK 28, 29 devices. But ended up switching to Exoplayer because of another bug in videoview that causes onInfoListener to not be fired which ends up causing another issue.

    https://issuetracker.google.com/issues/36964032

    https://code.google.com/archive/p/googletv-issues/issues/2

    After refractoring to Exoplayer everything was working fine