I used video view to play video from sdcard
VideoView videoView = (VideoView) findViewById(R.id.videoView1);
videoView.setVideoPath(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Download/"+"hanhdong.mp4");
videoView.setMediaController(new MediaController(this));
videoView.start();
but when i run ,I have a error that media server died . MediaPlayer Error (100,0). Please help me.Thank you!
You can add a error listener to video view
videoView.setOnErrorListener(this);
Then you can handle the errors gracefully in onError like
public boolean onError(MediaPlayer mp, int what, int extra)
{
if (what == 100)
{
videoView.stopPlayback();
Intent intent = new Intent(context,ActivityToStart.class);
startActivity(intent);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.