[Android] Fix seek, use setTime as a fallback

Geoffrey Métais git at videolan.org
Tue Mar 31 11:36:29 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 31 11:35:27 2015 +0200| [69cc277631f259d604c95873dfc48958151eccc2] | committer: Geoffrey Métais

Fix seek, use setTime as a fallback

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=69cc277631f259d604c95873dfc48958151eccc2
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 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 f016378..e6386ea 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2109,11 +2109,12 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
     }
 
     private void seek(long position, float length) {
-        if (length == 0f)
-            return;
         mForcedTime = position;
         mLastTime = mLibVLC.getTime();
-        mLibVLC.setPosition(position / length);
+        if (length == 0f)
+            mLibVLC.setTime(position);
+        else
+            mLibVLC.setPosition(position / length);
     }
 
     private void seekDelta(int delta) {
@@ -2646,10 +2647,10 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
                 editor.putLong(PreferencesActivity.VIDEO_RESUME_TIME, -1);
                 Util.commitPreferences(editor);
                 if(rTime > 0)
-                    seek(rTime, media.getLength());
+                    seek(rTime);
 
                 if(intentPosition > 0)
-                    seek(intentPosition, media.getLength());
+                    seek(intentPosition);
             }
 
             // Get possible subtitles



More information about the Android mailing list