标签:mystra android videoview apidemos 播放视频
本文地址: http://blog.csdn.net/caroline_wendy
在Android SDK中的ApiDemos内, 提供标准播放视频的代码,使用VideoView实现简单的视频播放功能.
代码如下:
public class VideoViewDemo extends Activity { /** * TODO: Set the path variable to a streaming video URL or a local media * file path. */ private VideoView mVideoView; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.videoview); mVideoView = (VideoView) findViewById(R.id.surface_view); /* * Alternatively, you can use mVideoView.setVideoPath(<path>); */ mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.videoviewdemo)); mVideoView.setMediaController(new MediaController(this)); mVideoView.requestFocus(); } }
标签:mystra android videoview apidemos 播放视频
原文地址:http://blog.csdn.net/caroline_wendy/article/details/41142313