-1

I have my app playing a video from my server. Each video has various resolution qualities with links to each resolution. But sometimes there are some wrong links in my server.

How can I know when my VideoView has gotten the wrong link so that I can switch to another link with another resolution quality of the same video. Which event, or exception can I catch?

SBerg413
  • 14,515
  • 6
  • 62
  • 88
Huy Duong Tu
  • 7,798
  • 5
  • 25
  • 46

1 Answers1

1

For your videoView, implement an onErrorListenor and in the onError method, re-initialize your video player with another resolution.

Something like this:

videoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {

        public boolean onError(MediaPlayer mp, int what, int extra) {           
            // In here, call your code to re-initialize the video;
        }
    });
SBerg413
  • 14,515
  • 6
  • 62
  • 88