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

App crashes randomly #9358

Closed
6 tasks done
OldGuyInTheClub opened this issue Nov 10, 2022 · 62 comments · Fixed by #10578
Closed
6 tasks done

App crashes randomly #9358

OldGuyInTheClub opened this issue Nov 10, 2022 · 62 comments · Fixed by #10578
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background)

Comments

@OldGuyInTheClub
Copy link

OldGuyInTheClub commented Nov 10, 2022

Checklist

  • I am able to reproduce the bug with the latest version.
  • 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.24.1 (but also saw in 0.24)

Steps to reproduce the bug

  1. Start App
  2. Wait or navigate through subscriptions, select video, etc.
  3. Eventually App will crash with a Guru Meditation error
  4. Restarting app will cause the same crash within 10-15 seconds thereafter

UPDATED 6 August 2023 with v0.25.2

  1. Have app running on Wifi
  2. Move out of Wifi range, switch to cellular data
  3. Wait a varying amount of time
  4. a)Whether a video is playing or not, whether the app is foreground or not, the app will crash with a Guru Meditation error
    OR b) Reload subscriptions or otherwise interact with the app: Sometimes (but not all) app will crash with a Guru Meditation error

or

  1. Put phone on Airplane Mode, leave it as such for a few hours
  2. Take it out of Airplane Mode, connect to the cellular network
  3. See steps 3 and 4 above

Change in behavior: Guru Meditation error no longer goes into infinite loop. Still steals focus as always but it is possible to swipe dismiss the app and restart. Usually it will work for a while after one or two restarts and then the problem happens again

Expected behavior

App used to work great. Started having this problem with 0.24. Hoped 0.24.1 would fix it but didn't

Actual behavior

Regular crashes

Screenshots/Screen recordings

No response

Logs

Exception

  • User Action: ui error
  • Request: ACRA report
  • Content Country: US
  • Content Language: en-US
  • App Language: en_US
  • Service: none
  • Version: 0.24.1
  • OS: Linux samsung/beyond2qlteue/beyond2q:12/SP1A.210812.016/G975U1UEU6IVH1:user/release-keys 12 - 31
Crash log

android.app.ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{177d640 u0 org.schabi.newpipe/.player.PlayerService}
at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2147)
at android.app.ActivityThread.access$2900(ActivityThread.java:310)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2376)
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:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)


Affected Android/Custom ROM version

Android 12 4.14.190 - stock, no custom ROM, no root

Affected device model

Samsung Galaxy S10+, US T Mobile

Additional information

Closest relevant recent Open Issue is #9163 but my problem doesn't happen immediately on startup.
Closest Closed Issue is #9339
but afaik, there isn't a fix (looked at other referenced Issues)

Steps tried.

  1. Quickly backed up database before a crash
  2. Deleted cache and data
  3. Restarted app
  4. Problem still there
  5. Deleted cache and data again
  6. Uninstalled app
  7. Reinstalled 0.24.1 from the Newpipe website
  • Checked F-Droid to see if there was a version there but there wasn't
  1. Restored database
  2. Problem still there

Delay between app start and crash not perfectly reproducible. Occasionally it will be stable for a few minutes but once a crash happens, it will repeat 10-15 seconds after every restart for some time after which it will be stable for a little while before starting the quick crash pattern

Problem is not affected by VPN state

Weak correlation with signal strength: Wifi connections appear to take longer between crashes relative to cellular network. Can't prove it. Just an observation.

I don't have the tools or skill to get any bug report beyond the Guru Meditation dump provided in the Logs box

@OldGuyInTheClub OldGuyInTheClub added bug Issue is related to a bug needs triage Issue is not yet ready for PR authors to take up labels Nov 10, 2022
@opusforlife2
Copy link
Collaborator

Try using mobile data instead of wifi.

@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 Nov 10, 2022
@OldGuyInTheClub
Copy link
Author

Problem exists with both mobile data and Wifi. Seems worse with mobile.

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Nov 10, 2022
@opusforlife2
Copy link
Collaborator

And do you see this occur if you follow the steps in #9030?

@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 Nov 10, 2022
@OldGuyInTheClub
Copy link
Author

I get the crashes without having to change speeds or sizes as in that Issue. I don't get a popup that the app is not responding. I get the "Sorry that should not have happened" crash with diagnostics.

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Nov 10, 2022
@opusforlife2 opusforlife2 removed the needs triage Issue is not yet ready for PR authors to take up label Dec 31, 2022
@MoralCode
Copy link

MoralCode commented Jan 17, 2023

I believe i am seeing the same thing. my device and crash log is nearly identical as far as I can tell.

{"user_action":"ui error","request":"ACRA report","content_language":"en-US","content_country":"US","app_language":"en_US","service":"none","package":"org.schabi.newpipe","version":"0.24.1","os":"Linux samsung/beyond0qltesq/beyond0q:12/SP1A.210812.016/G970USQU7IVH3:user/release-keys 12 - 31","time":"2023-01-11 23:34","exceptions":["android.app.ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{b232cc4 u0 org.schabi.newpipe/.player.PlayerService}\n\tat android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2147)\n\tat android.app.ActivityThread.access$2900(ActivityThread.java:310)\n\tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:2376)\n\tat android.os.Handler.dispatchMessage(Handler.java:106)\n\tat android.os.Looper.loopOnce(Looper.java:226)\n\tat android.os.Looper.loop(Looper.java:313)\n\tat android.app.ActivityThread.main(ActivityThread.java:8663)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)\n"],"user_comment":"this keeps happening when google maps is open and navigating somewhere. it takes over my screen and is dangerous for drivers."}

initially tried to send via email but the email address doesnt seem to exist anymore.

Device: Samsung S10E
Android Ver: 12, same kernel version 4.14.190 - stock, no custom ROM, no root, phone does have developer mode enabled if that means anything.

My primary observation is that I almost never see this error during daily use (i.e. when im intending to use the newpipe app), but it only seemed to appear when i was trying to navigate somewhere in google maps. This error will take over the screen reducing the map to a picture in picture view and then cover that up with a system pipup like "it looks like newpipe crashed" with options to stop the app or wait (or maybe clear cache, i forget).

nothing i have tried (including stopping the app from that prompt, waiting for the app, killing the app from task switcher, clearing the cache, force stopping the app, uninstalling and reinstalling) seems to have worked to fix this.

Personally I feel as though this is potentially a danger to drivers and may warrant toning down how aggressively the crash reporting wants to be on screen if an error occurs while the app or any of its windows (like picture in picture) aren't visible on screen.

@MoralCode
Copy link

MoralCode commented Jan 17, 2023

Here is a screenshot of what i see when this happens:
Screenshot_20221230-142301_NewPipe

@OldGuyInTheClub
Copy link
Author

OldGuyInTheClub commented Jan 23, 2023

I'm still experiencing this, as well. The problem appears to correlate moderately with connecting to or switching between networks such as wifi->cellular or cellular->cellular handoff. Might not be exclusive to that though. I remembered an earlier ticket I filed with a similar issue when I had an LGV20 phone and Sprint service: #6012
That got fixed when Sprint, my provider at the time, pushed some kind of update.

But, now I have a Samsung phone and a T-Mobile SIM card. I don't know if I am on legacy Sprint network hardware or if I am fully on T-Mobile. Whatever the case, Newpipe worked very well with the Samsung until v24.

I have looked all over the Samsung phone to see if there are any network/connectivity settings I could invoke to further troubleshoot this but have not found anything. There are no applicable phone or network updates, either.

Question: Does NewPipe expect specific behaviors of connectivity or connection changes from the phone/ISP/whatever that may not be satisfied? That might help me dig specifically into my phone settings. The prior ticket got resolved by some miracle fix at the cellular system level. I have no idea if lightning will strike twice there.

(Updated to correct spelling errors and for clarifications)

@MoralCode
Copy link

MoralCode commented Jan 23, 2023

the changing networks theory kind of fits with my experience of the error too, since when im using google maps, im usually traveling, but this doesnt seem to always recreate the issue.

id be curious if these reproduction steps work to resolve the issue:

  1. start playing a video in the app.
  2. navigate away from the app while the video is playing and pause the video (try these in both orders maybe?)
  3. travel somewhere far enough away that you connect to a different network (ideally both wifi and cellular tower, use google maps if you can since that may be interesting)
  4. see if the issue happens

given that the error i observed seems to be relating to some background task, i assume it would happen if the app was playing a video in the background and either lost network while playing, it would get into a state where it could (in theory) keep spitting out this error whenever the network changes.

This also seems related to a different error i see this fairly often when using the app in the foreground. It happens when i resume watching a video that was started a previous day and run out of buffered video that was loaded the day before. That said, this results in a different, notification + toast style of error and never really looked into it so it may not be the same.

Edit: this other kind of error seems to already be documented in #10174

When this other error happens I usually just back out of the video and re open it to cause it to pick up from where I was with no issues. Maybe the bug in this issue is the background equivalent of this other foreground-oriented version i have been noticing?

@OldGuyInTheClub
Copy link
Author

OldGuyInTheClub commented Jan 23, 2023

I agree that it may not be the definitive cause but might help narrow the possibilities.

I'll try your steps over the next few days and report back.

Resuming play after a long time: I have trouble with this although I usually don't get a crash. Often the video just spins until I click the 'x' to stop it and restart the video and/or restart Newpipe and then the video - both from time zero.

@RandomStuf6
Copy link

I have been having the same issues since 0.24.0. I have tried on both Lineage OS 19.1 and 20, and having only gotten 20 recently, the problem only seems worse with the not responding popup happening repeatedly every couple of seconds when it starts, rather than only every so often. It seems to be an issue with background usage and opening other apps, as it seems like if i switch off newpipe for a while and try go back on it, it crashes, and if I try use the background player that also often causes it to crash.

@EthanZeigler
Copy link

I'm also getting this stack trace but can consistently replicate it. Open a pop-up player, tap on a timestamp in a comment, then pull the pop up player to the close icon. App crashes with that same trace.

@MoralCode
Copy link

I'll try your steps over the next few days and report back.

@OldGuyInTheClub any results? I'd love to root-cause this if possible in case that reveals that the fix is something simple that i can just throw up a PR and/or dev build for to have people test

@OldGuyInTheClub
Copy link
Author

I'll try your steps over the next few days and report back.

@OldGuyInTheClub any results? I'd love to root-cause this if possible in case that reveals that the fix is something simple that i can just throw up a PR and/or dev build for to have people test

I'm very sorry - I haven't had a chance to test your steps yet. Just today I updated to the latest 0.25.0. Still getting a crash when the phone loses connection with my home wifi and finds the cellular network. I don't normally use Google Maps but, FWIW, I didn't see the issue while using Waze (Google product) but this is an observation and not a full-on test.

I wonder if it has something to do with how the phone/apps handle interruptions whether it is in the network connection or not. I have another music app that will randomly disconnect on me even when there is a good signal. There are so many services going on in the background that resource conflicts may be unavoidable. There is not too much traffic on this issue so maybe there's some weird mix of circumstances affecting us but not others.

@goat-oss

This comment was marked as spam.

@EthanZeigler
Copy link

I'd like to add, I suspect something changed in Android or Google play services. I have multiple apps complaining of being unable to start background processes, including ones where battery optimization is off. Seems by this thread I'm not the only one

@MoralCode
Copy link

Actually now that you point that out, im reminded of https://dontkillmyapp.com/. They seem to be on top of these kinds of changes and may have more info about this problem

@MoralCode
Copy link

Possibly better, easier to reproduce steps that get the app to crash:

  1. Start playing a video
  2. watch about half of it (any amount is fine as long as the video started playing and theres still some amount of video left that hasnt been downloaded to the buffer yet)
  3. pause the video. go to devices home menu and open another app.
  4. put the phone to sleep and wait 8-12 hours ( idk about the specific timing, this tends to happen to me most when i watch videos before going to sleep and try and resume them in the morning)
  5. reopen newpipe from the multitasking/app switcher. resume the video
  6. video will play until the end of the already-downloaded buffer. the crash happens when playback reaches an unbuffered part of the timeline (curious if clicking an unbuffered area in the timeline to jump there also creates a crash)

my suspicion/theory as to why this happens is that some network connection becomes stale/disconnected and the app tries to reuse a now-stale connection when attempting to download more video to add to the buffer

@EthanZeigler
Copy link

I found an even better method to the above. Play the video in pop-up mode and open another app. Let the buffer become empty and the video will freeze up completely with a network error and/or the background error

@OldGuyInTheClub
Copy link
Author

Could this be solved in principle by having a "Download and enqueue" feature so videos would play from local storage? I know this requires coding but it may be easier than trying to fix something deep in the gizzards affecting only a few users.

I can submit a Feature Request if appropriate.

@MoralCode
Copy link

Maybe? I guess? Most if it exists already with the download feature tho.

I found an even better method to the above. Play the video in pop-up mode and open another app. Let the buffer become empty and the video will freeze up completely with a network error and/or the background error

Tried this and couldn't reproduce it. Do you have more info on how you tested this?

@EthanZeigler
Copy link

Maybe? I guess? Most if it exists already with the download feature tho.

I found an even better method to the above. Play the video in pop-up mode and open another app. Let the buffer become empty and the video will freeze up completely with a network error and/or the background error

Tried this and couldn't reproduce it. Do you have more info on how you tested this?

Nope, just exactly like that. Nothing special.

Man this is a weird bug we've found.

@OldGuyInTheClub
Copy link
Author

Maybe? I guess? Most if it exists already with the download feature tho.
...

I can definitely download files and play them in an external player. This would be a convenience to stay within one app. I'll submit a feature request and see where it goes.

@EthanZeigler
Copy link

EthanZeigler commented Aug 6, 2023 via email

@OldGuyInTheClub
Copy link
Author

What is an STR?

idk, probably the same concept as reproduction steps though.

Ah, Steps To Reproduce perhaps. I have done so.

@MoralCode
Copy link

i concur with the 0.24.1 reproducible version already in there - ive had issues on more recent versions, but they most likely aren't the same issue. Although i think the player in that version has been broken due to youtube constantly changing things, so it may not even be usable for testing this anyway since most of the repro steps rely on actually loading content.

@opusforlife2 are you aware of any changes in versions since 0.24.1 that would make the app more reliable under changing network conditions?

@OldGuyInTheClub
Copy link
Author

I left the original report for 0.24.1 as-is and added an update.

@opusforlife2
Copy link
Collaborator

No specific change or changes. But a lot of things get refactored in newer versions, so it's worth testing.

@godfuture
Copy link

godfuture commented Aug 9, 2023

the changing networks theory kind of fits with my experience of the error too, since when im using google maps, im usually traveling, but this doesnt seem to always recreate the issue.

Edit: here is the error report for this other kind of error. LMK if I should move this to a new issue to avoid cluttering things here.

{"user_action":"play stream","request":"Player error[type=ERROR_CODE_IO_BAD_HTTP_STATUS] occurred while playing https://www.youtube.com/watch?v=bew4pBYmTFI","content_language":"en-US","content_country":"US","app_language":"en_US","service":"YouTube","package":"org.schabi.newpipe","version":"0.24.1","os":"Linux samsung/beyond0qltesq/beyond0q:12/SP1A.210812.016/G970USQU7IVH3:user/release-keys 12 - 31","time":"2023-01-22 22:49","exceptions":["com.google.android.exoplayer2.ExoPlaybackException: Source error\n\tat com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:632)\n\tat com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:604)\n\tat android.os.Handler.dispatchMessage(Handler.java:102)\n\tat android.os.Looper.loopOnce(Looper.java:226)\n\tat android.os.Looper.loop(Looper.java:313)\n\tat android.os.HandlerThread.run(HandlerThread.java:67)\nCaused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403\n\tat org.schabi.newpipe.player.datasource.YoutubeHttpDataSource.open(YoutubeHttpDataSource.java:422)\n\tat com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:258)\n\tat com.google.android.exoplayer2.upstream.TeeDataSource.open(TeeDataSource.java:52)\n\tat com.google.android.exoplayer2.upstream.cache.CacheDataSource.openNextSource(CacheDataSource.java:786)\n\tat com.google.android.exoplayer2.upstream.cache.CacheDataSource.open(CacheDataSource.java:599)\n\tat com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84)\n\tat com.google.android.exoplayer2.source.chunk.ContainerMediaChunk.load(ContainerMediaChunk.java:124)\n\tat com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:412)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)\n\tat java.lang.Thread.run(Thread.java:920)\n"],"user_comment":""}

When this happens I usually just back out of the video and re open it to cause it to pick up from where I was with no issues. Maybe the bug in this issue is the background equivalent of this other foreground-oriented version i have been noticing?

I think this a good theory. I have the same error from time to time. In my case I think the disconnect happens because I have two access points with same SSID and my phone dictates the roaming strategy. Means, I cannot influence when my phone will switch from 2,4 GHz to 5 GHz network and vise versa.
The same would happen, if the phone is switching from wifi to mobile network sitting in train, or having short interrupt in mobile network.

It would be super nice, if NewPipe was more resilient against network interrupts.

@godfuture
Copy link

I think this a good theory. I have the same error from time to time. In my case I think the disconnect happens because I have two access points with same SSID and my phone dictates the roaming strategy. Means, I cannot influence when my phone will switch from 2,4 GHz to 5 GHz network and vise versa. The same would happen, if the phone is switching from wifi to mobile network sitting in train, or having short interrupt in mobile network.

It would be super nice, if NewPipe was more resilient against network interrupts.

I have to correct the statement a bit. Now I had more time monitoring it and I noticed the app crashes with 403 even without network changes. Like this the app is close to unusable because after crash I cannot resume the video. I always have to force close the app and restart the video..but for how many minutes of playtime?

@MoralCode
Copy link

the 403 error might be off topic for this issue (or tangentially related at best) and it was my mistake for mentioning it in this issue - here is the issue tracking that specific problem: #10174

taking a surface-level look at some of the other issues that it links to does seem to suggest a certain similarity to the symptoms discovered here (vaguely related to network changes, but also happening on a stable network). The devs may be more equipped to examine the true causes than I am though

@SameenAhnaf SameenAhnaf mentioned this issue Aug 31, 2023
6 tasks
@OldGuyInTheClub
Copy link
Author

Checking in again to see if there are any insights on why this problem could have started with v24.0 after working with prior versions. The Releases page shows a number of changes incorporated into v24.0 but I have no idea if any/any combination of them could be responsible.

Alternately, I'm comfortable with closing this issue if there is no alternative but to live with/work around the crashes.

@AudricV
Copy link
Member

AudricV commented Sep 17, 2023

I think I found the cause of the issue.

The player service seems to be only started in the foreground after playback has been initialized (so after the ExoPlayer instance is created and probably after stream info is loaded).

If this process takes a lot of time, a ForegroundServiceDidNotStartInTimeException on Android 12 and higher exception should be thrown by the system and a RemoteServiceException between Android 8.0 and Android 11 versions, due to restrictions on foreground services introduced with Android 8.0. Both exceptions have in their message Context.startForegroundService() did not then call Service.startForeground(). See https://developer.android.com/reference/android/content/Context#startForegroundService(android.content.Intent) for more details.

This issue was also present in the past and has been resolved with fbcdaa7.

In 0.23.3, the notification was created and the service was putted in the foreground state before handling the intent which started playback in the player, see the following code:

NotificationUtil.getInstance().createNotificationAndStartForeground(player, this);

The fix was then removed in 0.24.0: see 76ced59#diff-a9f8070f8db88aff3228ca5d69babc66fc7dd3df469e1cdc935ce426aea20178L109.

So the issue should be fixed by reintroducing the creation of the player service notification and starting the player service in foreground before handling intents in the player.

This would also reintroduce the ghost notification when you use a media button on an external device such as a Bluetooth one and NewPipe was the last media app used. I think the issue can be resolved by stopping the player service when there is nothing to play and a media button receiver intent is received.

The following patch should solve the issue and the one I described which would come back:

Subject: [PATCH] Create notification and start player service in foreground when creating in the player

This behavior was present before 0.24.0 and the player UI separation and
avoided crashes for which their exception contained
"Context.startForegroundService() did not then call Service.startForeground()".

Some player nullability checks have been also added.
---
Index: app/src/main/java/org/schabi/newpipe/player/notification/NotificationPlayerUi.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationPlayerUi.java
--- a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationPlayerUi.java	(revision b5463cf5e14e9b98cb97744cc3dfb5e34a315259)
+++ b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationPlayerUi.java	(date 1694718257649)
@@ -17,7 +17,6 @@
 import org.schabi.newpipe.player.ui.PlayerUi;

 public final class NotificationPlayerUi extends PlayerUi {
-    private boolean foregroundNotificationAlreadyCreated = false;
     private final NotificationUtil notificationUtil;

     public NotificationPlayerUi(@NonNull final Player player) {
@@ -25,15 +24,6 @@
         notificationUtil = new NotificationUtil(player);
     }

-    @Override
-    public void initPlayer() {
-        super.initPlayer();
-        if (!foregroundNotificationAlreadyCreated) {
-            notificationUtil.createNotificationAndStartForeground();
-            foregroundNotificationAlreadyCreated = true;
-        }
-    }
-
     @Override
     public void destroy() {
         super.destroy();
@@ -122,4 +112,8 @@
         super.onPlayQueueEdited();
         notificationUtil.createNotificationIfNeededAndUpdate(false);
     }
+
+    public void createNotificationAndStartForeground() {
+        notificationUtil.createNotificationAndStartForeground();
+    }
 }
Index: app/src/main/java/org/schabi/newpipe/player/PlayerService.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayerService.java b/app/src/main/java/org/schabi/newpipe/player/PlayerService.java
--- a/app/src/main/java/org/schabi/newpipe/player/PlayerService.java	(revision b5463cf5e14e9b98cb97744cc3dfb5e34a315259)
+++ b/app/src/main/java/org/schabi/newpipe/player/PlayerService.java	(date 1694718373526)
@@ -29,6 +29,7 @@
 import android.util.Log;

 import org.schabi.newpipe.player.mediasession.MediaSessionPlayerUi;
+import org.schabi.newpipe.player.notification.NotificationPlayerUi;
 import org.schabi.newpipe.util.ThemeHelper;

 import java.lang.ref.WeakReference;
@@ -59,6 +60,13 @@
         ThemeHelper.setTheme(this);

         player = new Player(this);
+
+        // Create the player notification and start immediately the service in foreground,
+        // otherwise if nothing is played or initializing the player and its components (especially
+        // loading stream metadata) takes a lot of time, the app would crash on Android 8+ as the
+        // service would never be put in the foreground while we said to the system we would do so
+        player.UIs().get(NotificationPlayerUi.class)
+                .ifPresent(NotificationPlayerUi::createNotificationAndStartForeground);
     }

     @Override
@@ -69,9 +77,11 @@
         }

         if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())
-                && player.getPlayQueue() == null) {
-            // No need to process media button's actions if the player is not working, otherwise the
-            // player service would strangely start with nothing to play
+                && (player == null || player.getPlayQueue() == null)) {
+            // No need to process media button's actions if the player is not working, otherwise
+            // the player service would strangely start with nothing to play
+            // Stop the service in this case
+            stopSelf();
             return START_NOT_STICKY;
         }

@@ -87,7 +97,7 @@
             Log.d(TAG, "stopForImmediateReusing() called");
         }

-        if (!player.exoPlayerIsNull()) {
+        if (player != null && !player.exoPlayerIsNull()) {
             // Releases wifi & cpu, disables keepScreenOn, etc.
             // We can't just pause the player here because it will make transition
             // from one stream to a new stream not smooth
@@ -98,7 +108,7 @@
     @Override
     public void onTaskRemoved(final Intent rootIntent) {
         super.onTaskRemoved(rootIntent);
-        if (!player.videoPlayerSelected()) {
+        if (player != null && !player.videoPlayerSelected()) {
             return;
         }
         onDestroy();

I built a debug APK with these changes based on b1ab261, could you test if it fixes the issue? Thanks in advance.

app-debug.zip

@OldGuyInTheClub
Copy link
Author

This is terrific! I don't understand the details but I think I follow the argument at the proverbial 100-kft level.

@AudricV : Is it me you would like to test this fix or the devs? If me, can you let me know how best to proceed? Should I:

  • Install this alongside the current NewPipe?
  • Backup current NewPipe info, delete NP, and try your version?
  • Something else?

Thank you for your deep dive into this problem.

@AudricV
Copy link
Member

AudricV commented Sep 18, 2023

@OldGuyInTheClub Yes, I ask you to test this debug build, importing existing settings and database shouldn't matter, but please do so to be sure the problem doesn't happen with existing data.

You don't need to uninstall the official release of the app.

@OldGuyInTheClub
Copy link
Author

Will do. Will get back to you in a couple of days.

@OldGuyInTheClub
Copy link
Author

@AudricV I am very encouraged! I've used your APK for 48+ hours and I can go from home wifi to the cellular network, drive around far enough to switch to multiple towers, go in and out of airplane mode, and so far no crashes.

I backed up my NewPipe data and imported it into this version.

If it's ok with you, I'd like to monitor it for a few more days just to be sure.

@annervisser
Copy link

@AudricV I've installed your test build last night, and this morning I once again got the did not then call Service.startForeground() error a minute into a video.

Screenshot_20230921-073753

Actions taken:

  • Opened app
  • pull to refresh
  • click a video
  • press fullscreen button
  • watch entire video
  • use back gesture to exit fullscreen
  • use back gesture again to minimize video
  • click other video
  • press fullscreen button
  • ~1 minute into the video I get "NewPipe is not responding popup"

Running GrapheneOS (Android 13) on a Pixel 6

Error:

type: ANR
osVersion: google/oriole/oriole:13/TQ3A.230901.001/2023091800:user/release-keys
package: org.schabi.newpipe.debug.fixplayerserviceforegroundstart:994
process: org.schabi.newpipe.debug.fixplayerserviceforegroundstart
installer: com.android.packageinstaller

activity: null
cause: ANR Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{414eac0 u0 org.schabi.newpipe.debug.fixplayerserviceforegroundstart/org.schabi.newpipe.player.PlayerService}
info: ANR in org.schabi.newpipe.debug.fixplayerserviceforegroundstart
PID: 14707
Reason: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{414eac0 u0 org.schabi.newpipe.debug.fixplayerserviceforegroundstart/org.schabi.newpipe.player.PlayerService}
ErrorId: 8785639d-e495-4ff8-9185-45fa230a4771
Frozen: false
Load: 3.08 / 3.08 / 2.8
----- Output from /proc/pressure/memory -----
some avg10=0.00 avg60=0.00 avg300=0.00 total=8272761
full avg10=0.00 avg60=0.00 avg300=0.00 total=2905108
----- End output from /proc/pressure/memory -----

CPU usage from 0ms to 7574ms later (2023-09-21 07:37:36.329 to 2023-09-21 07:37:43.903):
  52% 14707/org.schabi.newpipe.debug.fixplayerserviceforegroundstart: 39% user + 13% kernel / faults: 44173 minor 219 major
  26% 1427/system_server: 13% user + 12% kernel / faults: 44817 minor 910 major
  17% 2091/com.android.systemui: 10% user + 7.2% kernel / faults: 53517 minor 584 major
  2.3% 2889/com.android.inputmethod.latin: 1.5% user + 0.8% kernel / faults: 12941 minor 3634 major
  12% 1117/media.swcodec: 7.4% user + 5.1% kernel / faults: 6502 minor 99 major
  11% 578/surfaceflinger: 7.7% user + 3.8% kernel / faults: 2340 minor 2 major
  10% 908/[email protected]: 6.3% user + 4.3% kernel / faults: 118 minor 6 major
  3.1% 584/[email protected]: 1.7% user + 1.4% kernel
  0% 1056/media.extractor: 0% user + 0% kernel / faults: 2827 minor 53 major
  0% 3574/com.android.nfc: 0% user + 0% kernel / faults: 3777 minor 3347 major
  1.9% 932/audioserver: 0.1% user + 1.8% kernel / faults: 233 minor 16 major
  0% 1067/media.codec: 0% user + 0% kernel / faults: 1267 minor 58 major
  1.3% 6627/org.thoughtcrime.securesms: 1% user + 0.2% kernel / faults: 12 minor 4 major
  1.1% 242/decon0_kthread: 0% user + 1.1% kernel
  1.1% 850/android.hardware.audio.service: 0.2% user + 0.9% kernel
  1.1% 2477/com.android.phone: 0.7% user + 0.3% kernel / faults: 1544 minor 731 major
  0% 93/kswapd0: 0% user + 0% kernel
  0% 2444/com.samsung.slsi.telephony.oemril: 0% user + 0% kernel / faults: 2147 minor 3212 major
  0.9% 720/android.hardware.power-service.pixel-libperfmgr: 0.3% user + 0.5% kernel
  0.1% 2295/com.shannon.qualifiednetworksservice: 0% user + 0% kernel / faults: 1958 minor 2111 major
  0.9% 2313/com.android.networkstack.process: 0.3% user + 0.5% kernel / faults: 1817 minor 1907 major
  0.1% 2324/com.samsung.slsi.telephony.oem.oemrilhookservice: 0% user + 0.1% kernel / faults: 1963 minor 2767 major
  0% 2405/com.shannon.rcsservice: 0% user + 0% kernel / faults: 2145 minor 2981 major
  0.1% 2426/com.shannon.imsservice: 0% user + 0.1% kernel / faults: 1707 minor 1623 major
  0.1% 2368/com.android.se: 0% user + 0% kernel / faults: 2019 minor 2692 major
  0.7% 20568/kworker/u16:1-BBD_1HZ_TICK: 0% user + 0.7% kernel
  0.5% 236/irq/419-1c8d000: 0% user + 0.5% kernel
  0.5% 538/sugov:0: 0% user + 0.5% kernel
  0.3% 12/rcu_preempt: 0% user + 0.3% kernel
  0.3% 13/rcuog/0: 0% user + 0.3% kernel
  0.3% 49/rcuog/4: 0% user + 0.3% kernel
  0% 727/tombstoned: 0% user + 0% kernel / faults: 135 minor 134 major
  0.3% 833/statsd: 0% user + 0.3% kernel / faults: 19 minor 33 major
  0% 834/netd: 0% user + 0% kernel / faults: 12 minor 15 major
  0.3% 4042/org.mozilla.firefox: 0.2% user + 0.1% kernel / faults: 318 minor
  0.3% 20349/kworker/u17:0-kbase_pm_poweroff_wait: 0% user + 0.3% kernel
  0.2% 50/rcuop/4: 0% user + 0.2% kernel
  0% 64/rcuop/6: 0% user + 0% kernel
  0.2% 522/logd: 0% user + 0.2% kernel / faults: 49 minor 2 major
  0.2% 539/sugov:4: 0% user + 0.2% kernel
  0% 556/keystore2: 0% user + 0% kernel / faults: 12 minor 7 major
  0% 1057/media.metrics: 0% user + 0% kernel / faults: 13 minor 12 major
  0% 1061/mediaserver: 0% user + 0% kernel / faults: 12 minor 8 major
  0.2% 17292/kworker/4:0-memlat_wq: 0% user + 0.2% kernel
  0.2% 20833/kworker/0:0-memlat_wq: 0% user + 0.2% kernel
  0.1% 11/ksoftirqd/0: 0% user + 0.1% kernel
  0.1% 14/rcuop/0: 0% user + 0.1% kernel
  0.1% 28/rcuop/1: 0% user + 0.1% kernel
  0.1% 57/rcuop/5: 0% user + 0.1% kernel
  0% 136/thermal_BIG: 0% user + 0% kernel
  0.1% 540/sugov:6: 0% user + 0.1% kernel
  0% 545/vold: 0% user + 0% kernel / faults: 14 minor 18 major
  0% 748/loop10: 0% user + 0% kernel
  0.1% 869/rlsservice: 0.1% user + 0% kernel
  0.1% 895/[email protected]: 0% user + 0.1% kernel
  0% 1008/drmserver: 0% user + 0% kernel / faults: 75 minor 62 major
  0.1% 1098/rild_exynos: 0% user + 0.1% kernel
  0.1% 1240/com.google.usf.: 0% user + 0.1% kernel
  0.1% 3611/com.x8bit.bitwarden: 0.1% user + 0% kernel / faults: 2 minor
  0.1% 5942/ch.protonmail.android: 0.1% user + 0% kernel / faults: 2 minor 1 major
  0% 19826/org.mozilla.firefox:tab11: 0% user + 0% kernel / faults: 32 minor 26 major
  0.1% 20396/kworker/2:0-memlat_wq: 0% user + 0.1% kernel
  0.1% 20506/kworker/3:0-memlat_wq: 0% user + 0.1% kernel
  0.1% 20560/kworker/1:3-memlat_wq: 0% user + 0.1% kernel
  0% 20591/kworker/7:0H-kblockd: 0% user + 0% kernel
  0% 20836/kworker/6:3H-kblockd: 0% user + 0% kernel
  0.1% 20938/kworker/7:2-memlat_wq: 0% user + 0.1% kernel
  0.1% 21007/kworker/u17:3-mfc_core/butler: 0% user + 0.1% kernel
  0% 21107/kworker/4:1H-kblockd: 0% user + 0% kernel
  0.1% 21457/kworker/5:1-memlat_wq: 0% user + 0.1% kernel
 +0% 21562/kworker/0:0H-events_highpri: 0% user + 0% kernel
 +0% 21563/kworker/6:2-memlat_wq: 0% user + 0% kernel
 +0% 21566/kworker/5:1H-kblockd: 0% user + 0% kernel
23% TOTAL: 13% user + 9.1% kernel + 0.1% iowait + 0.5% irq + 0.3% softirq
CPU usage from 60ms to 462ms later (2023-09-21 07:37:36.389 to 2023-09-21 07:37:36.791):
  77% 14707/org.schabi.newpipe.debug.fixplayerserviceforegroundstart: 61% user + 15% kernel / faults: 44 minor
    19% 21502/ExoPlayer:Playb: 15% user + 3.8% kernel
    11% 21538/MediaCodec_loop: 7.7% user + 3.8% kernel
    7.7% 14707/foregroundstart: 7.7% user + 0% kernel
    7.7% 21520/ExoPlayer:Loade: 7.7% user + 0% kernel
    7.7% 21549/MediaCodec_loop: 3.8% user + 3.8% kernel
    3.8% 14742/RenderThread: 3.8% user + 0% kernel
    3.8% 14757/hwuiTask1: 3.8% user + 0% kernel
    3.8% 14871/Okio Watchdog: 3.8% user + 0% kernel
    3.8% 14877/HwBinder:14707_: 3.8% user + 0% kernel
    3.8% 21519/ExoPlayer:Loade: 3.8% user + 0% kernel
    3.8% 21543/ExoPlayer:Media: 3.8% user + 0% kernel
    3.8% 21552/ExoPlayer:Media: 3.8% user + 0% kernel
  39% 1427/system_server: 9% user + 30% kernel / faults: 504 minor
    36% 21561/AnrConsumer: 12% user + 24% kernel
  14% 908/[email protected]: 8.7% user + 5.8% kernel / faults: 6 minor
    2.9% 21540/HwBinder:908_7: 2.9% user + 0% kernel
    2.9% 21545/HwBinder:908_7: 0% user + 2.9% kernel
    2.9% 21547/HwBinder:908_7: 2.9% user + 0% kernel
    2.9% 21548/HwBinder:908_7: 2.9% user + 0% kernel
  10% 578/surfaceflinger: 8.1% user + 2.7% kernel
    8.1% 578/surfaceflinger: 8.1% user + 0% kernel
    2.7% 701/surfaceflinger: 0% user + 2.7% kernel
  12% 1117/media.swcodec: 9% user + 3% kernel / faults: 12 minor
    9% 21550/id.opus.decoder: 6% user + 3% kernel
    3% 1210/HwBinder:1117_1: 3% user + 0% kernel
  2.4% 12/rcu_preempt: 0% user + 2.4% kernel
  2.5% 50/rcuop/4: 0% user + 2.5% kernel
  2.7% 584/[email protected]: 0% user + 2.7% kernel
    2.7% 584/binder:584_2: 0% user + 2.7% kernel
  2.8% 834/netd: 2.8% user + 0% kernel
  2.9% 932/audioserver: 2.9% user + 0% kernel
    2.9% 1395/AudioOut_15: 2.9% user + 0% kernel
  4% 20568/kworker/u16:1-events_unbound: 0% user + 4% kernel
24% TOTAL: 14% user + 8.5% kernel + 0.3% iowait + 0.9% irq + 0.6% softirq

@AudricV
Copy link
Member

AudricV commented Sep 21, 2023

@annervisser Could you provide the complete stack trace of the corresponding crash which should happen when closing the player, according to similar reports?

@annervisser
Copy link

annervisser commented Sep 21, 2023

@annervisser Could you provide the complete stack trace of the corresponding crash which should happen when closing the player, according to similar reports?

@AudricV
Most of the time it never actually crashes and so I don't get a stacktrace.
After trying a couple of times (I'm able to reproduce this quite easily), I got a trace:

I screen recorded it, in case that's of any help:

signal-2023-09-21-12-55-47-192.mp4

Exception

  • User Action: ui error
  • Request: ACRA report
  • Content Country: GB
  • Content Language: en-GB
  • App Language: en_GB
  • Service: none
  • Version: 0.25.2
  • OS: Linux Android 13 - 33
Crash log

android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{57afda3 u0 org.schabi.newpipe.debug.fixplayerserviceforegroundstart/org.schabi.newpipe.player.PlayerService}
	at android.app.ActivityThread.generateForegroundServiceDidNotStartInTimeException(ActivityThread.java:2011)
	at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:1985)
	at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2247)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7940)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
Caused by: android.app.StackTrace: Last startServiceCommon() call for this service was made here
	at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1935)
	at android.app.ContextImpl.startForegroundService(ContextImpl.java:1890)
	at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:822)
	at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:822)
	at androidx.core.content.ContextCompat$Api26Impl.startForegroundService(ContextCompat.java:1091)
	at androidx.core.content.ContextCompat.startForegroundService(ContextCompat.java:749)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.openMainPlayer(VideoDetailFragment.java:1128)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.$r8$lambda$2AqzXzm7Dd_AK59LBgrtlNnr-I8(Unknown Source:0)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment$$ExternalSyntheticLambda56.run(Unknown Source:2)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.replaceQueueIfUserConfirms(VideoDetailFragment.java:2081)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.openVideoPlayer(VideoDetailFragment.java:1083)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.openVideoPlayerAutoFullscreen(VideoDetailFragment.java:1096)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.lambda$runWorker$32(VideoDetailFragment.java:846)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.$r8$lambda$yO9w4bII-7LTl9F0EIApbmkEC3Q(Unknown Source:0)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment$$ExternalSyntheticLambda58.accept(Unknown Source:8)
	at io.reactivex.rxjava3.internal.observers.ConsumerSingleObserver.onSuccess(ConsumerSingleObserver.java:62)
	at io.reactivex.rxjava3.internal.operators.single.SingleObserveOn$ObserveOnSingleObserver.run(SingleObserveOn.java:81)
	at io.reactivex.rxjava3.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:123)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	... 6 more


Another trace from a different crash:
android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{7ab111d u0 org.schabi.newpipe.debug.fixplayerserviceforegroundstart/org.schabi.newpipe.player.PlayerService}
	at android.app.ActivityThread.generateForegroundServiceDidNotStartInTimeException(ActivityThread.java:2011)
	at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:1985)
	at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2247)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7940)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
Caused by: android.app.StackTrace: Last startServiceCommon() call for this service was made here
	at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1935)
	at android.app.ContextImpl.startForegroundService(ContextImpl.java:1890)
	at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:822)
	at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:822)
	at androidx.core.content.ContextCompat$Api26Impl.startForegroundService(ContextCompat.java:1091)
	at androidx.core.content.ContextCompat.startForegroundService(ContextCompat.java:749)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.openMainPlayer(VideoDetailFragment.java:1128)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.$r8$lambda$2AqzXzm7Dd_AK59LBgrtlNnr-I8(Unknown Source:0)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment$$ExternalSyntheticLambda56.run(Unknown Source:2)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.replaceQueueIfUserConfirms(VideoDetailFragment.java:2081)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.openVideoPlayer(VideoDetailFragment.java:1083)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.openVideoPlayerAutoFullscreen(VideoDetailFragment.java:1096)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.lambda$runWorker$32(VideoDetailFragment.java:846)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.$r8$lambda$yO9w4bII-7LTl9F0EIApbmkEC3Q(Unknown Source:0)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment$$ExternalSyntheticLambda58.accept(Unknown Source:8)
	at io.reactivex.rxjava3.internal.observers.ConsumerSingleObserver.onSuccess(ConsumerSingleObserver.java:62)
	at io.reactivex.rxjava3.internal.operators.single.SingleObserveOn$ObserveOnSingleObserver.run(SingleObserveOn.java:81)
	at io.reactivex.rxjava3.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:123)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	... 6 more

@OldGuyInTheClub
Copy link
Author

@annervisser FWIW, I tried your steps several times but did not get any crashes although my config may be different from yours. I had to turn off screen rotate to get the fullscreen button to appear. The back gesture (swipe) didn't work so I used the back arrow at the bottom of the screen instead.

Galaxy S10+, OneUI, Android 12.4.14.190, last s/w update September 8, 2023

@OldGuyInTheClub
Copy link
Author

@AudricV No crashes after two more days. I think you've fixed it for me, at least.

If the patch is not accepted for whatever reason into the next release, is there anything I can do on the phone side to prevent this problem? Maybe there is a Developer setting, configuration change, or something else to set?

@Zumux
Copy link

Zumux commented Sep 25, 2023

I was also having this issue. Looks like the build provided by @AudricV seems to solve the problem though. Hope now that it's solved it gets fixed in the next release.

@OldGuyInTheClub
Copy link
Author

OldGuyInTheClub commented Sep 30, 2023

The fix also resolved two other problems I was having:

  1. Partially viewed videos would usually not restart. Now, they do. I can resume watching videos even after many days
  2. Search terms are remembered. Newpipe search always worked but for a long time, my search terms would not appear in the history. Now, I have a complete record.

@TobiGr
Copy link
Member

TobiGr commented Sep 30, 2023

That lools like you've disabled search and watch history in the settings. Can you check that for us, please?

@OldGuyInTheClub
Copy link
Author

OldGuyInTheClub commented Sep 30, 2023

Settings -> History and Cache:

Watch history, Resume playback, Positions in lists, and Search history are enabled in both Newpipe 25.2 and @AudricV's Debug version.

Added thoughts:
To clarify, I have had a long list of searches in my history for a while. At some point, my new searches didn't get saved to the history. I don't remember when it started happening but it was not a big deal so I ignored it. With the debug version, new searches are logged to the search history.

Speculation: When the software was crashing, perhaps things like new search entries got dropped because files that would have/should have gotten updated did not?

Regarding resuming playback, I filed this Feature Request a long time ago to get around the problem #4574
The inability to resume was identified as a problem to be fixed vs. creating a workaround. This debug version appears to have addressed it.

@MoralCode

This comment was marked as duplicate.

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