Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions app/src/main/java/org/schabi/newpipe/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -1572,8 +1572,7 @@ private void onUpdateProgress(final int currentProgress,
}

if (duration != binding.playbackSeekBar.getMax()) {
binding.playbackEndTime.setText(getTimeString(duration));
binding.playbackSeekBar.setMax(duration);
setVideoDurationToControls(duration);
}
if (currentState != STATE_PAUSED) {
if (currentState != STATE_PAUSED_SEEK) {
Expand Down Expand Up @@ -2073,8 +2072,8 @@ private void onPrepared(final boolean playWhenReady) {
Log.d(TAG, "onPrepared() called with: playWhenReady = [" + playWhenReady + "]");
}

binding.playbackSeekBar.setMax((int) simpleExoPlayer.getDuration());
binding.playbackEndTime.setText(getTimeString((int) simpleExoPlayer.getDuration()));
setVideoDurationToControls((int) simpleExoPlayer.getDuration());

binding.playbackSpeed.setText(formatSpeed(getPlaybackSpeed()));

if (playWhenReady) {
Expand Down Expand Up @@ -2716,6 +2715,20 @@ public void seekToDefault() {
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


Expand Down