我收到了一個簡單的對話框,其中包含VideoView
,我想在循環中播放視頻。Android:視頻視圖:如何在循環中播放視頻
我目前使用速戰速決
//Video Loop
vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
vv.start();
}
});
,但我想知道是否有更好的辦法?
編輯
我添加更多的代碼,因爲我不知道我怎樣才能訪問MediaPlayer對象形成VideoView
:
String path = defaultPath+currentVideoRessource;
if (path == null || path.length() == 0) {
Log.e("extra","File URL/path is empty");
} else {
// If the path has not changed, just start the media player
if (!path.equals(current) && mVideoView != null) {
Uri pathURI = Uri.parse(defaultPath+currentVideoRessource);
mVideoView.setVideoURI(pathURI);
}
current = path;
mVideoView.setOnCompletionListener(new MyOnCompletionListener(this));
//Video Loop
// mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
// public void onCompletion(MediaPlayer mp) {
// mVideoView.start(); //need to make transition seamless.
// }
// });
mVideoView.start();
mVideoView.requestFocus();
我目前調查直接使用MediaPlayer
和SurfaceView
埠我想知道是否有方式VideoView
直接
請試試這個,這是爲我工作明確 [http://stackoverflow.com/a/27606389/3414469][1] – ylmzekrm1223 2014-12-22 16:24:02