5

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();
        }
   });
WHOATEMYNOODLES
  • 845
  • 9
  • 25
  • Is `onPrepared` called? Did you see https://stackoverflow.com/questions/28566268/mediaplayer-wont-loop-setlooping-doesnt-work and https://stackoverflow.com/questions/17461025/why-does-mediaplayer-setlooping-cause-an-error-when-using-videoview? – CoolMind Dec 22 '19 at 21:54
  • Yes it was being fired. But anyways, Videoview's mediaplayer oninfolistener was also not being fired to due a bug https://stackoverflow.com/questions/12882815/android-videoview-mediaplayer-oninfolistener-events-not-fired and that causes issues. So I ended up changing the entire videoview to Exoplayer which is SO MUCH better. It wont let me close this question though – WHOATEMYNOODLES Dec 23 '19 at 03:45
  • That's right. Then you can write your answer here and accept it after some time. – CoolMind Dec 23 '19 at 07:35

1 Answers1

0

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

WHOATEMYNOODLES
  • 845
  • 9
  • 25