Newpipe: Background stream playback fails and can't recover (Expired stream link)

Created on 5 Apr 2018  路  22Comments  路  Source: TeamNewPipe/NewPipe

Hello! I use Newpipe to play music while walking and it's fantastic.

However I noticed that streams will sometimes stop playing after a while with a toast message saying "failed to playback stream" or similar. From here, the play back controls are all greyed out, and the "swipe menu" entry lists the current video as "[Unknown] [Unknown]". The only solution is to reopen the video and manually seek to where it got stuck. Apologies if this is a known issue, I tried to search but the Github phone interface isn't great.

bug player

Most helpful comment

@DestyNova
[Unknown] states should only occur during player initialization, so the case you described seems to be the device force killing the background player to free up resources, and the app then tries to recover but can't because the player state and play queue are lost. This can happen when the device is low on memory or has some kind of power-saving features turned on. Can you provide us with some extra information such as your app version, device specs and possibly a screenshot/video of this occuring?

@theScrabi
Outside of the scenario above, "failure to play a stream" (internal player) errors should not cause anything catastrophic besides skipping/removing the current play queue item, retry or keep on going.

However, player recovery is something that was discussed in #1242, as we have to deal with the player being shut down by the system at any moment and be able to recover and continue playing.

A couple things we can do in the future about this:

  • Save the latest closed/crashed player's state and play queue into the preferences, so the player can be recovered.
  • As an extension of the above, we can then allow the system to stop the service more frequently when paused, as indicated by android guidelines. This should also allow us to free some memory and locks (wake/wifi).

All 22 comments

I think this is a new one. However that streams sometimes fail is indeed known to us.
@karyogamy do you know something about this?

@DestyNova
[Unknown] states should only occur during player initialization, so the case you described seems to be the device force killing the background player to free up resources, and the app then tries to recover but can't because the player state and play queue are lost. This can happen when the device is low on memory or has some kind of power-saving features turned on. Can you provide us with some extra information such as your app version, device specs and possibly a screenshot/video of this occuring?

@theScrabi
Outside of the scenario above, "failure to play a stream" (internal player) errors should not cause anything catastrophic besides skipping/removing the current play queue item, retry or keep on going.

However, player recovery is something that was discussed in #1242, as we have to deal with the player being shut down by the system at any moment and be able to recover and continue playing.

A couple things we can do in the future about this:

  • Save the latest closed/crashed player's state and play queue into the preferences, so the player can be recovered.
  • As an extension of the above, we can then allow the system to stop the service more frequently when paused, as indicated by android guidelines. This should also allow us to free some memory and locks (wake/wifi).

I think this is related to the problem of #973. I reported this bug when I still had in android nougat and now that I change to oreo it still happens. sometimes the player closes unexpectedly

If the OP uses MIUI then please be aware that that Android skin is rather aggressive when it comes to memory optimization and battery saving by default.

I use MIUI on my phone hence the reason I know this ;)

These are some of the options available in the Developer Options menu: https://preview.ibb.co/gR5wpx/Screenshot_2018_04_07_12_41_00_297_com_android_settings.png

@karyogamy @theScrabi Thanks, I should have mentioned that these indeed seem like "normal" conditions for playback to fail -- often I'll pause playback (of a long music stream) and switch to airplane mode overnight, then resume the next morning. Often it will continue playing fine for a short while, then stop and go into "[Unknown]" mode.

Here's a screenshot from my phone's "swipe" menu (what is that thing called?) just after playback got stuck. Note how all the controls are greyed out:

image

If I tap the thumbnail (which was actually blank shortly before playback stopped) to open the background player screen, it looks like normal but with a spinner instead of a play button, spinning indefinitely.

I'm currently using Newpipe beta 0.12.0 from Fdroid, and had the same outcome with stable 0.11.6, and running on an UMI Plus with Android 7.0.

Newpipe beta 0.12.0

Might be a good time to update to stable 0.13.1, since it contains some player updates which might fix this problem.

If I tap the thumbnail (which was actually blank shortly before playback stopped) to open the background player screen, it looks like normal but with a spinner instead of a play button, spinning indefinitely.

Is the playlist still populated or is it now blank?

In any case, thanks for the update. I'll try and replicate this issue on 0.13.1 and see what I can do about this.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I'm not experiencing this issue anymore, can anybody confirm? @DestyNova

Not sure -- I've not been using that feature for quite a while, but I'll test it again and try to confirm or close in a day or so.

It's actually still happening, but not exactly the same as before. I started playing something in the background yesterday, then paused it and switched my phone to airplane mode.

When I tried to resume play just now, the play button turned into a permanent spinner but playback did not resume. I took a screenshot but it was completely black for some reason.

The widget in the notifications area (when I swipe down from the top of the screen) looks like it's playing, except that it's not:
cropped-newpipe-bg-stuck

Unfortunately I couldn't find anything with logcat, but perhaps because I connected it to my phone after this happened. If you can advise of a good way to get stack traces, I'll try that.

The stream can't resume due to an expired link, see #938

@Stypox But that issue is closed by a PR? So does that mean we still don't generate expired links despite the attempted fix?

@opusforlife2 that issue was closed in a downloader PR, so that's unrelated to the player, I think. So this is still an issue.

I actually haven't encountered the issue for a long time, but I haven't been resuming playback on long videos either. I'll try to test it again over the next few days.

Ok! I tested again and the situation appears to be the same as the last screenshot I posted. It looks like it's playing, but it's not, and tapping the pause button produces no response. I can tap the rewind button to go back 10 seconds, but playback stops at the same point where I originally paused it.

Thanks for confirming!

One other thing I've noticed just now: if I'm playing a playlist in the background and this condition occurs, I can skip back to earlier videos in the playlist. But if I then go forward to the one with the expired link, it refuses to play, saying "Could not play this stream". If I move forward to the next item in the playlist, I won't be able to go back to earlier items (with the forward/backward buttons). So it seems the expired state persists for a while.

If instead of the Previous/Next buttons, you directly jump to either side of the faulty stream from the in-player queue, does it work?

I wasn't quite sure what you meant, but I tried opening the in-player queue and was able to play other videos in the queue, then go back to the one that was stuck and it starts playing again from 0:00, presumably with a fresh link. Or did you mean using the seek bar without changing to another video? I'll try that next time.

No, I meant skipping the faulty stream entirely. Try to play the one before it, and the one after it in the queue.

Yes that's what I meant. I was able to play the previous and next streams in the queue, then go back to the broken one. It restarted from the beginning, but I was able to seek to where it got stuck before and it kept playing.

Yeap, it fails each time now i'm using background.

Was this page helpful?
0 / 5 - 0 ratings