我无法在Android中播放视频

时间:2014-07-26 09:22:44

标签: android android-videoview

“dell_fan_cleaning.mp4”文件位于原始文件夹中,但未在VideoView中加载。这是代码..“

Uri video1 = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.dell_fan_cleaning);
   videoView.setVideoURI(video1);
   videoView.setMediaController(new MediaController(this));
   videoView.requestFocus();
   videoView.start();

1 个答案:

答案 0 :(得分:0)

Uri uri = Uri.parse(URL); //Declare your url here.

VideoView mVideoView  = (VideoView)findViewById(R.id.videoview)
mVideoView.setMediaController(new MediaController(this));       
mVideoView.setVideoURI(uri);
mVideoView.requestFocus();
mVideoView.start();