When using the MediaSession extension for ExoPlayer, it is possible to specify whether or not metadata should be updated with the doMaintainMetadata constructor parameter. If true, MediaSessionConnector will internally call the private method updateMediaSessionMetadata to recreate a MediaMetadataCompat from the currently playing MediaDescriptionCompat.
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 redefine setPlayer and attach another Player.Listener to call my own updateMediaSessionMetadata, but it's not very handy.
Is there any easier way ? If not, I suggest the following:
- Make
updateMediaSessionMetadata protected, or
- Provide a
MetadataProvider interface to customize MediaSessionConnector, along with a DefaultMetadataProvider to retain the current behavior.
Thanks in advance !
When using the MediaSession extension for ExoPlayer, it is possible to specify whether or not metadata should be updated with the
doMaintainMetadataconstructor parameter. Iftrue,MediaSessionConnectorwill internally call the private methodupdateMediaSessionMetadatato recreate aMediaMetadataCompatfrom 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
MediaSessionConnectorto redefinesetPlayerand attach anotherPlayer.Listenerto call my own updateMediaSessionMetadata, but it's not very handy.Is there any easier way ? If not, I suggest the following:
updateMediaSessionMetadataprotected, orMetadataProviderinterface to customize MediaSessionConnector, along with aDefaultMetadataProviderto retain the current behavior.Thanks in advance !