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