我有一个简单的对话框,里面有一个VideoView
,我想循环播放视频。
我目前正在使用快速修复
//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
直接使用的方法