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: unable to stop service org.schabi.newpipe.player.PlayerService@1ac624e #11029

Open
6 tasks done
InconsolableCellist opened this issue May 2, 2024 · 4 comments
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background)

Comments

@InconsolableCellist
Copy link

Checklist

  • I am able to reproduce the bug with the latest version given here: CLICK THIS LINK.
  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have read the FAQ and my problem isn't listed.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I have read and understood the contribution guidelines.

Affected version

0.27.0

Steps to reproduce the bug

  1. Begin playing a video
  2. Switch from WiFi to 5G or vice versa. Wait a moment

Expected behavior

Video continues to play

Actual behavior

Video stops playing and NewPipe opens up (even when playing in the background) with the guru meditation screen. The following output is shown:

## Exception
* __User Action:__ ui error
* __Request:__ ACRA report
* __Content Country:__ US
* __Content Language:__ en-US
* __App Language:__ en_US
* __Service:__ none
* __Version:__ 0.27.0
* __OS:__ Linux Android 13 - 33
<details><summary><b>Crash log </b></summary><p>

java.lang.RuntimeException: Unable to stop service org.schabi.newpipe.player.PlayerService@1ac624e: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector.setCustomActionProviders(com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector$CustomActionProvider[])' on a null object reference
at android.app.ActivityThread.handleStopService(ActivityThread.java:5285)
at android.app.ActivityThread.-$$Nest$mhandleStopService(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2454)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8772)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector.setCustomActionProviders(com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector$CustomActionProvider[])' on a null object reference
at org.schabi.newpipe.player.mediasession.MediaSessionPlayerUi.updateMediaSessionActions(MediaSessionPlayerUi.java:215)
at org.schabi.newpipe.player.mediasession.MediaSessionPlayerUi.onMetadataChanged(MediaSessionPlayerUi.java:282)
at org.schabi.newpipe.player.Player.lambda$updateMetadataWith$22(Player.java:1801)
at org.schabi.newpipe.player.Player.$r8$lambda$6LL1ynLVHUrHxxol0bvWL1Rn_TU(Player.java:0)
at org.schabi.newpipe.player.Player$$ExternalSyntheticLambda47.accept(R8$$SyntheticClass:0)
at j$.util.AbstractList$RandomAccessSpliterator.forEachRemaining(Unknown Source:19)
at j$.util.stream.ReferencePipeline$Head.forEachOrdered(Unknown Source:10)
at org.schabi.newpipe.player.ui.PlayerUiList.call(PlayerUiList.java:88)
at org.schabi.newpipe.player.Player.updateMetadataWith(Player.java:1801)
at org.schabi.newpipe.player.Player.lambda$onEvents$13(Player.java:1293)
at org.schabi.newpipe.player.Player.$r8$lambda$5dalatdJw7zsnq99HOZvtSHTxZo(Player.java:0)
at org.schabi.newpipe.player.Player$$ExternalSyntheticLambda37.accept(R8$$SyntheticClass:0)
at j$.util.Optional.ifPresent(Unknown Source:4)
at org.schabi.newpipe.player.Player.lambda$onEvents$14(Player.java:1287)
at org.schabi.newpipe.player.Player.$r8$lambda$67JZJPUrqqIwv2qPVBiXIeF-1Rs(Player.java:0)
at org.schabi.newpipe.player.Player$$ExternalSyntheticLambda9.accept(R8$$SyntheticClass:0)
at j$.util.Optional.ifPresent(Unknown Source:4)
at org.schabi.newpipe.player.Player.onEvents(Player.java:1265)
at com.google.android.exoplayer2.ExoPlayerImpl.lambda$new$0(ExoPlayerImpl.java:266)
at com.google.android.exoplayer2.ExoPlayerImpl.$r8$lambda$FaN7Odt_OJn5xWFlmhnR2OmiNMg(ExoPlayerImpl.java:0)
at com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda1.invoke(R8$$SyntheticClass:0)
at com.google.android.exoplayer2.util.ListenerSet$ListenerHolder.release(ListenerSet.java:320)
at com.google.android.exoplayer2.util.ListenerSet.remove(ListenerSet.java:183)
at com.google.android.exoplayer2.ExoPlayerImpl.removeListener(ExoPlayerImpl.java:1641)
at org.schabi.newpipe.player.Player.destroyPlayer(Player.java:573)
at org.schabi.newpipe.player.Player.destroy(Player.java:600)
at org.schabi.newpipe.player.PlayerService.cleanup(PlayerService.java:150)
at org.schabi.newpipe.player.PlayerService.onDestroy(PlayerService.java:145)
at android.app.ActivityThread.handleStopService(ActivityThread.java:5265)
... 9 more

</details>
<hr>

I'll need to close and open the app to recover. Also sometimes my position in the video will be lost, so even going to it through the History tab won't allow me to resume where I left off. That makes it even more annoying.

Screenshots/Screen recordings

No response

Logs

No response

Affected Android/Custom ROM version

No response

Affected device model

Samsung Galaxy ZFold 4

Additional information

Phone: SM-F936U1
One UI 5.0
Android 13
Kernel Version: 5.10.81-android12-9-25407272-abF936U1UEU1BVKB

This is a de-Googled phone, so it doesn't run Google Play Services, which has been put to deep sleep via adb.

Maybe you can add a null check here:

private void updateMediaSessionActions() {
    if (sessionConnector == null) {
        // log...
        return;
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
        return;
    }

    // ...
}

Or maybe it's clear to you why

public void onMetadataChanged(@NonNull final StreamInfo info) {
can be called when init apparently wasn't called, or sessionConnector is somehow being unset?

This happens very often to me, basically whenever I leave the house while playing a video in the background, or entering.

@InconsolableCellist InconsolableCellist added bug Issue is related to a bug needs triage Issue is not yet ready for PR authors to take up labels May 2, 2024
@opusforlife2
Copy link
Collaborator

Is that the error you get each time? This looks like a duplicate of #10097, but your error is different,

@opusforlife2 opusforlife2 added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label May 2, 2024
@AudricV
Copy link
Member

AudricV commented May 2, 2024

No, that's completely different and is very likely a 0.27.0 regression related to media notification actions changes.

I can reproduce this issue if a playback error occurs when playing a content in the main player (so it is closed due to the error), while the player service is being stopped.

@opusforlife2 opusforlife2 added player Issues related to any player (main, popup and background) and removed waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. needs triage Issue is not yet ready for PR authors to take up labels May 2, 2024
@marek22k
Copy link

marek22k commented May 6, 2024

I got the same error, but in a different situation. I was watching a video and wanted to play another one. I clicked on the other one. Then the message appeared. After clicking away the error message, I had to restart NewPipe.

Smartphone: Fairphone 4 (CalyxOS 5.6.3, Android 14)
NewPipe version 0.27.0

Exception

  • User Action: ui error
  • Request: ACRA report
  • Content Country: US
  • Content Language: en-US
  • App Language: en_US_#u-fw-mon-mu-celsius
  • Service: none
  • Version: 0.27.0
  • OS: Linux Android 14 - 34
Crash log

java.lang.RuntimeException: Unable to stop service org.schabi.newpipe.player.PlayerService@46f479d: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector.setCustomActionProviders(com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector$CustomActionProvider[])' on a null object reference
	at android.app.ActivityThread.handleStopService(ActivityThread.java:5085)
	at android.app.ActivityThread.-$$Nest$mhandleStopService(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2398)
	at android.os.Handler.dispatchMessage(Handler.java:107)
	at android.os.Looper.loopOnce(Looper.java:232)
	at android.os.Looper.loop(Looper.java:317)
	at android.app.ActivityThread.main(ActivityThread.java:8501)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector.setCustomActionProviders(com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector$CustomActionProvider[])' on a null object reference
	at org.schabi.newpipe.player.mediasession.MediaSessionPlayerUi.updateMediaSessionActions(MediaSessionPlayerUi.java:215)
	at org.schabi.newpipe.player.mediasession.MediaSessionPlayerUi.onMetadataChanged(MediaSessionPlayerUi.java:282)
	at org.schabi.newpipe.player.Player.lambda$updateMetadataWith$22(Player.java:1801)
	at org.schabi.newpipe.player.Player.$r8$lambda$6LL1ynLVHUrHxxol0bvWL1Rn_TU(Player.java:0)
	at org.schabi.newpipe.player.Player$$ExternalSyntheticLambda47.accept(R8$$SyntheticClass:0)
	at j$.util.AbstractList$RandomAccessSpliterator.forEachRemaining(Unknown Source:19)
	at j$.util.stream.ReferencePipeline$Head.forEachOrdered(Unknown Source:10)
	at org.schabi.newpipe.player.ui.PlayerUiList.call(PlayerUiList.java:88)
	at org.schabi.newpipe.player.Player.updateMetadataWith(Player.java:1801)
	at org.schabi.newpipe.player.Player.lambda$onEvents$13(Player.java:1293)
	at org.schabi.newpipe.player.Player.$r8$lambda$5dalatdJw7zsnq99HOZvtSHTxZo(Player.java:0)
	at org.schabi.newpipe.player.Player$$ExternalSyntheticLambda37.accept(R8$$SyntheticClass:0)
	at j$.util.Optional.ifPresent(Unknown Source:4)
	at org.schabi.newpipe.player.Player.lambda$onEvents$14(Player.java:1287)
	at org.schabi.newpipe.player.Player.$r8$lambda$67JZJPUrqqIwv2qPVBiXIeF-1Rs(Player.java:0)
	at org.schabi.newpipe.player.Player$$ExternalSyntheticLambda9.accept(R8$$SyntheticClass:0)
	at j$.util.Optional.ifPresent(Unknown Source:4)
	at org.schabi.newpipe.player.Player.onEvents(Player.java:1265)
	at com.google.android.exoplayer2.ExoPlayerImpl.lambda$new$0(ExoPlayerImpl.java:266)
	at com.google.android.exoplayer2.ExoPlayerImpl.$r8$lambda$FaN7Odt_OJn5xWFlmhnR2OmiNMg(ExoPlayerImpl.java:0)
	at com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda1.invoke(R8$$SyntheticClass:0)
	at com.google.android.exoplayer2.util.ListenerSet$ListenerHolder.release(ListenerSet.java:320)
	at com.google.android.exoplayer2.util.ListenerSet.remove(ListenerSet.java:183)
	at com.google.android.exoplayer2.ExoPlayerImpl.removeListener(ExoPlayerImpl.java:1641)
	at org.schabi.newpipe.player.Player.destroyPlayer(Player.java:573)
	at org.schabi.newpipe.player.Player.destroy(Player.java:600)
	at org.schabi.newpipe.player.PlayerService.cleanup(PlayerService.java:150)
	at org.schabi.newpipe.player.PlayerService.onDestroy(PlayerService.java:145)
	at android.app.ActivityThread.handleStopService(ActivityThread.java:5065)
	... 9 more


Feel free to hide my message if it's annoying. However, since there was the "Waiting for Author" tag for a short time, I thought I'd write my error message briefly too.

@dolmen
Copy link

dolmen commented May 12, 2024

See also #11066, #11061, #11065, #11068.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background)
Projects
None yet
Development

No branches or pull requests

5 participants