Merge pull request #2644 from ByteHamster/progress-bar

Ignore invalid position updates
This commit is contained in:
Martin Fietz 2018-04-17 20:38:19 +02:00 committed by GitHub
commit c82dce79eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -209,6 +209,10 @@ public class ExternalPlayerFragment extends Fragment {
} }
private void onPositionObserverUpdate() { private void onPositionObserverUpdate() {
if (controller.getPosition() == PlaybackService.INVALID_TIME
|| controller.getDuration() == PlaybackService.INVALID_TIME) {
return;
}
mProgressBar.setProgress((int) mProgressBar.setProgress((int)
((double) controller.getPosition() / controller.getDuration() * 100)); ((double) controller.getPosition() / controller.getDuration() * 100));
} }