private void prepareData() {
// 视频文件路径
// final String videopath = "/mnt/sdcard/girl.3gp";
final String videopath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/girl.3gp";
File f = new File(videopath);
if(f.exists()){
mVideoView.setVideoPath(videopath);
mVideoView.start();
// 播放设置
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
// if (progress != null)
// progress.dismiss();
mp.setLooping(true);
}
});
} else {
finish();
return;
}
// mVideoView.setOnCompletionListener(new
// MediaPlayer.OnCompletionListener() {
//
// @Override
// public void onCompletion(MediaPlayer mp) {
// mVideoView.setVideoPath(videopath);
// mVideoView.start();
// }
// });
}
这个是我写的循环播放sd卡里视频的代码