[Android] Bluetooth: fix MediaButtonReceiver
Duncan McNamara
git at videolan.org
Tue Nov 22 14:50:59 UTC 2022
vlc-android | branch: 3.5.x | Duncan McNamara <dcn.mcnamara at gmail.com> | Mon Nov 14 16:49:02 2022 +0100| [5ebf06c43ff088d169565c3e6211201b828cc108] | committer: Duncan McNamara
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/5ebf06c43ff088d169565c3e6211201b828cc108
---
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 bacbd8e372..807408e516 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -967,10 +967,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