# CommandButton.DisplayConstraints

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

*** ** * ** ***

<br />

```
@UnstableApi
class CommandButton.DisplayConstraints
```

<br />

*** ** * ** ***

Constraints for displaying a list of `https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton` instances with utilities to resolve these constraints for a given list of buttons.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton.DisplayConstraints.Builder` A builder for `https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton.DisplayConstraints`. |

| ### Public functions |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton.DisplayConstraints#resolve(java.util.List<androidx.media3.session.CommandButton>,androidx.media3.common.Player)( mediaButtonPreferences: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!, player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player! )` Resolves a list of `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaController#getMediaButtonPreferences()` according to these display constraints and returns the list of buttons to be displayed. |

## Public functions

### resolve

```
fun resolve(
    mediaButtonPreferences: (Mutable)List<CommandButton!>!,
    player: Player!
): ImmutableList<CommandButton!>!
```

Resolves a list of `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaController#getMediaButtonPreferences()` according to these display constraints and returns the list of buttons to be displayed.

Note that the result of this resolution can change whenever the ` mediaButtonPreferences` change, or the `player` reports any of the following listener events:

- `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#EVENT_AVAILABLE_COMMANDS_CHANGED()`
- `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#EVENT_PLAY_WHEN_READY_CHANGED()`
- `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#EVENT_PLAYBACK_STATE_CHANGED()`
- `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED()`
- `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#EVENT_PLAYBACK_STATE_CHANGED()`
- `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#EVENT_SEEK_BACK_INCREMENT_CHANGED()`
- `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#EVENT_SEEK_FORWARD_INCREMENT_CHANGED()`

| Parameters |
|---|---|
| `mediaButtonPreferences: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!` | The list of `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaController#getMediaButtonPreferences()`. |
| `player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` used to determine default buttons for empty slots. |

| Returns |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!` | The resolved list of `https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton` to be displayed. Each button will have a single `https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton#slots()` defined. |