-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Limit speed at live edge #8134
Limit speed at live edge #8134
Conversation
Thank you for the pull request! I know I am bit against these changes, but what do you think of setting only the playback speed to 1x by default only on livestreams? This will allow users to watch streams from the start of the live window up to the maximum speed supported in the app (see what I wrote in #7667 (comment) for more details). So if users increased playback speed and they have issues when using it at the live edge, then they can understand the issue is from them, not from us. |
@TiA4f8R Thank you for the feedback! I was considering setting the default playback speed to 1x for livestreams, but I thought this solution might be less intrusive. This approach allows the user to speed up in the live window, just not in the live edge. In my testing, Youtube livestreams had an ~30 second live window, and only ~5 seconds of that window was the live edge. So only those last ~5 seconds cannot be sped up, and the rest of the window can still be freely controlled. I think this allows the user the most freedom without causing an unpleasant experience due to buffering at the live edge. In terms of notifying the user, I wasn't sure if any notification was necessary. It could be surprising for the user that the speed resets at the live edge, but I also think it might be clear why it occurs. Perhaps a popup message could appear when the speed is reset to explain why it is happening? |
This will be changed with my PR, depending of the streams, up to one hour (for livestreams with DVR of course).
Why not using what YouTube does? When coming to the live edge or being behind the live window, YouTube player(s) reset(s) the playback speed to 1x and seek(s) to the default position. This would solve all the issues without preventing users to select the playback speed. In this case, of course, 1x should be not saved as the default playback speed for videos. |
I had also considered this method. I preferred locking to the default seek position (the current implementation), rather than allowing the user to briefly accelerate past it only to send them back moments later once buffering occurs. I can use the same strategy as Youtube simply by moving the new logic from onUpdateProgress to onBuffering + adding a seek to default. Would this be the best / preferred approach? |
Hello @litetex, can you review my pull request? |
Blocked by #7989 |
Ahh, I see. @litetex Could I close this PR and open a new one without the speed dialogue changes? I can just use the same strategy as Youtube and reset playback speed when buffering at the live edge. That will solve the underlying issue without interfering with any incoming changes to the dialogue. Sorry, I am relatively new to Github, so I'm not sure if this would be appropriate. |
@KosOrKosm no, you PR is perfectly fine, don't worry. What litetex was saying is probably that he wants to merge #7989 (which I will do now) before this PR since they both edit the same file and that causes merge conflicts. By merging #7989 I will create some merge conflicts for you, though, let me know if you need help with solving them ;-) |
@KosOrKosm you might have to rewrite from scratch your changes to |
…SpeedAtLiveEdge # Conflicts: # app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java
I reimplemented my tempo limit logic for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks almost good. Thank you!
app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java
Outdated
Show resolved
Hide resolved
I pushed the requested changes. |
Kudos, SonarCloud Quality Gate passed! |
app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just scrolled down a bit, noticed problem, block catastrophe.
I will review/test this in more detail once I have time and higher priority PRs are done.
@@ -1717,6 +1733,10 @@ private void onUpdateProgress(final int currentProgress, | |||
} | |||
binding.playbackLiveSync.setClickable(!isLiveEdge()); | |||
|
|||
if (isLiveEdge() && getPlaybackSpeed() > 1.0f) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you notice that this is run constantly in a loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did realize this is a function that is executing very frequently, but I wanted the playback speed to reset the moment the live edge was reached and wasn't sure if there was a better place to put the logic.
This logic could be moved to onBuffering()
, which would match Youtube's livestreaming behavior and avoid calling the check in a loop. The downside is that the speed reset won't occur immediately after hitting the live edge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more resource-heavy part here is probably calculating isLiveEdge
, seeing it is not a trivial function.
binding.playbackLiveSync.setClickable(!isLiveEdge()); | ||
|
||
if (isLiveEdge() && getPlaybackSpeed() > 1.0f) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then probably we can just do this:
binding.playbackLiveSync.setClickable(!isLiveEdge()); | |
if (isLiveEdge() && getPlaybackSpeed() > 1.0f) { | |
// if live edge of a livestream -> no need for sync button; playback speed must be <= 1.0 | |
final boolean liveEdge = isLiveEdge(); | |
binding.playbackLiveSync.setClickable(!liveEdge); | |
if (liveEdge && getPlaybackSpeed() > 1.0f) { |
I'm closing this due to inactivity and due to the fact that we're soon starting the rewrite and we don't want to touch the player and possibly introduce regressions. Thank you anyway for your effort! |
What is it?
Description of the changes in your PR
Note it is still possible to use playbacks speeds <= 100% at all times on livestreams, and playback speeds > 100% when not on the live edge.
Changes tested on emulator (Pixel 3a w/ API 28).
Before/After Screenshots
Fixes the following issue(s)
APK testing
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.
Due diligence