Commit d1fce4cb authored by Geoffrey Métais's avatar Geoffrey Métais

Resume position from 3rd party apps

parent 843607ea
......@@ -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();
}
......
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment