fix: crash when an other media session with the same name exists

This commit is contained in:
Bnyro 2023-09-08 15:38:01 +02:00
parent 5df822ecaa
commit 6a2c83a7bb

View File

@ -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()