1
我已经通读了一些关于视频播放的教程,发现这个宝石: Android Media Player 这是相当广泛的比较下面的代码;使用SurfaceView进行视频播放有什么好处,并且有没有任何示例可以显示如何实现surface.xml?视频播放需要surfaceView吗?
谢谢:)
进口.....
public class VideoViewDemo extends Activity {
/**
* TODO: Set the path variable to a streaming video URL or a local media
* file path.
*/
private String path = "";
private VideoView mVideoView;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.videoview);
mVideoView = (VideoView) findViewById(R.id.surface_view);
if (path == "") {
// Tell the user to provide a media file URL/path.
Toast.makeText(
VideoViewDemo.this,
"Please edit VideoViewDemo Activity, and set path"
+ " variable to your media file URL/path",
Toast.LENGTH_LONG).show();
} else {
/*
* Alternatively,for streaming media you can use
* mVideoView.setVideoURI(Uri.parse(URLstring));
*/
mVideoView.setVideoPath(path);
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
}
}
}
谢谢菲利克斯,是否有利用SurfaceView在android网站上显示你如何在上面编码?另外我通过ADB连接到我的Logitech revue,如果我使用位于我的计算机上的.mp4文件,它是否仍然可以流式传输?或者我需要将该文件移到该修订。 – Fabii 2012-03-02 01:11:24