[Android] Fix system player pending intent for audio media

Nicolas Pomepuy git at videolan.org
Thu Feb 15 16:45:00 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Feb 15 09:35:06 2024 +0100| [c13ab6a9650b343f0a863ae8b67161324d3e3ca8] | committer: Duncan McNamara

Fix system player pending intent for audio media

Fixes #3038

> https://code.videolan.org/videolan/vlc-android/commit/c13ab6a9650b343f0a863ae8b67161324d3e3ca8
---

 application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 0b31cf7b3d..90925627f3 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -459,7 +459,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
     }
 
     suspend fun playIndex(index: Int, flags: Int = 0, forceResume:Boolean = false, forceRestart:Boolean = false) {
-        videoBackground = videoBackground || (!player.isVideoPlaying() && player.canSwitchToVideo()) || !isAppStarted()
+        videoBackground = videoBackground || (!player.isVideoPlaying() && player.canSwitchToVideo())
         if (mediaList.size() == 0) {
             Log.w(TAG, "Warning: empty media list, nothing to play !")
             return
@@ -472,6 +472,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
         }
 
         val mw = mediaList.getMedia(index) ?: return
+        if (mw.type == MediaWrapper.TYPE_VIDEO && !isAppStarted()) videoBackground = true
         val isVideoPlaying = mw.type == MediaWrapper.TYPE_VIDEO && player.isVideoPlaying()
         setRepeatTypeFromSettings()
         if (!videoBackground && isVideoPlaying) mw.addFlags(MediaWrapper.MEDIA_VIDEO)



More information about the Android mailing list