diff options
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java index fa5012b74..78cc15b2c 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -47,7 +47,6 @@ public class VideoplayerActivity extends MediaplayerActivity { */ private boolean videoControlsShowing = true; private boolean videoSurfaceCreated = false; - private boolean playbackStoppedUponExitVideo = false; private boolean destroyingDueToReload = false; private VideoControlsHider videoControlsHider = new VideoControlsHider(this); @@ -78,7 +77,6 @@ public class VideoplayerActivity extends MediaplayerActivity { @Override protected void onResume() { super.onResume(); - playbackStoppedUponExitVideo = false; if (TextUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) { playExternalMedia(getIntent(), MediaType.VIDEO); } else if (PlaybackService.isCasting()) { @@ -93,32 +91,12 @@ public class VideoplayerActivity extends MediaplayerActivity { @Override protected void onStop() { - stopPlaybackIfUserPreferencesSpecified(); // MUST be called before super.onStop(), while it still has member variable controller super.onStop(); if (!PictureInPictureUtil.isInPictureInPictureMode(this)) { videoControlsHider.stop(); } } - void stopPlaybackIfUserPreferencesSpecified() { - // to avoid the method being called twice during leaving Videoplayer - // , which will double-pause the media - // (it is usually first called by surfaceHolderCallback.surfaceDestroyed(), - // then VideoplayerActivity.onStop() , but sometimes VideoplayerActivity.onStop() - // will first be invoked.) - if (playbackStoppedUponExitVideo) { - return; - } - playbackStoppedUponExitVideo = true; - - if (controller != null && !destroyingDueToReload - && UserPreferences.getVideoBackgroundBehavior() - != UserPreferences.VideoBackgroundBehavior.CONTINUE_PLAYING) { - Log.v(TAG, "stop video playback per UserPreference"); - controller.notifyVideoSurfaceAbandoned(); - } - } - @Override public void onUserLeaveHint () { if (!PictureInPictureUtil.isInPictureInPictureMode(this) && UserPreferences.getVideoBackgroundBehavior() @@ -297,12 +275,13 @@ public class VideoplayerActivity extends MediaplayerActivity { @Override public void surfaceDestroyed(SurfaceHolder holder) { - Log.d(TAG, "Videosurface was destroyed." ); - Log.v(TAG, " hasController=" + (controller != null) - + " , destroyingDueToReload=" + destroyingDueToReload - + " , videoBackgroundBehavior=" + UserPreferences.getVideoBackgroundBehavior()); + Log.d(TAG, "Videosurface was destroyed"); videoSurfaceCreated = false; - stopPlaybackIfUserPreferencesSpecified(); + if (controller != null && !destroyingDueToReload + && UserPreferences.getVideoBackgroundBehavior() + != UserPreferences.VideoBackgroundBehavior.CONTINUE_PLAYING) { + controller.notifyVideoSurfaceAbandoned(); + } } }; |