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

Background stream playback fails and can't recover (Expired stream link) #1265

Closed
DestyNova opened this issue Apr 5, 2018 · 23 comments
Closed
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background)

Comments

@DestyNova
Copy link

DestyNova commented Apr 5, 2018

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.

@theScrabi
Copy link
Member

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

@karyogamy
Copy link
Contributor

@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).

@ghost
Copy link

ghost commented Apr 6, 2018

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

@slyscorpion
Copy link

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

@DestyNova
Copy link
Author

@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.

@karyogamy
Copy link
Contributor

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.

@stale
Copy link

stale bot commented Dec 1, 2018

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.

@stale stale bot added the stale label Dec 1, 2018
@TobiGr TobiGr removed the stale label Jul 19, 2019
@Stypox
Copy link
Member

Stypox commented Jul 19, 2019

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

@Stypox Stypox added bug Issue is related to a bug more-info-needed labels Jul 19, 2019
@DestyNova
Copy link
Author

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.

@DestyNova
Copy link
Author

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.

@Stypox
Copy link
Member

Stypox commented Jul 20, 2019

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

@Stypox Stypox added the player Issues related to any player (main, popup and background) label Aug 27, 2019
@opusforlife2
Copy link
Collaborator

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

@Stypox
Copy link
Member

Stypox commented Oct 11, 2020

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

@opusforlife2 opusforlife2 changed the title Background stream playback fails and can't recover Background stream playback fails and can't recover (Expired stream link) Oct 11, 2020
@DestyNova
Copy link
Author

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.

@DestyNova
Copy link
Author

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.

@opusforlife2
Copy link
Collaborator

Thanks for confirming!

@DestyNova
Copy link
Author

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.

@opusforlife2
Copy link
Collaborator

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?

@DestyNova
Copy link
Author

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.

@opusforlife2
Copy link
Collaborator

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

@DestyNova
Copy link
Author

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.

@Flashwalker
Copy link

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

@AudricV
Copy link
Member

AudricV commented Mar 12, 2021

Merging this with #5730.

@AudricV AudricV closed this as completed Mar 12, 2021
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

9 participants