I'm currently facing a problem that I can solve myself.
My android application (built for 4.2 and 4.4) act as a VideoPlayer. I've put some videos into the file directory of my app with no restriction access (MODE_WORLD_READABLE) and the player read them one by one until I shutdown the device or the application.
Sometimes, when I'm trying to read a local video using a VideoView the video doesn't start and the log print this warning :
03-24 12:10:50.493: W/MediaPlayer(12894): info/warning (701, 0)
Sometimes, the mediaplayer doesn't leave this state until I kill my app (or reboot the device).
And sometimes, the log continue after the previous warning with:
03-24 14:07:07.775: E/FFMpegMediaPlayer(100): start in mCurrentState in
03-24 14:07:07.775: I/FFMpegMediaPlayer(100): ******************************************
03-24 14:07:07.775: E/FFMpegMediaPlayer(100): start in mCurrentState = 8
03-24 14:07:07.775: I/FFMpegMediaPlayer(100): starting main player thread:2013-11-20
03-24 14:07:07.775: I/RkAudioPlayer(100): mAudioSink->open in mSampleRate = 48000 channels = 2
03-24 14:07:07.775: I/FFMpegMediaPlayer(100): ******************************************
03-24 14:07:07.775: I/FFMpegMediaPlayer(100): mCurrentState = 8
03-24 14:07:07.775: I/(100): starting thread
03-24 14:07:07.775: D/AUDIO_DECOE(100): prepare()
03-24 14:07:07.785: I/AudioHardwareALSA(100): Audio exiting sandby will open audio device
03-24 14:07:07.895: E/ALSAModule(100): audio type flag: 0
03-24 14:07:13.465: D/FFMpegMediaPlayer(100): url_feof=1,err=0
03-24 14:07:13.465: I/FFMpegMediaPlayer(100): av_read_frame end of stream ret = -541478725
03-24 14:07:13.465: W/MediaPlayer(9652): info/warning (950, 0)
03-24 14:07:13.475: I/MediaPlayer(9652): Info (950,0)
03-24 14:07:13.475: E/ERROR : INFO MEDIAPLAYER(9652): what:950, extra:0
03-24 14:07:17.695: D/AudioHardwareALSA(100): AudioStreamOutALSA::standby().....
As the first log, after this one, nothing appened until I kill my app (or reboot the device).
Also, I've put some logging information in order to know if the onPrepared Callback is fired and it this is OK.
The only way I found to play the video again is to reboot my device when the problem occurred.
Here is some code of my player:
audioManager = (AudioManager) applicationContext.getSystemService(Context.AUDIO_SERVICE); //this is in the constructor of my singleton player
//all the following code are encapsulated in a method which is called every time a new video must be play.
setCompletionListener(); //in here I call videoview.stopPlayback(); and I recall this method to start another video
setErrorListener(); //here too I call videoview.stopPlayback();
videoview.setVideoPath(applicationContext.getFilesDir() + "/" + myVideoFile.getFileName());
videoview.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(final MediaPlayer mediaPlayer) {
audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 90, 0);
mediaPlayer.setVolume(12.0f, 12.0f);
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0)
mediaPlayer.start();
}
});
My question is: Why my videoview is not playing correctly all the time ? The problem appears sometimes after 2 or 3h of execution or sometimes at the boot of my app.