# DefaultMediaDescriptionAdapter

Artifact: [androidx.media3:media3-ui](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/ui/DefaultMediaDescriptionAdapter.java+class:androidx.media3.ui.DefaultMediaDescriptionAdapter)

*** ** * ** ***


```
@UnstableApi
public final class DefaultMediaDescriptionAdapter implements PlayerNotificationManager.MediaDescriptionAdapter
```

<br />

*** ** * ** ***

Default implementation of `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.MediaDescriptionAdapter`.

Uses values from the `https://developer.android.com/reference/androidx/media3/common/Player#getMediaMetadata()` to populate the notification.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/ui/DefaultMediaDescriptionAdapter#DefaultMediaDescriptionAdapter(android.app.PendingIntent)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/PendingIntent.html pendingIntent)` Creates a default `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.MediaDescriptionAdapter`. |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/PendingIntent.html` | `https://developer.android.com/reference/androidx/media3/ui/DefaultMediaDescriptionAdapter#createCurrentContentIntent(androidx.media3.common.Player)(https://developer.android.com/reference/androidx/media3/common/Player player)` Creates a content intent for the current media item. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/media3/ui/DefaultMediaDescriptionAdapter#getCurrentContentText(androidx.media3.common.Player)(https://developer.android.com/reference/androidx/media3/common/Player player)` Gets the content text for the current media item. |
| `https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/media3/ui/DefaultMediaDescriptionAdapter#getCurrentContentTitle(androidx.media3.common.Player)(https://developer.android.com/reference/androidx/media3/common/Player player)` Gets the content title for the current media item. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/Bitmap.html` | `https://developer.android.com/reference/androidx/media3/ui/DefaultMediaDescriptionAdapter#getCurrentLargeIcon(androidx.media3.common.Player,androidx.media3.ui.PlayerNotificationManager.BitmapCallback)( https://developer.android.com/reference/androidx/media3/common/Player player, https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.BitmapCallback callback )` Gets the large icon for the current media item. |

| ### Inherited methods |
|---|
| From [androidx.media3.ui.PlayerNotificationManager.MediaDescriptionAdapter](https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.MediaDescriptionAdapter) |---|---| | `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.MediaDescriptionAdapter#getCurrentSubText(androidx.media3.common.Player)(https://developer.android.com/reference/androidx/media3/common/Player player)` Gets the content sub text for the current media item. | |

## Public constructors

### DefaultMediaDescriptionAdapter

```
public DefaultMediaDescriptionAdapter(@Nullable PendingIntent pendingIntent)
```

Creates a default `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.MediaDescriptionAdapter`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/PendingIntent.html pendingIntent` | The `https://developer.android.com/reference/android/app/PendingIntent.html` to be returned from `https://developer.android.com/reference/androidx/media3/ui/DefaultMediaDescriptionAdapter#createCurrentContentIntent(androidx.media3.common.Player)`, or null if no intent should be fired. |

## Public methods

### createCurrentContentIntent

```
public @Nullable PendingIntent createCurrentContentIntent(Player player)
```

Creates a content intent for the current media item.

See `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setContentIntent(android.app.PendingIntent)`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player player` | The `https://developer.android.com/reference/androidx/media3/common/Player` for which a notification is being built. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/PendingIntent.html` | 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 `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setContentText(java.lang.CharSequence)`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player player` | The `https://developer.android.com/reference/androidx/media3/common/Player` for which a notification is being built. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html` | 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 `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setContentTitle(java.lang.CharSequence)`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player player` | The `https://developer.android.com/reference/androidx/media3/common/Player` for which a notification is being built. |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence.html` | 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 `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.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 `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setLargeIcon(android.graphics.Bitmap)`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player player` | The `https://developer.android.com/reference/androidx/media3/common/Player` for which a notification is being built. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.BitmapCallback callback` | A `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.BitmapCallback` to provide a `https://developer.android.com/reference/android/graphics/Bitmap.html` asynchronously. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/Bitmap.html` | The large icon for the current media item, or null if the icon will be returned through the `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.BitmapCallback` or if no icon should be displayed. |