Android: Vista de video: cómo reproducir un video en un bucle
Tengo un cuadro de diálogo simple con unVideoView
en él y quiero reproducir el video en un bucle.
Actualmente estoy usando una solución rápida
//Video Loop
vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
vv.start();
}
});
pero me gustaría saber si hay una mejor manera?
Edita
Estoy agregando más código porque no sé cómo puedo obtener acceso al objeto MediaPlayer desde elVideoView
:
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();
Actualmente estoy buscando usar directamenteMediaPlayer
y unSurfaceView
bu Me gustaría saber si hay una manera conVideoView
directamente