Listener (or handler) for video finish
Solution 1:
Seems you are looking for
setOnCompletionListener(MediaPlayer.OnCompletionListener l)
More in depth explanation can be found here
EDIT
This shows a solution where playback is called after completion using VideoView
, MediaController
and setOnCompletionListener()
.
Solution 2:
here is my working chunk of code:
mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener()
{
public void onCompletion(MediaPlayer mp)
{
// Do whatever u need to do here
}
});
Solution 3:
vidView=(VideoView)findViewById(R.id.vidView);
vidView.setMediaController(null);
vidView.setVideoPath( "/mnt/external_sd/somerandommovie.3gp" );
vidView.start();
vidView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
vidView.start();
}
});
I found that the listener was firing, the issue was mp.start() didn't seem to do anything, so calling start again on the original object seems to be working fine.