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

NullPointerException in ThreadsafePlayerHater #14

Open
dts opened this issue May 13, 2015 · 3 comments
Open

NullPointerException in ThreadsafePlayerHater #14

dts opened this issue May 13, 2015 · 3 comments

Comments

@dts
Copy link

dts commented May 13, 2015

I'm getting an occasional crash when using this on Android, some devices it crashes 100% of the time, others it comes and goes. Here is a stack trace I was able to retrieve:

Android: 4.4.2
Manufacturer: LGE
Model: VK810 4G
Date: Tue May 12 16:24:46 PDT 2015

java.lang.NullPointerException
at org.prx.playerhater.wrappers.ThreadsafePlayerHater.seekTo(ThreadsafePlayerHater.java:134)
at org.prx.playerhater.ipc.PlayerHaterServer.seekTo(PlayerHaterServer.java:100)
at org.prx.playerhater.ipc.ServerPlayerHater.seekTo(ServerPlayerHater.java:101)
at org.prx.playerhater.wrappers.BoundPlayerHater$3.onServiceConnected(BoundPlayerHater.java:210)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1124)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1141)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5118)
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:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
at dalvik.system.NativeStart.main(Native Method)

@greatwitenorth
Copy link

I found that setting a timeout for 5 seconds after the app loads, and before playing the file seemed to fix the issue. I'm using Ionic and it seems that wrapping it in $ionicPlatform.ready is not enough. Something must still be initializing when that fires.

@xgat
Copy link

xgat commented Nov 14, 2015

Hi, as a workaround you can check for a null player, i.e. in class ThreadsafePlayerHater fix seekTo as follows:

public boolean seekTo(int startTime) {
    PlaylistSupportingPlayer player = getMediaPlayer();
    if (player != null) {
        player.seekTo(startTime);
        return true;
    }

    return false;
}

@rcurvello
Copy link

@itibet
replace this:


@Override
    public boolean seekTo(final int startTime) {
        return new PlayerHaterTask(mHandler) {
            @Override
            protected Boolean run() {
                return mPlayerHater.seekTo(startTime);
            }
        }.get();
    }

for this?:


public boolean seekTo(int startTime) {
    PlaylistSupportingPlayer player = getMediaPlayer();
    if (player != null) {
        player.seekTo(startTime);
        return true;
    }
    return false;
}

Dont work...

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

4 participants