Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

myLooper not null, a bug in some MediaPlayer implementation cause that listeners are not called at all. Please use a thread without Looper #97

Open
NianguoWang opened this issue Jul 27, 2018 · 0 comments

Comments

@NianguoWang
Copy link

NianguoWang commented Jul 27, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant