[Android] Prevent restoring video on device turning off

Geoffrey Métais git at videolan.org
Tue Nov 29 12:04:46 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Nov 28 15:16:56 2016 +0100| [36366b40bf04483ea6bfbf51d8833c5c13f451be] | committer: Geoffrey Métais

Prevent restoring video on device turning off

> https://code.videolan.org/videolan/vlc-android/commit/36366b40bf04483ea6bfbf51d8833c5c13f451be
---

 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index de32a66..2c155e8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -308,7 +308,8 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
 
         if (mService.hasMedia() && !mService.isVideoPlaying()) {
             SharedPreferences mSettings= PreferenceManager.getDefaultSharedPreferences(getActivity());
-            if (mSettings.getBoolean(PreferencesActivity.VIDEO_RESTORE, false)) {
+            //Check fragment resumed to not restore video on device turning off
+            if (isResumed() && mSettings.getBoolean(PreferencesActivity.VIDEO_RESTORE, false)) {
                 mSettings.edit().putBoolean(PreferencesActivity.VIDEO_RESTORE, false).apply();
                 mService.getCurrentMediaWrapper().removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
                 mService.switchToVideo();



More information about the Android mailing list