[Android] Seek by position, not by time
Geoffrey Métais
git at videolan.org
Mon Mar 30 12:14:23 CEST 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar 30 12:13:00 2015 +0200| [f5de6957ad54df01e0247ab7ddf4b0530914dae3] | committer: Geoffrey Métais
Seek by position, not by time
Fixes #12275
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=f5de6957ad54df01e0247ab7ddf4b0530914dae3
---
.../videolan/vlc/gui/video/VideoPlayerActivity.java | 16 +++++++++++-----
1 file changed, 11 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 bfd673c..5fa70eb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1797,7 +1797,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
//Jump !
if (seek && length > 0)
- seek(time + jump);
+ seek(time + jump, length);
if (length > 0)
//Show the jump's size
@@ -2100,9 +2100,15 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
}
private void seek(long position) {
+ seek(position, mLibVLC.getLength());
+ }
+
+ private void seek(long position, float length) {
+ if (length == 0f)
+ return;
mForcedTime = position;
mLastTime = mLibVLC.getTime();
- mLibVLC.setTime(position);
+ mLibVLC.setPosition(position/length);
}
private void seekDelta(int delta) {
@@ -2619,7 +2625,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
if(media != null) {
// in media library
if(media.getTime() > 0 && !fromStart)
- seek(media.getTime());
+ seek(media.getTime(), media.getLength());
// Consume fromStart option after first use to prevent
// restarting again when playback is paused.
getIntent().putExtra("fromStart", false);
@@ -2633,10 +2639,10 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
editor.putLong(PreferencesActivity.VIDEO_RESUME_TIME, -1);
Util.commitPreferences(editor);
if(rTime > 0)
- seek(rTime);
+ seek(rTime, media.getLength());
if(intentPosition > 0)
- seek(intentPosition);
+ seek(intentPosition, media.getLength());
}
// Get possible subtitles
More information about the Android
mailing list