[Android] Bluetooth: fix MediaButtonReceiver
Duncan McNamara
git at videolan.org
Tue Nov 15 13:55:26 UTC 2022
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Mon Nov 14 16:49:02 2022 +0100| [0a50a9500ed2d5ea785ba1a4ffb6fda97fbaeb7b] | committer: Nicolas Pomepuy
Bluetooth: fix MediaButtonReceiver
When instanciating a media session, the wrong pending intent was created
to restart the playback service from media buttons after it's
detruction.
> https://code.videolan.org/videolan/vlc-android/commit/0a50a9500ed2d5ea785ba1a4ffb6fda97fbaeb7b
---
application/vlc-android/src/org/videolan/vlc/PlaybackService.kt | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index d23008a6bc..4e9f3edbba 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -960,10 +960,7 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner, CoroutineSc
}
private fun initMediaSession() {
- val mediaButtonIntent = Intent(Intent.ACTION_MEDIA_BUTTON)
-
- mediaButtonIntent.setClass(this, MediaButtonReceiver::class.java)
- val mbrIntent = PendingIntent.getBroadcast(this, 0, mediaButtonIntent, PendingIntent.FLAG_IMMUTABLE)
+ val mbrIntent = MediaButtonReceiver.buildMediaButtonPendingIntent(this, PlaybackStateCompat.ACTION_PLAY_PAUSE)
val mbrName = ComponentName(this, MediaButtonReceiver::class.java)
val playbackState = PlaybackStateCompat.Builder()
.setActions(enabledActions)
More information about the Android
mailing list