mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 16:40:32 +00:00
Merge pull request #6985 from litetex/set-seekbarjump-when-using-dpad-to-seek-duration-from-preferences
Set ``KeyProgressIncrement`` manually / Fix long seekbar jumps when using a DPad
This commit is contained in:
commit
88f1c3a808
@ -1572,8 +1572,7 @@ public final class Player implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (duration != binding.playbackSeekBar.getMax()) {
|
if (duration != binding.playbackSeekBar.getMax()) {
|
||||||
binding.playbackEndTime.setText(getTimeString(duration));
|
setVideoDurationToControls(duration);
|
||||||
binding.playbackSeekBar.setMax(duration);
|
|
||||||
}
|
}
|
||||||
if (currentState != STATE_PAUSED) {
|
if (currentState != STATE_PAUSED) {
|
||||||
if (currentState != STATE_PAUSED_SEEK) {
|
if (currentState != STATE_PAUSED_SEEK) {
|
||||||
@ -2073,8 +2072,8 @@ public final class Player implements
|
|||||||
Log.d(TAG, "onPrepared() called with: playWhenReady = [" + playWhenReady + "]");
|
Log.d(TAG, "onPrepared() called with: playWhenReady = [" + playWhenReady + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.playbackSeekBar.setMax((int) simpleExoPlayer.getDuration());
|
setVideoDurationToControls((int) simpleExoPlayer.getDuration());
|
||||||
binding.playbackEndTime.setText(getTimeString((int) simpleExoPlayer.getDuration()));
|
|
||||||
binding.playbackSpeed.setText(formatSpeed(getPlaybackSpeed()));
|
binding.playbackSpeed.setText(formatSpeed(getPlaybackSpeed()));
|
||||||
|
|
||||||
if (playWhenReady) {
|
if (playWhenReady) {
|
||||||
@ -2716,6 +2715,20 @@ public final class Player implements
|
|||||||
simpleExoPlayer.seekToDefaultPosition();
|
simpleExoPlayer.seekToDefaultPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the video duration time into all control components (e.g. seekbar).
|
||||||
|
* @param duration
|
||||||
|
*/
|
||||||
|
private void setVideoDurationToControls(final int duration) {
|
||||||
|
binding.playbackEndTime.setText(getTimeString(duration));
|
||||||
|
|
||||||
|
binding.playbackSeekBar.setMax(duration);
|
||||||
|
// This is important for Android TVs otherwise it would apply the default from
|
||||||
|
// setMax/Min methods which is (max - min) / 20
|
||||||
|
binding.playbackSeekBar.setKeyProgressIncrement(
|
||||||
|
PlayerHelper.retrieveSeekDurationFromPreferences(this));
|
||||||
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user