Skip to content

Commit 22847c6

Browse files
committed
Fixed progress bar not completing after video end
1 parent c1f7b26 commit 22847c6

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/Player.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,10 +1596,7 @@ private void onUpdateProgress(final int currentProgress,
15961596
setVideoDurationToControls(duration);
15971597
}
15981598
if (currentState != STATE_PAUSED) {
1599-
if (currentState != STATE_PAUSED_SEEK) {
1600-
binding.playbackSeekBar.setProgress(currentProgress);
1601-
}
1602-
binding.playbackCurrentTime.setText(getTimeString(currentProgress));
1599+
updatePlayBackElementsCurrentDuration(currentProgress);
16031600
}
16041601
if (simpleExoPlayer.isLoading() || bufferPercent > 90) {
16051602
binding.playbackSeekBar.setSecondaryProgress(
@@ -2253,6 +2250,9 @@ private void onCompleted() {
22532250
stopProgressLoop();
22542251
}
22552252

2253+
// When a (short) video ends the elements have to display the correct values
2254+
updatePlayBackElementsCurrentDuration(binding.playbackSeekBar.getMax());
2255+
22562256
showControls(500);
22572257
animate(binding.currentDisplaySeek, false, 200, AnimationType.SCALE_AND_ALPHA);
22582258
binding.loadingPanel.setVisibility(View.GONE);
@@ -2595,6 +2595,18 @@ private void showUnrecoverableError(final Exception exception) {
25952595
//////////////////////////////////////////////////////////////////////////*/
25962596
//region Playback position and seek
25972597

2598+
/**
2599+
* Sets the current duration into the corresponding elements.
2600+
* @param currentProgress
2601+
*/
2602+
private void updatePlayBackElementsCurrentDuration(final int currentProgress) {
2603+
// Don't set seekbar progress while user is seeking
2604+
if (currentState != STATE_PAUSED_SEEK) {
2605+
binding.playbackSeekBar.setProgress(currentProgress);
2606+
}
2607+
binding.playbackCurrentTime.setText(getTimeString(currentProgress));
2608+
}
2609+
25982610
@Override // own playback listener (this is a getter)
25992611
public boolean isApproachingPlaybackEdge(final long timeToEndMillis) {
26002612
// If live, then not near playback edge

0 commit comments

Comments
 (0)