Commit 2bc3afe1 authored by Geoffrey Métais's avatar Geoffrey Métais

Keep same mediawrapper loaded

Fixes subtitles tracks lost on apps switch
parent c253a4c6
......@@ -869,7 +869,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
time = 0;
else
time -= 2000; // go back 2 seconds, to compensate loading time
if (isFinishing())
mService.stop();
else
mService.pause();
SharedPreferences.Editor editor = mSettings.edit();
// Save position
......@@ -2935,8 +2938,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mService.addCallback(this);
/* prepare playback */
boolean hasMedia = mService.hasMedia();
if (media == null)
media = hasMedia ? mService.getCurrentMediaWrapper() : new MediaWrapper(mUri);
if (hasMedia)
media = mService.getCurrentMediaWrapper();
else if (media == null)
media = new MediaWrapper(mUri);
if (mWasPaused)
media.addFlags(MediaWrapper.MEDIA_PAUSED);
if (mHardwareAccelerationError || intent.hasExtra(PLAY_DISABLE_HARDWARE))
......
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