diff --git a/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java b/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java index b4811f040a..2a0fb7fa6a 100644 --- a/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java +++ b/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java @@ -79,6 +79,9 @@ import java.util.Map; *
  • An {@link ErrorMessageProvider} for providing human readable error messages and * corresponding error codes can be set by calling {@link * #setErrorMessageProvider(ErrorMessageProvider)}. + *
  • A {@link MediaMetadataProvider} can be set by calling {@link + * #setMediaMetadataProvider(MediaMetadataProvider)}. By default the {@link + * DefaultMediaMetadataProvider} is used. * */ public final class MediaSessionConnector { @@ -562,7 +565,8 @@ public final class MediaSessionConnector { } /** - * Sets a provider of metadata to be published to the media session. + * Sets a provider of metadata to be published to the media session. Pass {@code null} if no + * metadata should be published. * * @param mediaMetadataProvider The provider of metadata to publish, or {@code null} if no * metadata should be published. @@ -579,6 +583,9 @@ public final class MediaSessionConnector { * *

    Apps normally only need to call this method when the backing data for a given media item has * changed and the metadata should be updated immediately. + * + *

    The {@link MediaMetadataCompat} which is published to the session is obtained by calling + * {@link MediaMetadataProvider#getMetadata(Player)}. */ public final void invalidateMediaSessionMetadata() { MediaMetadataCompat metadata = @@ -779,8 +786,8 @@ public final class MediaSessionConnector { } /** - * Provides a default {@link MediaMetadataCompat} with properties and extras propagated from the - * active queue item to the session metadata. + * Provides a default {@link MediaMetadataCompat} with properties and extras taken from the {@link + * MediaDescriptionCompat} of the {@link MediaSessionCompat.QueueItem} of the active queue item. */ public static final class DefaultMediaMetadataProvider implements MediaMetadataProvider { diff --git a/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueNavigator.java b/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueNavigator.java index d0047637dd..0121e7ddb3 100644 --- a/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueNavigator.java +++ b/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueNavigator.java @@ -76,6 +76,11 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu /** * Gets the {@link MediaDescriptionCompat} for a given timeline window index. * + *

    Often artworks and icons need to be loaded asynchronously. In such a case, return a {@link + * MediaDescriptionCompat} without the images, load your images asynchronously off the main thread + * and then call {@link MediaSessionConnector#invalidateMediaSessionQueue()} to make the connector + * update the queue by calling {@link #getMediaDescription(Player, int)} again. + * * @param player The current player. * @param windowIndex The timeline window index for which to provide a description. * @return A {@link MediaDescriptionCompat}.