VideoView 播放资源目录raw下的视频

你把影片copy到res/raw下!檔名小寫加底線,例如:default_video.3gp,在程式碼裡指定uri路徑

String uri = "android.resource://" + getPackageName() + "/" + R.raw.default_video。

 String uri = "android.resource://" + getPackageName() + "/" + R.raw.welcome_video;
        logo_video.setVideoURI(Uri.parse((uri)));
        logo_video.setMediaController(new MediaController(LoginLogoActivity.this));  //添加控制台
        logo_video.requestFocus();  //获取焦点
//监听播完了重播 logo_video.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaPlayer) { logo_video.start(); } }); logo_video.start();
posted @ 2016-05-12 13:11  一点点征服  阅读(5178)  评论(0编辑  收藏  举报