[Android] Resume position from 3rd party apps
Geoffrey Métais
git at videolan.org
Mon Feb 27 16:43:04 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb 27 16:41:58 2017 +0100| [d1fce4cb9cdbc9983630460340eb1ab49f7ee809] | committer: Geoffrey Métais
Resume position from 3rd party apps
> https://code.videolan.org/videolan/vlc-android/commit/d1fce4cb9cdbc9983630460340eb1ab49f7ee809
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 2 +-
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 698be46..dff70a9 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1905,7 +1905,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
public void run() {
long id = mw.getId();
if (id == 0) {
- MediaWrapper media = mMedialibrary.getMedia(mw.getUri());
+ MediaWrapper media = mMedialibrary.findMedia(mw);
if (media != null)
id = media.getId();
}
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 68103ec..3bb271e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2892,7 +2892,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (length == 0) {
MediaWrapper media = mService.getCurrentMediaWrapper();
if (media.getId() == 0)
- media = VLCApplication.getMLInstance().getMedia(mUri);
+ media = VLCApplication.getMLInstance().findMedia(media);
if (media != null)
length = (int) media.getLength();
}
@@ -3011,7 +3011,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
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);
+ fromStart = extras.getBoolean(PLAY_EXTRA_FROM_START, false);
mAskResume &= !fromStart;
positionInPlaylist = extras.getInt(PLAY_EXTRA_OPENED_POSITION, -1);
}
@@ -3049,6 +3049,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mUri = FileUtils.convertLocalUri(mUri);
media = ml.getMedia(mUri);
}
+ if (media != null && media.getId() != 0L && media.getTime() == 0L)
+ media.setTime((long) (media.getMetaLong(VLCApplication.getMLInstance(), MediaWrapper.META_PROGRESS) * (double) media.getLength())/100L);
} else
media = openedMedia;
if (media != null) {
More information about the Android
mailing list