myLooper not null, a bug in some MediaPlayer implementation cause that listeners are not called at all. Please use a thread without Looper
NianguoWang opened this issue · 0 comments
NianguoWang commented
I have use a Apollo MediaPlayer to instead of MediaPlayer.But when I setDataSource, it throws a exception says that this method has to be called in a Thread with looper. But when I add looper, the MediaPlayerWrapper throws an exception:
protected MediaPlayerWrapper(MediaPlayer mediaPlayer) {
TAG = "" + this;
if (SHOW_LOGS) Logger.v(TAG, "constructor of MediaPlayerWrapper");
if (SHOW_LOGS) Logger.v(TAG, "constructor of MediaPlayerWrapper, main Looper " + Looper.getMainLooper());
if (SHOW_LOGS) Logger.v(TAG, "constructor of MediaPlayerWrapper, my Looper " + Looper.myLooper());
if(Looper.myLooper() != null){
throw new RuntimeException("myLooper not null, a bug in some MediaPlayer implementation cause that listeners are not called at all. Please use a thread without Looper");
}
mMediaPlayer = mediaPlayer;
......
}
How can I resolve this conflict?