Skip to content

Commit

Permalink
Video player: Pause video on screen lock
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyMetais committed Feb 11, 2019
1 parent 5cf1c70 commit 3c6ed28
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ protected void onCreate(Bundle savedInstanceState) {
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();
Expand Down Expand Up @@ -752,7 +751,8 @@ private void stopPlayback() {
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();
Expand Down Expand Up @@ -1565,6 +1565,7 @@ private void onPlaying() {
// Get possible subtitles
observeDownloadedSubtitles();
if (mOptionsDelegate != null) mOptionsDelegate.setup();
mSettings.edit().remove(PreferencesActivity.VIDEO_PAUSED).apply();
}

private void encounteredError() {
Expand Down
1 change: 0 additions & 1 deletion vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3c6ed28

Please sign in to comment.