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