[Android] Do not update progress if time is invalid

Geoffrey Métais git at videolan.org
Tue Jun 20 10:41:34 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jun 20 10:40:55 2017 +0200| [60f378c35a805a6fba8951d60b7c32c42f59d734] | committer: Geoffrey Métais

Do not update progress if time is invalid

Close #301

> https://code.videolan.org/videolan/vlc-android/commit/60f378c35a805a6fba8951d60b7c32c42f59d734
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index ed5844ee7..2b69d0d9b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1711,7 +1711,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                     break;
                 case SHOW_PROGRESS:
                     int pos = setOverlayProgress();
-                    if (canShowProgress()) {
+                    if (pos >= 0 && canShowProgress()) {
                         msg = mHandler.obtainMessage(SHOW_PROGRESS);
                         mHandler.sendMessageDelayed(msg, 1000 - (pos % 1000));
                     }
@@ -2993,7 +2993,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
      */
     private int setOverlayProgress() {
         if (mService == null) {
-            return 0;
+            return -1;
         }
         int time = (int) getTime();
         int length = (int) mService.getLength();
@@ -3001,6 +3001,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     }
 
     private int setOverlayProgress(int time, int length) {
+        if (time == -1 || length == -1)
+            return -1;
         // Update all view elements
         if (mSeekbar != null) {
             mSeekbar.setMax(length);



More information about the Android mailing list