How to show seek bar in notification using media 3 exo-player

179 views Asked by At

I am using PlayerNotificationManager to show notifications while the exo-player video service is called, but I am not able to show the seek bar.

 PlayerNotificationManager.Builder(
        context,
        NOTIFICATION_ID,
        NOTIFICATION_CHANNEL_ID
    )
        .setMediaDescriptionAdapter(
            NotificationDescriptorAdapter(
                context = context,
                pendingIntent = mediaSession.sessionActivity
            )
        )
        .setSmallIconResourceId(R.drawable.ic_icon_play_arrow)
        .build()
        .also {
            it.setUseFastForwardActionInCompactView(true)
            it.setUseRewindActionInCompactView(true)
            it.setUseChronometer(true)
            it.setUseNextActionInCompactView(false)
            it.setUsePreviousActionInCompactView(false)
            it.setUseNextAction(false)
            it.setUsePreviousAction(false)
            it.setPriority(NotificationCompat.PRIORITY_LOW)
            it.setColorized(false)
            it.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
            it.setPlayer(player)
        }

when i search for solution i find that i need to pass this line

it.setMediaSessionToken(mediaSession.sessionCompatToken)

but when i am using this code i am getting an error

Cannot access class 'android.support.v4.media.session.MediaSessionCompat.Token'. Check your module classpath for missing or conflicting dependencies

does any one know how to fix this error and show seek bar in notification?

0

There are 0 answers