Repetición de Android VideoView

I have an application with a VideoView, in order to make the video play on a loop I use an onCompletionListner to call setVideoPath() again, like this:

    mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        public void onPrepared(MediaPlayer arg0) {


    mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        public void onCompletion(MediaPlayer mp) {
                //I have a log statment here, so I can see that it is making it this far.
                mp.reset(); // <--- I added this recently to try to fix the problem

This setup works well on all devices I've come across so far, I never had any trouble with it not repeating.

However the Motorola Xoom that I am testing on was recently upgraded to ICS. Now that it is on ICS this will work for a while and loop the video. But eventually (I've added a counter and some Logs, there does not appear to be any pattern to how many times it successfully loops before stopping) it will quit looping and just sit on a freeze frame of the first frame in the movie.

Does anyone know what could cause this not to loop properly any more? OR does anyone know of another way to get a VideoView to loop properly that does work under ICS still?

preguntado el 01 de febrero de 12 a las 14:02

What is mp on your code? -

@jeraldov mp is the MediaPlayer object that gets passed as a parameter to the onCompletion() method. -

2 Respuestas

If you have only one video to play you can setLooping(true) in your on prepared listener.

myVideoView.setOnPreparedListener(new OnPreparedListener() {

        public void onPrepared(MediaPlayer mp) {
            // TODO Auto-generated method stub


y tu estas listo.

Respondido 04 Feb 14, 13:02

So far this:


inside the onComplete callback seems to fix it. Would be very interested if anyone can explain what is going on with it.

Respondido 05 Feb 12, 10:02

do you mean onCompletion? - Adi

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.