公共类MainActivity扩展了Activity {
MediaController mediaController;
MediaPlayer mp;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
// Uri uri = Uri.parse("android.resource//org.me.vid_sample/raw/lahainaharbor");
File path = new File("/sdcard/Waileasuntest1.mp4");
VideoView videoView = (VideoView) findViewById(R.id.surface);
videoView.setVideoPath(path.getAbsolutePath());
mediaController = new MediaController(this);
mediaController.setMediaPlayer(videoView);
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.requestFocus();
videoView.start();
}
答案 0 :(得分:0)
检入设备。我相信它有效。