DefaultMediaDescriptionAdapter
@UnstableApi
public final class DefaultMediaDescriptionAdapter implements PlayerNotificationManager.MediaDescriptionAdapter
Default implementation of MediaDescriptionAdapter.
Uses values from the player mediaMetadata to populate the notification.
Summary
Public constructors |
|---|
DefaultMediaDescriptionAdapter(@Nullable PendingIntent pendingIntent)Creates a default |
Public methods |
|
|---|---|
@Nullable PendingIntent |
createCurrentContentIntent(Player player)Creates a content intent for the current media item. |
@Nullable CharSequence |
getCurrentContentText(Player player)Gets the content text for the current media item. |
CharSequence |
getCurrentContentTitle(Player player)Gets the content title for the current media item. |
@Nullable Bitmap |
getCurrentLargeIcon(Gets the large icon for the current media item. |
Inherited methods |
||
|---|---|---|
|
Public constructors
DefaultMediaDescriptionAdapter
public DefaultMediaDescriptionAdapter(@Nullable PendingIntent pendingIntent)
Creates a default MediaDescriptionAdapter.
| Parameters | |
|---|---|
@Nullable PendingIntent pendingIntent |
The |
Public methods
createCurrentContentIntent
public @Nullable PendingIntent createCurrentContentIntent(Player player)
Creates a content intent for the current media item.
See setContentIntent.
| Returns | |
|---|---|
@Nullable PendingIntent |
The content intent for the current media item, or null if no intent should be fired. |
getCurrentContentText
public @Nullable CharSequence getCurrentContentText(Player player)
Gets the content text for the current media item.
See setContentText.
| Returns | |
|---|---|
@Nullable CharSequence |
The content text for the current media item, or null if no context text should be displayed. |
getCurrentContentTitle
public CharSequence getCurrentContentTitle(Player player)
Gets the content title for the current media item.
See setContentTitle.
| Returns | |
|---|---|
CharSequence |
The content title for the current media item. |
getCurrentLargeIcon
public @Nullable Bitmap getCurrentLargeIcon(
Player player,
PlayerNotificationManager.BitmapCallback callback
)
Gets the large icon for the current media item.
When a bitmap needs to be loaded asynchronously, a placeholder bitmap (or null) should be returned. The actual bitmap should be passed to the BitmapCallback once it has been loaded. Because the adapter may be called multiple times for the same media item, bitmaps should be cached by the app and returned synchronously when possible.
See setLargeIcon.
| Parameters | |
|---|---|
Player player |
The |
PlayerNotificationManager.BitmapCallback callback |
A |
| Returns | |
|---|---|
@Nullable Bitmap |
The large icon for the current media item, or null if the icon will be returned through the |