[Android] CustomPiP: fix popup killed when leaving the app
Duncan McNamara
git at videolan.org
Thu Oct 24 11:00:38 UTC 2024
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Wed Oct 16 15:39:52 2024 +0200| [5e643209bc2b233cdec2b5b830164edaf0b2b4f3] | committer: Nicolas Pomepuy
CustomPiP: fix popup killed when leaving the app
When leaving the app with custom pip the VideoPlayerActivity onStop()
is called which sets isInPiPMode to false which kills the popup.
onStop isn't called with the system's pip.
To fix this, just check if service.isPlayingPopup is true, it's false
for system's pip.
> https://code.videolan.org/videolan/vlc-android/commit/5e643209bc2b233cdec2b5b830164edaf0b2b4f3
---
application/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.kt | 3 +++
.../vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt | 3 ++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.kt
index 486e86c44b..d2a19514b3 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.kt
@@ -84,6 +84,9 @@ class PopupManager constructor(private val service: PlaybackService) : PlaybackS
fun removePopup() {
service.isInPiPMode.removeObserver(observer)
+ // If the popup is killed from the x button, isInPiPMode will still be true
+ // and when reopening the app will restart the video player
+ service.isInPiPMode.value = false
hideNotification()
val view = rootView ?: return
service.removeCallback(this)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index 89746c4fea..ebe0d82cb2 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -959,7 +959,8 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
cleanUI()
stopPlayback()
service?.playlistManager?.videoStatsOn?.postValue(false)
- if (isInteractive)
+ val isPlayingPopup = service?.isPlayingPopup ?: false
+ if (isInteractive && !isPlayingPopup)
service?.isInPiPMode?.value = false
if (savedTime != -1L) settings.putSingle(VIDEO_RESUME_TIME, savedTime)
More information about the Android
mailing list