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

PlayerHater is not loaded yet or has been shut down #31

Open
flavioarfaria opened this issue Jun 27, 2014 · 1 comment
Open

PlayerHater is not loaded yet or has been shut down #31

flavioarfaria opened this issue Jun 27, 2014 · 1 comment

Comments

@flavioarfaria
Copy link

Steps to reproduce:

  1. Set the PlayerHater to start in onResume() and to release in onPause();
  2. In a button click event, call play() on a Song being streamed from the web (I haven't tested with any other data source);
  3. Press back button just after the notification ticker slides in.

It doesn't happen every time, but i's fairly easy to reproduce. Digging through the source code I could notice that this happens because the plugin tries to start the player service:

getBinder().startForeground(NOTIFICATION_NU, getNotification());

In the code above, getBinder() tries to access a reference to the PlayerHater instance, which has been destroyed, since the Activity has run onPause() when back was pressed.

Stack trace:

java.lang.IllegalStateException: PlayerHater is not loaded yet or has been shut down.
        at org.prx.playerhater.plugins.AbstractPlugin.getPlayerHater(AbstractPlugin.java:157)
        at org.prx.playerhater.plugins.NotificationPlugin.getBinder(NotificationPlugin.java:138)
        at org.prx.playerhater.plugins.NotificationPlugin.onChangesComplete(NotificationPlugin.java:124)
        at org.prx.playerhater.plugins.PluginCollection.onChangesComplete(PluginCollection.java:299)
        at org.prx.playerhater.plugins.BackgroundedPlugin.handleMessage(BackgroundedPlugin.java:361)
        at org.prx.playerhater.plugins.BackgroundedPlugin$HandlerPair.handleMessage(BackgroundedPlugin.java:504)
        at org.prx.playerhater.plugins.BackgroundedPlugin$HandlerPair$OtherHandler.handleMessage(BackgroundedPlugin.java:519)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:5062)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)
@cqr
Copy link
Owner

cqr commented Sep 30, 2015

Interesting - I think I know how to address this and will give it a shot.

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

2 participants