@@ -1572,8 +1572,7 @@ private void onUpdateProgress(final int currentProgress,
15721572 }
15731573
15741574 if (duration != binding .playbackSeekBar .getMax ()) {
1575- binding .playbackEndTime .setText (getTimeString (duration ));
1576- binding .playbackSeekBar .setMax (duration );
1575+ setVideoDurationToControls (duration );
15771576 }
15781577 if (currentState != STATE_PAUSED ) {
15791578 if (currentState != STATE_PAUSED_SEEK ) {
@@ -2073,8 +2072,8 @@ private void onPrepared(final boolean playWhenReady) {
20732072 Log .d (TAG , "onPrepared() called with: playWhenReady = [" + playWhenReady + "]" );
20742073 }
20752074
2076- binding . playbackSeekBar . setMax ((int ) simpleExoPlayer .getDuration ());
2077- binding . playbackEndTime . setText ( getTimeString (( int ) simpleExoPlayer . getDuration ()));
2075+ setVideoDurationToControls ((int ) simpleExoPlayer .getDuration ());
2076+
20782077 binding .playbackSpeed .setText (formatSpeed (getPlaybackSpeed ()));
20792078
20802079 if (playWhenReady ) {
@@ -2716,6 +2715,20 @@ public void seekToDefault() {
27162715 simpleExoPlayer .seekToDefaultPosition ();
27172716 }
27182717 }
2718+
2719+ /**
2720+ * Sets the video duration time into all control components (e.g. seekbar).
2721+ * @param duration
2722+ */
2723+ private void setVideoDurationToControls (final int duration ) {
2724+ binding .playbackEndTime .setText (getTimeString (duration ));
2725+
2726+ binding .playbackSeekBar .setMax (duration );
2727+ // This is important for Android TVs otherwise it would apply the default from
2728+ // setMax/Min methods which is (max - min) / 20
2729+ binding .playbackSeekBar .setKeyProgressIncrement (
2730+ PlayerHelper .retrieveSeekDurationFromPreferences (this ));
2731+ }
27192732 //endregion
27202733
27212734
0 commit comments