How would one go about using MediaSession (part of the Media3 API) in a Nativescript android app? Currently, all the examples I’ve seen are in Kotlin or Java.
I’d like to convert this to either JavaScript or TypeScript.
override fun onCreate() {
super.onCreate()
val likeButton = CommandButton.Builder()
.setDisplayName("Like")
.setIconResId(R.drawable.like_icon)
.setSessionCommand(SessionCommand(SessionCommand.COMMAND_CODE_SESSION_SET_RATING))
.build()
val favoriteButton = CommandButton.Builder()
.setDisplayName("Save to favorites")
.setIconResId(R.drawable.favorite_icon)
.setSessionCommand(SessionCommand(SAVE_TO_FAVORITES, Bundle()))
.build()
session =
MediaSession.Builder(this, player)
.setCallback(CustomMediaSessionCallback())
.setCustomLayout(ImmutableList.of(likeButton, favoriteButton))
.build()
}