Below code is for play remote video of mine:
Uri uri = Uri.parse(URLPath);
vv.setVideoURI(uri);
vv.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
//play next one
}
});
vv.setOnErrorListener(new OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
return false;
}
});
It works for most of my devices.
But it does not works in some devices(Such as Samsung Galaxy S2).
I get the error code Error (200,-82).
I found it is MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK.
What did it mean?
And how to avoid it?
MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK as doc says :
The MediaPlayer often change to error state when playing video,and then prompt “can’t play this video” dialog, so you have to handle these error via remembering the played time and replaying video after reset MediaPlayer engine.
You can implement
OnErrorListenerin your code for handling this type of errors as: