Commit 3c6ed283 authored by Geoffrey Métais's avatar Geoffrey Métais

Video player: Pause video on screen lock

parent 5cf1c705
Pipeline #4505 passed with stage
in 3 minutes and 44 seconds
......@@ -341,7 +341,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
final SharedPreferences.Editor editor = mSettings.edit();
editor.putLong(PreferencesActivity.VIDEO_RESUME_TIME, -1);
// Paused flag - per session too, like the subs list.
editor.remove(PreferencesActivity.VIDEO_PAUSED);
editor.apply();
final IntentFilter filter = new IntentFilter();
......@@ -752,7 +751,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
mPlaybackStarted = false;
return;
}
mWasPaused = !mService.isPlaying();
mWasPaused = !(mService.isPlaying() && isInteractive());
if (mWasPaused) mSettings.edit().putBoolean(PreferencesActivity.VIDEO_PAUSED, true).apply();
if (!isFinishing()) {
mCurrentAudioTrack = mService.getAudioTrack();
mCurrentSpuTrack = mService.getSpuTrack();
......@@ -1565,6 +1565,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
// Get possible subtitles
observeDownloadedSubtitles();
if (mOptionsDelegate != null) mOptionsDelegate.setup();
mSettings.edit().remove(PreferencesActivity.VIDEO_PAUSED).apply();
}
private void encounteredError() {
......
......@@ -640,7 +640,6 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
editor.putInt(if (audio) "position_in_audio_list" else "position_in_media_list", if (reset) 0 else currentIndex)
editor.putLong(if (audio) "position_in_song" else "position_in_media", if (reset) 0L else player.getCurrentTime())
if (!audio) {
editor.putBoolean(PreferencesActivity.VIDEO_PAUSED, !player.isPlaying())
editor.putFloat(PreferencesActivity.VIDEO_SPEED, player.getRate())
}
editor.apply()
......
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