我正在尝试从 SD 卡播放视频,我已经从 Eclipse 中的 DDMS 视图将视频推送到 mnt/sdcard 文件夹中。但是模拟器屏幕显示空白,没有任何错误。请帮忙。
public class Video extends Activity {
private MediaController mc;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
videoPlayer("mnt/sdcard","bikekid",true);
}
public void videoPlayer(String path, String fileName, boolean autoplay){
//get current window information, and set format, set it up differently, if you need some special effects
getWindow().setFormat(PixelFormat.TRANSLUCENT);
//the VideoView will hold the video
VideoView videoHolder = new VideoView(this);
//MediaController is the ui control howering above the video (just like in the default youtube player).
videoHolder.setMediaController(new MediaController(this));
//assing a video file to the video holder
videoHolder.setVideoURI(Uri.parse(path+"/"+fileName));
//get focus, before playing the video.
videoHolder.requestFocus();
if(autoplay){
videoHolder.start();
}
}
}/// end class