[code snippet]
public void playVideo(final String video_url) {
runOnUiThread(new Runnable() {
public void run() {
VideoView mVideoView = (VideoView) findViewById(R.id.VideoView);
mVideoView.setVisibility(View.VISIBLE);
mVideoView.setMediaController(new MediaController(mcontext));
mVideoView.setVideoURI(Uri.parse(video_url));
mVideoView.requestFocus();
mVideoView.start();
}
});
}
[layout]
<VideoView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:id="@+id/VideoView" />
Reference links
http://android-coding.blogspot.tw/2011/03/simple-example-using-videoview-to-play.html
http://stackoverflow.com/questions/14354933/error-in-opening-streaming-video
沒有留言:
張貼留言