Allow to continue playback when leaving player

This commit is contained in:
ByteHamster 2018-04-11 12:15:49 +02:00
parent b5a8fe0a1b
commit 0f80fac680
4 changed files with 10 additions and 2 deletions

View File

@ -288,7 +288,9 @@ public class VideoplayerActivity extends MediaplayerActivity {
public void surfaceDestroyed(SurfaceHolder holder) {
Log.d(TAG, "Videosurface was destroyed");
videoSurfaceCreated = false;
if (controller != null && !destroyingDueToReload) {
if (controller != null && !destroyingDueToReload
&& UserPreferences.getVideoBackgroundBehavior()
!= UserPreferences.VideoBackgroundBehavior.CONTINUE_PLAYING) {
controller.notifyVideoSurfaceAbandoned();
}
}

View File

@ -666,6 +666,7 @@ public class UserPreferences {
switch (prefs.getString(PREF_VIDEO_BEHAVIOR, "stop")) {
case "stop": return VideoBackgroundBehavior.STOP;
case "pip": return VideoBackgroundBehavior.PICTURE_IN_PICTURE;
case "continue": return VideoBackgroundBehavior.CONTINUE_PLAYING;
default: return VideoBackgroundBehavior.STOP;
}
}
@ -849,6 +850,6 @@ public class UserPreferences {
}
public enum VideoBackgroundBehavior {
STOP, PICTURE_IN_PICTURE
STOP, PICTURE_IN_PICTURE, CONTINUE_PLAYING
}
}

View File

@ -228,18 +228,22 @@
<string-array name="video_background_behavior_options">
<item>@string/stop_playback</item>
<item>@string/player_go_to_picture_in_picture</item>
<item>@string/continue_playback</item>
</string-array>
<string-array name="video_background_behavior_values">
<item>stop</item>
<item>pip</item>
<item>continue</item>
</string-array>
<string-array name="video_background_behavior_options_without_pip">
<item>@string/stop_playback</item>
<item>@string/continue_playback</item>
</string-array>
<string-array name="video_background_behavior_values_without_pip">
<item>stop</item>
<item>continue</item>
</string-array>
</resources>

View File

@ -443,6 +443,7 @@
<string name="pref_videoBehavior_title">Video behavior</string>
<string name="pref_videoBehavior_sum">Behavior when leaving video playback</string>
<string name="stop_playback">Stop playback</string>
<string name="continue_playback">Continue playback</string>
<!-- Auto-Flattr dialog -->
<string name="auto_flattr_enable">Enable automatic flattring</string>