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

Video stops playing at around the end part of videos #7529

Closed
4 tasks done
ghost opened this issue Dec 12, 2021 · 24 comments · Fixed by #7555
Closed
4 tasks done

Video stops playing at around the end part of videos #7529

ghost opened this issue Dec 12, 2021 · 24 comments · Fixed by #7555
Labels
bug Issue is related to a bug device/software specific Issues that only happen on some devices or with some specific hardware/software player Issues related to any player (main, popup and background)

Comments

@ghost
Copy link

ghost commented Dec 12, 2021

Checklist

Steps to reproduce the bug

  1. Play random video
  2. Wait until it reaches about the start of the last quarter of the video
  3. The video does not proceed
  4. If I shuffle somewhere it continues basically immediately.

Actual behavior

The stream stops playing and loads.

Expected behavior

The stream/video does not stop playing.

Screenshots/Screen recordings

Logs

Device info

  • Android version/Custom ROM version: Android 11, OneUI 3.1
  • Device model: SM-A528B/DS
@ghost ghost changed the title Video stops playing at the end of videos Video stops playing at around the end part of videos Dec 12, 2021
@krtfwd
Copy link

krtfwd commented Dec 13, 2021

Exact Same issue started with the latest update .14
android 11 rkq1.200826.002
miui 12.5.3
Poco x3 nfc surya

@Datastream33
Copy link

Yeah, I'm experiancing the same issue.

Android 11
OxygenOS 11.1.2.2
OnePlus 6T

@frauhottelmann
Copy link

Same for me.

Android 11
LineageOS 18.1
Xiaomi Mi Mix 2s and Samsung Galaxy Tab S5e

@Para-lyzed
Copy link

Para-lyzed commented Dec 17, 2021

This is at least similar to an issue I'm having. Videos at 1080p60 stop playing at the timestamp 7:33, but if I change to another resolution and then back to 1080p60, the rest of the video seems to play fine. When you experience this next, could you check the timestamp?

Android 11
CrDroid 7.6
OnePlus 7 Pro

@cybe
Copy link

cybe commented Dec 17, 2021

It seems to stop at a specific duration before the end of the video. Not from the beginning.

The next time it happens I check whether its an absolute duration or relative to the video length.

@Para-lyzed
Copy link

Hm, I watched a few more videos, and it seems like the 5 or so videos that stopped at 7:33 were a fluke. With a few more videos, it seems as if they are not stopping at a consistent time from the start, a consistent time from the end, or a consistent percentage. 2 of the most recent videos that I recorded this experience on were a 14:41 video that stopped at 7:33, and a 29:27 video that stopped at 10:50. It seems like it may be random for me after all, though it was weird that I had so many videos in a row of different lengths thst stopped at 7:33. It might be worth recording the lengths of the videos and the timestamp they stop at in the future to see if there's a trend for you. I will continue to do the same and post here if my results yield any useful information.

@ghost
Copy link
Author

ghost commented Dec 17, 2021

When you experience this next, could you check the timestamp?

Will do.

Update: I remember that it's inconsistent for me as well. But it's always about at the beginning of the last quarter of almost if not all videos.

@frauhottelmann
Copy link

Stopped at 24:12 of 30:41

@Para-lyzed
Copy link

Para-lyzed commented Dec 17, 2021

Okay, quick update. I've collected some data on more videos and found out some interesting stuff. Below is a table of collected times at which a variety of videos of different lengths have stopped.

Length Stopping point From end Percentage Link
14:41 7:33 7:08 51.4% https://www.youtube.com/watch?v=14QvE_89P3c
29:27 10:50 18:37 36.8% https://www.youtube.com/watch?v=v3r1SIbyMAk
54:31 9:31 45:00 17.5% https://www.youtube.com/watch?v=eCbQksbecog
15:38 7:56 7:42 50.7% https://www.youtube.com/watch?v=JCteP_2dWMs
17:48 7:33 10:15 42.4% https://www.youtube.com/watch?v=DJIQsSazfC8
6:45 none none none https://www.youtube.com/watch?v=7jHpJ1VB568
14:28 8:19 6:09 57.5% https://www.youtube.com/watch?v=Fw7BB7xSYbw
3:14:02 9:42 3:04:20 5.0% https://www.youtube.com/watch?v=8iMHWz-5Tss
8:21 7:12 1:09 82.2% https://www.youtube.com/watch?v=72aJqZ459oI

I've rewatched a few videos, and they stop at the same timestamp after I clear the cache and rewatch the video. Additionally, I wanted to see if pausing would change it, so I paused for 10 seconds near the beginning of the video, and it still stopped at the same timestamp. I tried out scrubbing, and if I skipped to about 2 minutes in, the video would never stop. I have not tried scrubbing for different amounts of time. The time the video stops does not appear to be directly correlated to the total length of the video. In my experience, the video will also only stop once, no matter the length. All videos were 1080p60. I haven't seen this issue with 720p videos.

I'm interested in finding out if these videos stop at the same timestamps for you guys. If you can find a video you'd want to watch in this list (you obviously don't have to watch past the time where it stops), I think it would be worth trying and letting me know.

I may also collect some data at a later date that analyzes when different videos of the same length stop to confirm/deny whether the length does not correlate. Regardless, I will continue collecting timestamps for every video I watch in case anyone wants more data.

EDIT: If you do compare timestamps, then do so without skipping or scrubbing through the video. Additionally, if you have issues where pausing can sometimes cause you to have to reload the video like I do, then it would be best not to pause either, even though it appears that pausing doesn't matter (at least so long as you don't have to reload the video).

@tameem-hub
Copy link

Stops background play 1 to 3 min before the video ends for 15 to 20 min long video, loading icon appears in notification, there is no issue while playing videos.

OnePlus 6
Android 11

@cybe
Copy link

cybe commented Dec 18, 2021

I've collected some data on more videos and found out some interesting stuff. Below is a table of collected times at which a variety of videos of different lengths have stopped.

My observations using the same samples: Got different stopping points, but also consistent between multiple attempts (clear cache, force close app, play from beginning). Playback speed didn't had any effect on the stopping point either. I tend to watch everything on 1.7x.

Contrary to your results my stopping points are actualy more to the end of each video.

Length Stopping point From end Percentage Link
14:41 12:58 1:43 88.3% https://www.youtube.com/watch?v=14QvE_89P3c
29:27 28:06 1:21 95.4% https://www.youtube.com/watch?v=v3r1SIbyMAk
54:31 not tested not tested not tested https://www.youtube.com/watch?v=eCbQksbecog
15:38 15:12 0:26 97.2% https://www.youtube.com/watch?v=JCteP_2dWMs
17:48 17:17 0:31 97.1% https://www.youtube.com/watch?v=DJIQsSazfC8
6:45 none none none https://www.youtube.com/watch?v=7jHpJ1VB568
14:28 13:00 1:28 89.9% https://www.youtube.com/watch?v=Fw7BB7xSYbw
3:14:02 not tested not tested not tested https://www.youtube.com/watch?v=8iMHWz-5Tss
8:21 6:29 1:52 77.6% https://www.youtube.com/watch?v=72aJqZ459oI

@Para-lyzed
Copy link

My observations using the same samples: Got different stopping points, but also consistent between multiple attempts (clear cache, force close app, play from beginning). Playback speed didn't had any effect on the stopping point either. I tend to watch everything on 1.7x.

If the speed does not change the stopping point for you, this is quite interesting. I found that the stopping time changed dramatically sometimes when I went from 1x speed to 1.7x speed. Regardless, I'm assuming you tested that, so you still have consistent stopping points at each video, but it seems that the time they stop at is inconsistent across different installs and/or devices. I actually did a fresh install, no settings restore, and I found that my times changed slightly, but were still in the same range. I do still think this is the same issue, the result just differs across installs.

For instance, on the first video, the fresh install had a stopping point of 7:35, but at 1.7x speed it stopped at 11:54. That's closer to your recorded time, so perhaps our differences are actually the result of playback speed differences? On the contrary, however, video 2 stopped at 8:54 for me at 1.7x speed. Also worth noting is that my videos were set to play at 1080p60, and I found that the resolution and framerate does affect this issue. If you were running them at 1080p or 720p60, maybe that would also change the times.

This comparison definitely highlights how weird this issue is. It's incredibly consistent for a single install, but not across different installs, and perhaps different variables like speed may affect times differently across different devices. I don't think I'll include tables of data anymore, it adds a lot more effort and it's just as effective to talk about differences than quantify them exactly when our data is so different to begin with. It's very interesting how consistent your stopping times were for the time from the end of the videos. My data was essentially the complete opposite of that, where everything seemed to be within a range of times from the start of the video.

If I knew how to collect logs for this I would, as I feel like that would be far more helpful from a debugging standpoint. Since it seems most people here are experiencing stops near the end of videos, there's a possibility we are experiencing similar issues caused by different things.

@XiangRongLin XiangRongLin added bug Issue is related to a bug player Issues related to any player (main, popup and background) labels Dec 18, 2021
@XiangRongLin
Copy link
Collaborator

Is someone experiencing this Issue who is NOT using Android 11?

@cybe
Copy link

cybe commented Dec 18, 2021

I found that the stopping time changed dramatically sometimes when I went from 1x speed to 1.7x speed. Regardless, I'm assuming you tested that, so you still have consistent stopping points at each video, ...

You assume correct. But I do some more tests specific to playback speed.

If you were running them at 1080p or 720p60, maybe that would also change the times.

I was using 1080p60 for all my test runs.

Do you use the SponsorBlock fork by any chance? I do, but I disabled section skipping for my test runs. This could however still influence my results somehow.

I attempt to record some logs.

@Para-lyzed
Copy link

Do you use the SponsorBlock fork by any chance? I do, but I disabled section skipping for my test runs. This could however still influence my results somehow.

I did use the SponsorBlock fork for my initial tests, but I installed the official NewPipe APK afterwards, and found the times to be in the same range as the SponsorBlock APK (when I said I did a fresh install, I switched from SponsorBlock to official NewPipe). It's safe to say this issue does not appear to be influenced by SponsorBlock, but I will be using official NewPipe APK for any other testing relating to this bug.

I believe this may just be a case of the same issue presenting itself in different ways. It seems I am the only one in this thread experiencing playback stopping at a consistent range of 6-12 minutes after the start of the video. Most others seem to be experiencing stopping relative to the end of the video. In fact, there is a possibility that I'm experiencing a very similar issue that is fundamentally different, but I find that less likely than just a slightly different presentation.

I do also find it interesting that everyone in this thread experiencing this issue is using Android 11. I know that it's probably just the most used version right now, but I wonder if it has something to do with it.

@cybe
Copy link

cybe commented Dec 18, 2021

I captured a logcat (removed: invalid) for https://www.youtube.com/watch?v=72aJqZ459oI that stops at 6:29

I also noticed something new: When force-closing and clearing cache the video stops at 6:29 every time. However. When I just reset the watch position after the video stops and start the video from the beginning, I got a different stop position.

@litetex
Copy link
Member

litetex commented Dec 18, 2021

@cybe
Thank you for the logs however there are some issue:

  1. This is not a debug version of NewPipe - there are no logs from NewPipe inside there
  2. It contains the complete log of the phone - without a approximate timestamp it's impossible to identify where the error exactly happened

It would be the best if you do the above procedure again however this time with a debug version of NewPipe (the latest debug build can be downloaded from here) and a approximate timestamp (e.g. "when watching video XY at timestamp 6:29 at 12:34 local time") when the problem happened.

@Para-lyzed
Copy link

I also noticed something new: When force-closing and clearing cache the video stops at 6:29 every time. However. When I just reset the watch position after the video stops and start the video from the beginning, I got a different stop position.

Yes, I noticed this as well, which is why I marked the video as watched, then cleared the cache every time that I rewatched something so that it would be as if I were watching it for the first time. When doing that, times were consistent, but otherwise a section of the video would already be loaded in the cache.

@Para-lyzed
Copy link

Para-lyzed commented Dec 19, 2021

@litetex
I've collected a logcat for the video @cybe used before (https://www.youtube.com/watch?v=72aJqZ459oI) with the debug build you linked. The log starts at 22:12:00, the video starts a few seconds later. The video stopped at timestamp 6:29 for me in this log, or just after 22:18:29 (the soonest reference to NewPipe or ExoPlayer I saw was at 22:18:34). I waited until 22:19:00 to select a new resolution so the video continued playing until the end (total length of video is 8:21, so video ended around 22:20:52). Let me know if there's anything else you need, or if you'd like logs of other videos.

This video was run at 1080p60 at 1x speed (selected 1080p60 as default in settings). The video was not paused, no time was skipped, and no settings were changed throughout the video until the stopping point. I had previously watched it a few times attempting to get good logs, and it stopped at different times. I marked the video as watched, force closed the debug app, and cleared the cache before each time watching. The previous times that it stopped with this debug version were timestamps 7:34 and 7:11, and I believe at least 1 of those was at 720p60, which may have made a difference.

UPDATE: I don't know why my stopping times were inconsistent while recording logs, but now that I'm not recording any logs it's stopping at a consistent 7:11 for that video. Perhaps it had something to do with the fact that I was in split screen mode? Or maybe I was tweaking settings and don't remember having changed something each time.

I also think that it's important to note that the video doesn't just stop randomly, it stops because the rest of it is not loaded. When I'm watching the beginning of a video, I see a slightly lighter bar that extends out from the current video position indicating how much of the video is loaded ahead of the position. When the video stops, that bar actually stops beforehand and the video stops when it reaches the position that the lighter bar stops at, indicating that the video isn't loaded at that point. I believe that is why the video doesn't continue until the resolution is changed or some other action is made to reload the video.

@cybe
Copy link

cybe commented Dec 19, 2021

It would be the best if you do the above procedure again however this time with a debug version of NewPipe (the latest debug build can be downloaded from here) and a approximate timestamp (e.g. "when watching video XY at timestamp 6:29 at 12:34 local time") when the problem happened.

Sure thing @litetex: debug1.log. Also this time filtered via adb logcat --pid $(adb shell pidof org.schabi.newpipe.debug) > debug1.log.

Same video https://www.youtube.com/watch?v=72aJqZ459oI. It stops at position 6:36 which is 08:41 local time. I just let the video sat there for about 30 seconds, then I aborted the log capture. Sadly no exception or anything alike I think.

What @Para-lyzed mentioned is crucial: The video does not stop randomly but because the cache has run out. I also noticed I could workaround the issue by just rewinding 10 seconds. The cache gets filled instantly beyond the stopping point.

@cybe
Copy link

cybe commented Dec 19, 2021

My latest results used 720p60, as this was the default upon a fresh install. At 1080p it stops at 6:29 what makes it identical to @Para-lyzed.

@litetex
Copy link
Member

litetex commented Dec 19, 2021

@cybe @Para-lyzed
Thank you for the logs.

However I also can't find any evidence of the bug inside there :/

After some experiments I think I now found the source of problem and how it's reproducible:

  • Wipe all data from your Android emulator
  • Run NewPipe (debug version) on the emulator (Android Studio
  • Set the default video quality to 1080p60
  • Open the video: https://www.youtube.com/watch?v=72aJqZ459oI
  • Immediately after it starts throttle the network connection of the emulator:
    grafik
    (may require turning off the WiFi . I'm not 100% sure how this works exactly...)
  • The video should start buffering
  • Unlimit the network connection → ❌ Playback is not resumed; infinitive buffering

The problem is caused by MediaParser which was introduced in #7005.
However at the current point of time I'm still not sure what exactly causes the problem.
You may checkout the APK from #7555 and check if that fix your problem.

@cybe
Copy link

cybe commented Dec 20, 2021

Thank you for your time working on this issue, @litetex! I can confirm that using the APK from #7555 resolves the issue. Watched the mentioned video three times in a row (with clearing cache) without any problems.

@XiangRongLin XiangRongLin added the device/software specific Issues that only happen on some devices or with some specific hardware/software label Dec 20, 2021
@litetex
Copy link
Member

litetex commented Dec 20, 2021

Further code analysis from my side (click to expand)

I did some further analysis and the problem and it seems to be caused somewhere inside the main ExoPlayer:Loader:ProgressiveMediaPeriod-thread:
grafik
NewPipeData-20210716_190308.zip

When the Thread reaches the 3rd phase aka "Network unthrottled" it fails to load any further data due to "hidden"/"swallowed" exceptions:
grafik
grafik
grafik

grafik
grafik

The exceptions cause the thread to be restarted (every 2s) and so it's stuck in an endless loop which results in the buffering.

However I have no idea how to fix it, beside disabling MediaParser.

I also noticed that the problem only happens with YT; For example media.ccc.de works fine when I tested it.

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 device/software specific Issues that only happen on some devices or with some specific hardware/software player Issues related to any player (main, popup and background)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants