[Android] VideoPlayer: fix audio playback when leaving pip
Duncan McNamara
git at videolan.org
Fri Mar 28 06:01:09 UTC 2025
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Wed Mar 26 15:29:22 2025 +0100| [95bb1f3a5bfc49d758ddb3ea7ed2a01e929f31ee] | committer: Nicolas Pomepuy
VideoPlayer: fix audio playback when leaving pip
When you open pip with play in background, when you quit pip, in the
onStop, it will switch to audio. If you check if system Pip is running
you can stop that, but it will stop playback from running with the screen off,
so check for screen off also.
This means that isInPiPMode will stay true,
even though PiP has been killed a while ago, audio playback in
background is still running.
> https://code.videolan.org/videolan/vlc-android/commit/95bb1f3a5bfc49d758ddb3ea7ed2a01e929f31ee
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
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 203b50d0b6..795e4830aa 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
@@ -968,15 +968,16 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
unregisterReceiver(btReceiver)
alertDialog?.dismiss()
+ val isPlayingPopup = service?.isPlayingPopup ?: false
+ val isSystemPip = (service?.isInPiPMode?.value ?: false) && !isPlayingPopup
if (displayManager.isPrimary && !isFinishing && service?.isPlaying == true
- && "1" == settings.getString(KEY_VIDEO_APP_SWITCH, "0") && !PlaybackService.hasRenderer()) {
+ && "1" == settings.getString(KEY_VIDEO_APP_SWITCH, "0") && !PlaybackService.hasRenderer()
+ && ((!isSystemPip && isInteractive) || (isSystemPip && !isInteractive))) {
switchToAudioMode(false)
}
-
cleanUI()
stopPlayback()
service?.playlistManager?.videoStatsOn?.postValue(false)
- val isPlayingPopup = service?.isPlayingPopup ?: false
if (isInteractive && !isPlayingPopup)
service?.isInPiPMode?.value = false
More information about the Android
mailing list