ExoPlayer Notification Manager, hide fast rewind and fast forward buttons

ysfcyln :

I am trying to implement ExoPlayer's Notification Manager, it works pretty well but I do not want to show fast rewind and fast forward buttons. I checked documentation but can not find a way to hide these button. Is there any tricky way to hide them?

Here is my code

private fun initListener() {
    val playerNotificationManager: PlayerNotificationManager
    val notificationId = 1234
    val mediaDescriptionAdapter = object : PlayerNotificationManager.MediaDescriptionAdapter {
        override fun getCurrentSubText(player: Player?): String {
            return "Sub text"
        }

        override fun getCurrentContentTitle(player: Player): String {
            return "Title"
        }

        override fun createCurrentContentIntent(player: Player): PendingIntent? {
            return null
        }

        override fun getCurrentContentText(player: Player): String {
            return "ContentText"
        }

        override fun getCurrentLargeIcon(
            player: Player,
            callback: PlayerNotificationManager.BitmapCallback
        ): Bitmap? {
            return null
        }
    }

    playerNotificationManager = PlayerNotificationManager.createWithNotificationChannel(
        context,
        "My_channel_id",
        R.string.app_name,
        notificationId,
        mediaDescriptionAdapter,
        object : PlayerNotificationManager.NotificationListener {
            override fun onNotificationPosted(notificationId: Int, notification: Notification, ongoing: Boolean) {}

            override fun onNotificationCancelled(notificationId: Int, dismissedByUser: Boolean) {}
        })

    playerNotificationManager.setUseNavigationActions(false)
    playerNotificationManager.setUseNavigationActionsInCompactView(false)
    playerNotificationManager.setVisibility(View.VISIBLE)
    playerNotificationManager.setPlayer(mPlayer)
}
marcbaechinger :

You can set rewindIncrementMs and fastForwardIncrementMs to 0 to hide the buttons.

The link to the JavaDoc you posted above explaines this: https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/ui/PlayerNotificationManager.html

playerNotificationManager.setRewindIncrementMs(0);
playerNotificationManager.setFastForwardIncrementMs(0);

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=6973&siteId=1