You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using androidx.media3 to develop an audio player app which provides users with an option to rate currently playng media. So, inside my MediaSessionCallback I do this:
override fun onSetRating(
session: MediaSession,
controller: ControllerInfo,
rating: Rating
): ListenableFuture<SessionResult> {
val item = session.player.currentMediaItem
item?.let {
val metadata = it.mediaMetadata.buildUpon().setUserRating(rating).build()
val mediaItem = it.buildUpon().setMediaMetadata(metadata).build()
session.player.setMediaItem(mediaItem, false)
}
return Futures.immediateFuture(SessionResult(SessionResult.RESULT_SUCCESS))
}
This works, but with the only caveat - it interrupts the audio for the moment. Please, help me to understand how user rating should work.
muhammadalkady, rafsanjani, vfsfitvnm, lo-g, dzolnai and 4 more