danylovolokh/VideoPlayerManager

IllegalStateException: cannot stop. Player in mState ERROR

Opened this issue · 6 comments

Just downloaded and ran the example code on my Galaxy S4 (API 21). The first few videos played fine but I scrolled down pretty fast and the app crashed. I found this Exception in the log.

 java.lang.IllegalStateException: cannot stop. Player in mState ERROR 
 	at com.volokh.danylo.video_player_manager.ui.MediaPlayerWrapper.stop(MediaPlayerWrapper.java:433) 
 	at com.volokh.danylo.video_player_manager.ui.VideoPlayerView.stop(VideoPlayerView.java:186) 
 	at com.volokh.danylo.video_player_manager.player_messages.Stop.performAction(Stop.java:19) 
 	at com.volokh.danylo.video_player_manager.player_messages.PlayerMessage.runMessage(PlayerMessage.java:40) 
 	at com.volokh.danylo.video_player_manager.MessagesHandlerThread$1.run(MessagesHandlerThread.java:61) 
 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
 	at java.lang.Thread.run(Thread.java:818) 

I had the same problem as well

me too ,the same problem

Does anyone solve this problem?

same probs... even video is not playing in list

You can prevent the crash like that;

When you put BaseVideoItem inside onErrorMainThead() override method

@OverRide
public void onErrorMainThread(int what, int extra) {
Log.v("Error State","errorr");
mVideoPlayerManager.resetMediaPlayer();
}
put the media reset method.

Its prevent the crash when the errror case.
its fix crash.
@devilabhi @hasanmumin @alaaodeh95 @jpage4500 @phamd1989

@mgtone92 To be honest, I don't understand. Can you write a sample?
I am using like this:

private static final VideoPlayerManager<MetaData> videoPlayerManager = new SingleVideoPlayerManager(new PlayerItemChangeListener() {
        @Override
        public void onPlayerItemChanged(MetaData metaData) {

        }
    });

videoPlayerManager.playNewVideo(null, target, videoPath);

Actually, I'm resetting after each loop. Problem is fixed for me, I mean didn't encounter the error for a long time.