[Android] Restore 'position' intent extra for video
Geoffrey Métais
git at videolan.org
Wed Jun 29 12:18:16 CEST 2016
vlc-android | branch: 2.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jun 29 11:41:14 2016 +0200| [b402bf82c986fc31d15dabc63f9eb178227b4bc6] | committer: Geoffrey Métais
Restore 'position' intent extra for video
(cherry picked from commit eaacc9ba853edb3bc80d91f2bedefbd20d0eac86)
> https://code.videolan.org/videolan/vlc-android/commit/b402bf82c986fc31d15dabc63f9eb178227b4bc6
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 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 2988268..7786b84 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -151,6 +151,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
public final static String PLAY_EXTRA_SUBTITLES_LOCATION = "subtitles_location";
public final static String PLAY_EXTRA_ITEM_TITLE = "title";
public final static String PLAY_EXTRA_FROM_START = "from_start";
+ public final static String PLAY_EXTRA_START_TIME = "position";
public final static String PLAY_EXTRA_OPENED_POSITION = "opened_position";
public final static String PLAY_DISABLE_HARDWARE = "disable_hardware";
@@ -2856,10 +2857,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
boolean fromStart = false;
String itemTitle = null;
int positionInPlaylist = -1;
- long savedTime = -1; // position passed in by intent (ms)
Intent intent = getIntent();
- String action = intent.getAction();
- Bundle extras = getIntent().getExtras();
+ Bundle extras = intent.getExtras();
+ long savedTime = extras.getLong(PLAY_EXTRA_START_TIME); // position passed in by intent (ms)
+ if (savedTime == 0l)
+ savedTime = extras.getInt(PLAY_EXTRA_START_TIME);
/*
* If the activity has been paused by pressing the power button, then
* pressing it again will show the lock screen.
@@ -2925,7 +2927,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
intent.putExtra(PLAY_EXTRA_FROM_START, false);
if (fromStart || mService.isPlaying())
media.setTime(0l);
- else
+ else if (savedTime <= 0)
savedTime = media.getTime();
mLastAudioTrack = media.getAudioTrack();
More information about the Android
mailing list