I would like to know how to play a video file in my app. Either from the SD-card or from a source like YouTube for example. The video should play in fullscreen mode, and when the video is complete, i want to return to my app. Is there any way to accomplish this?开发者_开发知识库
Thanks!
You can use VideoView inside a LinearLayout
Snippet as follows
PS> I havent included all the userinput and error
VideoView videoView = (VideoView) findViewById(R.id.VideoView01);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
//URI either from net or local
Uri video = Uri.parse("http://yourfavouriteurl/abc.3gp");
Uri video = Uri.parse("android.resource://full.package.name/" + R.raw.yourvideo);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
精彩评论