[Android] Set media seen if remaining time is less than 10s

Geoffrey Métais git at videolan.org
Wed Sep 27 12:13:19 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Sep 27 11:40:34 2017 +0200| [997c46c453991322080f8e0369a1607ecf36aa99] | committer: Geoffrey Métais

Set media seen if remaining time is less than 10s

> https://code.videolan.org/videolan/vlc-android/commit/997c46c453991322080f8e0369a1607ecf36aa99
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 4b7c6e958..841ddcfa9 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -705,8 +705,9 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
         if (canSwitchToVideo || media.isPodcast()) {
             //Save progress
             final long time = getTime();
-            float progress = time / (float)media.getLength();
-            if (progress > 0.95f) {
+            final long length =  media.getLength();
+            float progress = time / (float)length;
+            if (progress > 0.95f || (length-time) < 10000) {
                 //increase seen counter if more than 95% of the media have been seen
                 //and reset progress to 0
                 final long incSeen = media.getSeen() + 1L;



More information about the Android mailing list