I have an application with VideoView that will continue to cycle the same video over and over until the user does nothing with the device (touch screen, etc.). I am currently using OnCompletionListener () to restart the video after it finishes. This works correctly on every device under test, with the exception of Samsung Replenish.
Here is my code:
mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
mVideoView.setVideoPath(file.getAbsolutePath());
mVideoView.start();
}
});
What happens in Replenish, the video plays all the way through once, but then it never starts again and the screen goes black (but the backlight is still on). On every other device that I tested this exact code on, it worked on repeating the video. Does anyone know anything specific about Replenish that might cause this error? I was thinking maybe delaying the calls to setVideoPath (), and start () at 200-300ms might help, but it didn’t. I am really at a loss.
I see these messages in my log:
ERROR / QCvdec (87): Omx Flush is thrown when vdec is not yet initialized.
ERROR / QCvdec (87): OMXCORE-SM: Received command DISABLE (2)
ERROR / QCvdec (87): Omx Flush is thrown when vdec is not yet initialized.
ERROR / QCvdec (87): OMXCORE-SM: Received ENABLE Command (3)
( ), . , .
Edit:
mVideoView null, findViewById() setVideoPath(). , OnCompletionListener. , , .
2:
, . :
mVideoView.setVideoPath(file.getAbsolutePath());
mVideoView.start();
, , 100%, .
3: . OnPreparedListener, . onCreate()
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer arg0) {
mVideoView.start();
}
});
, , setVideoPath(). :
mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
mVideoView.setVideoPath(file.getAbsolutePath());
}
});
. , , .
4:
@MByD VideoView setVideoPath() setVideoUri(). setVideoURI() mStartWhenPrepared = false; OnPreparedListener , , . . , , setter, mStartWhenPrepared true, , .