[Android] Fix broadcasted metadata and add the chapter

Nicolas Pomepuy git at videolan.org
Wed Oct 19 07:21:52 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Oct 19 08:17:37 2022 +0200| [0cbe78a43f5f0a0d7ce0d18d570ad5df8300c05c] | committer: Nicolas Pomepuy

Fix broadcasted metadata and add the chapter

Fixes #2725

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

 application/vlc-android/src/org/videolan/vlc/PlaybackService.kt | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index ec3ea36fb..aa202d61a 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -1243,11 +1243,14 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner, CoroutineSc
         if (lifecycleScope.isActive) lifecycleScope.launch(Dispatchers.Default) {
             sendBroadcast(Intent("com.android.music.metachanged")
                     .putExtra("track", media.nowPlaying ?: media.title)
-                    .putExtra("artist", media.artist)
-                    .putExtra("album", media.album)
+                    .putExtra("artist", MediaUtils.getMediaArtist(this at PlaybackService, media))
+                    .putExtra("album", MediaUtils.getMediaAlbum(this at PlaybackService, media))
                     .putExtra("duration", media.length)
                     .putExtra("playing", isPlaying)
-                    .putExtra("package", "org.videolan.vlc"))
+                    .putExtra("package", "org.videolan.vlc")
+                    .apply {
+                        if (lastChaptersCount > 0) getCurrentChapter()?.let { putExtra("chapter", it) }
+                    })
         }
     }
 



More information about the Android mailing list