Skip to content

Allow customisation of updateMediaSessionMetadata #3497

@thibseisel

Description

@thibseisel

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:

  1. Make updateMediaSessionMetadata protected, or
  2. Provide a MetadataProvider interface to customize MediaSessionConnector, along with a DefaultMetadataProvider to retain the current behavior.

Thanks in advance !

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions