Browse Source

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.
merge-requests/1990/merge
Duncan McNamara 2 years ago
committed by Nicolas Pomepuy
parent
commit
5e643209bc
  1. 3
      application/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.kt
  2. 3
      application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt

3
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)

3
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)

Loading…
Cancel
Save