I have a VideoView and I am streaming videos from a remote server. Most of the times It would play the videos very smoothly. But sometimes, it displays an error message \"So
The code I used for this:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
vView = (VideoView) findViewById(R.id.videoView1);
vSource = "android.resource://com.domain.android/"
+ R.raw.introductionportrait;
vView.setVideoURI(Uri.parse(vSource));
vView.setOnErrorListener(mOnErrorListener);
vView.requestFocus();
vView.start();
}
private OnErrorListener mOnErrorListener = new OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
// Your code goes here
return true;
}
};