[Android] Video player properly handles intent extras
Geoffrey Métais
git at videolan.org
Fri Mar 11 19:16:36 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 11 19:15:27 2016 +0100| [e4e6e7d0fa7e3640ddf762e4f80ba109c95952f8] | committer: Geoffrey Métais
Video player properly handles intent extras
> https://code.videolan.org/videolan/vlc-android/commit/e4e6e7d0fa7e3640ddf762e4f80ba109c95952f8
---
.../videolan/vlc/gui/video/VideoPlayerActivity.java | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 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 98713d3..68b6da2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2702,13 +2702,15 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (wasPaused)
Log.d(TAG, "Video was previously paused, resuming in paused mode");
- if(TextUtils.equals(action, PLAY_FROM_VIDEOGRID) && extras != null) {
- mUri = extras.getParcelable(PLAY_EXTRA_ITEM_LOCATION);
- fromStart = extras.getBoolean(PLAY_EXTRA_FROM_START);
- mAskResume &= !fromStart;
- openedPosition = extras.getInt(PLAY_EXTRA_OPENED_POSITION, -1);
- } else if (intent.getData() != null)
+ if (intent.getData() != null)
mUri = intent.getData();
+ if(extras != null) {
+ if (intent.hasExtra(PLAY_EXTRA_ITEM_LOCATION))
+ mUri = extras.getParcelable(PLAY_EXTRA_ITEM_LOCATION);
+ fromStart = extras.getBoolean(PLAY_EXTRA_FROM_START, true);
+ mAskResume &= !fromStart;
+ intentPosition = extras.getLong(PLAY_EXTRA_OPENED_POSITION, -1);
+ }
if (intent.hasExtra(PLAY_EXTRA_SUBTITLES_LOCATION))
mSubtitleSelectedFiles.add(extras.getString(PLAY_EXTRA_SUBTITLES_LOCATION));
@@ -2792,8 +2794,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
else
onPlaying();
}
- if (media != null && media.getTime() > 0l)
- seek(media.getTime());
+ long resumeTime = intentPosition;
+ if (intentPosition <= 0 && media != null && media.getTime() > 0l)
+ resumeTime = media.getTime();
+ if (resumeTime > 0)
+ seek(resumeTime);
// Get possible subtitles
String subtitleList_serialized = mSettings.getString(PreferencesActivity.VIDEO_SUBTITLE_FILES, null);
More information about the Android
mailing list