-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow customisation of updateMediaSessionMetadata #3497
Comments
@marcbaechinger - What do you think? |
What's your memory cache keyed by? |
To comply with the MediaSession API, my metadata and items are keyed by a media id, which could be any |
The MetadataProvider approach seems like worth looking into on our side. I'll take a look into this. Option 1 for now (with QueueNavigator): If you need a quick solution for now, I wonder if you are using a
The method Option 2 for now Let me know whether the quick options help for now. I'll look into the |
I was having the same problem because I didn't know about class ExoPlayerAdapter(private val mediaSessionCompat: MediaSessionCompat) : PlayerEventListener {
[...]
private fun setupPlayer() {
if (player == null) {
player = ExoPlayerFactory.newSimpleInstance(context, DefaultTrackSelector())
}
MediaSessionConnector(mediaSessionCompat).setPlayer(player, null)
player?.addListener(this)
}
override fun onTimelineChanged(timeline: Timeline?, manifest: Any?, reason: Int) {
mediaSessionCompat.setMetadata(currentMedia)
}
} |
Support for this was added in 62ee13b. |
When using the MediaSession extension for ExoPlayer, it is possible to specify whether or not metadata should be updated with the
doMaintainMetadata
constructor parameter. Iftrue
,MediaSessionConnector
will internally call the private methodupdateMediaSessionMetadata
to recreate aMediaMetadataCompat
from the currently playingMediaDescriptionCompat
.I already have MediaMetadataCompat objects stored in memory cache, and I'd like to retrieve them from it instead of creating them again. One solution would be to subclass
MediaSessionConnector
to redefinesetPlayer
and attach anotherPlayer.Listener
to call my own updateMediaSessionMetadata, but it's not very handy.Is there any easier way ? If not, I suggest the following:
updateMediaSessionMetadata
protected, orMetadataProvider
interface to customize MediaSessionConnector, along with aDefaultMetadataProvider
to retain the current behavior.Thanks in advance !
The text was updated successfully, but these errors were encountered: