From 6a2c83a7bb785f50efccbaca93095eeba1e49b45 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Fri, 8 Sep 2023 15:38:01 +0200 Subject: [PATCH] fix: crash when an other media session with the same name exists --- .../java/com/github/libretube/util/NowPlayingNotification.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt b/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt index 4c7c4a8e5..272afd5e0 100644 --- a/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt +++ b/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt @@ -26,7 +26,6 @@ import com.github.libretube.R import com.github.libretube.constants.IntentData import com.github.libretube.constants.PLAYER_CHANNEL_ID import com.github.libretube.constants.PLAYER_NOTIFICATION_ID -import com.github.libretube.extensions.TAG import com.github.libretube.extensions.seekBy import com.github.libretube.extensions.toMediaMetadataCompat import com.github.libretube.helpers.BackgroundHelper @@ -34,6 +33,7 @@ import com.github.libretube.helpers.ImageHelper import com.github.libretube.helpers.PlayerHelper import com.github.libretube.obj.PlayerNotificationData import com.github.libretube.ui.activities.MainActivity +import java.util.UUID @androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class) class NowPlayingNotification( @@ -205,7 +205,7 @@ class NowPlayingNotification( } } - mediaSession = MediaSessionCompat(context, TAG()) + mediaSession = MediaSessionCompat(context, UUID.randomUUID().toString()) mediaSession.setCallback(sessionCallback) updateSessionMetadata()