Back to Exoplayer

MediaSessionConnector.DefaultMediaMetadataProvider (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.DefaultMediaMetadataProvider.html

latest3.9 KB
Original Source

Package com.google.android.exoplayer2.ext.mediasession

Class MediaSessionConnector.DefaultMediaMetadataProvider

  • java.lang.Object

    • com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector.DefaultMediaMetadataProvider
  • All Implemented Interfaces:MediaSessionConnector.MediaMetadataProviderEnclosing class:MediaSessionConnector


public static final classMediaSessionConnector.DefaultMediaMetadataProviderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[MediaSessionConnector.MediaMetadataProvider](MediaSessionConnector.MediaMetadataProvider.html "interface in com.google.android.exoplayer2.ext.mediasession")

Provides a default MediaMetadataCompat with properties and extras taken from the MediaDescriptionCompat of the MediaSessionCompat.QueueItem of the active queue item.

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | DefaultMediaMetadataProvider​(android.support.v4.media.session.MediaControllerCompat mediaController, String metadataExtrasPrefix) | Creates a new instance. |

Method Summary

All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description | | --- | --- | --- | | android.support.v4.media.MediaMetadataCompat | getMetadata​(Player player) | Gets the MediaMetadataCompat to be published to the session. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

- 

Methods inherited from interface com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector.MediaMetadataProvider

sameAs

Constructor Detail

- 

DefaultMediaMetadataProvider

public DefaultMediaMetadataProvider​(android.support.v4.media.session.MediaControllerCompat mediaController,
                                    @Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")metadataExtrasPrefix)

Creates a new instance. Parameters: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 android.support.v4.media.MediaMetadataCompat getMetadata​([Player](../../Player.html "interface in com.google.android.exoplayer2")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.MediaMetadataProviderParameters:player - The player connected to the media session.Returns:The MediaMetadataCompat to be published to the session.