Class MediaSessionConnector.DefaultMediaMetadataProvider

    • Constructor Detail

      • DefaultMediaMetadataProvider

        public DefaultMediaMetadataProvider​( mediaController,
                                            String metadataExtrasPrefix)
        Creates a new instance.
        mediaController - The MediaControllerCompat.
        metadataExtrasPrefix - A string to prefix extra keys which are propagated from the active queue item to the session metadata.
    • Method Detail

      • getMetadata

        public getMetadata​(Player player)
        Description copied from interface: MediaSessionConnector.MediaMetadataProvider
        Gets the MediaMetadataCompat to be published to the session.

        An app may need to load metadata resources like artwork bitmaps asynchronously. In such a case the app should return a MediaMetadataCompat object that does not contain these resources as a placeholder. The app should start an asynchronous operation to download the bitmap and put it into a cache. Finally, the app should call MediaSessionConnector.invalidateMediaSessionMetadata(). This causes this callback to be called again and the app can now return a MediaMetadataCompat object with all the resources included.

        Specified by:
        getMetadata in interface MediaSessionConnector.MediaMetadataProvider
        player - The player connected to the media session.
        The MediaMetadataCompat to be published to the session.