[Android] Fix the broadcast intent not sending when "playing" is false, after VideoActivity closed
popy popy
git at videolan.org
Mon Nov 14 06:51:31 UTC 2022
vlc-android | branch: master | popy popy <tobias.diendorfer at gmail.com> | Mon Nov 14 06:51:30 2022 +0000| [808bfa5bad283b5314e330d8c9f169a707b6e4f5] | committer: Nicolas Pomepuy
Fix the broadcast intent not sending when "playing" is false, after VideoActivity closed
> https://code.videolan.org/videolan/vlc-android/commit/808bfa5bad283b5314e330d8c9f169a707b6e4f5
---
.../vlc-android/src/org/videolan/vlc/PlaybackService.kt | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index aa202d61a..ab79485df 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -1239,13 +1239,13 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner, CoroutineSc
private fun broadcastMetadata() {
val media = playlistManager.getCurrentMedia()
- if (media == null || isVideoPlaying) return
+ if (isVideoPlaying) return
if (lifecycleScope.isActive) lifecycleScope.launch(Dispatchers.Default) {
sendBroadcast(Intent("com.android.music.metachanged")
- .putExtra("track", media.nowPlaying ?: media.title)
- .putExtra("artist", MediaUtils.getMediaArtist(this at PlaybackService, media))
- .putExtra("album", MediaUtils.getMediaAlbum(this at PlaybackService, media))
- .putExtra("duration", media.length)
+ .putExtra("track", media?.nowPlaying ?: media?.title ?: null)
+ .putExtra("artist", if (media != null) MediaUtils.getMediaArtist(this at PlaybackService, media) else null)
+ .putExtra("album", if (media != null) MediaUtils.getMediaAlbum(this at PlaybackService, media) else null)
+ .putExtra("duration", media?.length ?: 0)
.putExtra("playing", isPlaying)
.putExtra("package", "org.videolan.vlc")
.apply {
More information about the Android
mailing list