从模拟器2.2的sdcard播放mp4

时间:2010-10-07 13:08:20

标签: android-emulator

公共类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();

}

1 个答案:

答案 0 :(得分:0)

检入设备。我相信它有效。