-
-
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
Closed
Closed
Limit speed at live edge #8134
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
105b882
Player: Limit speed to 1.0 at live edge
KosOrKosm 80ed98c
PlaybackParamDialog: limit options at live edge
KosOrKosm 878bdd2
Player: make live edge speed adjustments temporary
KosOrKosm 12d8800
Player: Limit speed to 1.0 at live edge
KosOrKosm 4379266
PlaybackParamDialog: limit options at live edge
KosOrKosm c618e0b
Player: make live edge speed adjustments temporary
KosOrKosm ed2641e
PlaybackParameterDialog: merge live tempo limit with #7989 changes
KosOrKosm 0e18c91
Merge remote-tracking branch 'origin/limitSpeedAtLiveEdge' into limit…
KosOrKosm 541d1c9
PlaybackParameterDialog: update livestream related variable names
KosOrKosm 81dd93e
PlaybackParameterDialog: remove unneeded initialLiveEdge tracking
KosOrKosm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1675,10 +1675,26 @@ public PlaybackParameters getPlaybackParameters() { | |||||||||||||||||
*/ | ||||||||||||||||||
public void setPlaybackParameters(final float speed, final float pitch, | ||||||||||||||||||
final boolean skipSilence) { | ||||||||||||||||||
setPlaybackParameters(speed, pitch, skipSilence, true); | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
/** | ||||||||||||||||||
* Sets the playback parameters of the player, and optionally saves them to shared preferences. | ||||||||||||||||||
* Speed and pitch are rounded up to 2 decimal places before being used or saved. | ||||||||||||||||||
* | ||||||||||||||||||
* @param speed the playback speed, will be rounded to up to 2 decimal places | ||||||||||||||||||
* @param pitch the playback pitch, will be rounded to up to 2 decimal places | ||||||||||||||||||
* @param skipSilence skip silence during playback | ||||||||||||||||||
* @param savePref should these settings be saved to preferences | ||||||||||||||||||
*/ | ||||||||||||||||||
public void setPlaybackParameters(final float speed, final float pitch, | ||||||||||||||||||
final boolean skipSilence, final boolean savePref) { | ||||||||||||||||||
final float roundedSpeed = Math.round(speed * 100.0f) / 100.0f; | ||||||||||||||||||
final float roundedPitch = Math.round(pitch * 100.0f) / 100.0f; | ||||||||||||||||||
|
||||||||||||||||||
savePlaybackParametersToPrefs(this, roundedSpeed, roundedPitch, skipSilence); | ||||||||||||||||||
if (savePref) { | ||||||||||||||||||
savePlaybackParametersToPrefs(this, roundedSpeed, roundedPitch, skipSilence); | ||||||||||||||||||
} | ||||||||||||||||||
simpleExoPlayer.setPlaybackParameters( | ||||||||||||||||||
new PlaybackParameters(roundedSpeed, roundedPitch)); | ||||||||||||||||||
simpleExoPlayer.setSkipSilenceEnabled(skipSilence); | ||||||||||||||||||
|
@@ -1717,6 +1733,10 @@ private void onUpdateProgress(final int currentProgress, | |||||||||||||||||
} | ||||||||||||||||||
binding.playbackLiveSync.setClickable(!isLiveEdge()); | ||||||||||||||||||
|
||||||||||||||||||
if (isLiveEdge() && getPlaybackSpeed() > 1.0f) { | ||||||||||||||||||
Comment on lines
1734
to
+1736
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then probably we can just do this:
Suggested change
|
||||||||||||||||||
setPlaybackParameters(1.0f, getPlaybackPitch(), false, false); | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
notifyProgressUpdateToListeners(currentProgress, duration, bufferPercent); | ||||||||||||||||||
|
||||||||||||||||||
if (areSegmentsVisible) { | ||||||||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.