が含まれている単純なダイアログボックスが表示VideoView
され、ビデオをループで再生したいと思います。
現在、クイックフィックスを使用しています
//Video Loop
vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
vv.start();
}
});
しかし、もっと良い方法があるかどうか知りたいですか?
編集
VideoView
:からMediaPlayerオブジェクトにアクセスする方法がわからないため、コードを追加しています。
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