# CommandButton

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)

*** ** * ** ***

<br />

```
public final class CommandButton
```

<br />

*** ** * ** ***

A button for a `https://developer.android.com/reference/androidx/media3/session/SessionCommand` or `https://developer.android.com/reference/androidx/media3/common/Player.Command` that can be displayed by controllers.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/session/MediaSession#setCustomLayout(androidx.media3.session.MediaSession.ControllerInfo,java.util.List<androidx.media3.session.CommandButton>)` |   |
| `https://developer.android.com/reference/androidx/media3/session/MediaController.Listener#onCustomLayoutChanged(androidx.media3.session.MediaController,java.util.List<androidx.media3.session.CommandButton>)` |   |

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder` A builder for `https://developer.android.com/reference/androidx/media3/session/CommandButton`. |
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi public final class https://developer.android.com/reference/androidx/media3/session/CommandButton.DisplayConstraints` Constraints for displaying a list of `https://developer.android.com/reference/androidx/media3/session/CommandButton` instances with utilities to resolve these constraints for a given list of buttons. |
| `public final class https://developer.android.com/reference/androidx/media3/session/CommandButton.DisplayConstraints.Builder` A builder for `https://developer.android.com/reference/androidx/media3/session/CommandButton.DisplayConstraints`. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon` An icon constant for a button. |
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/session/CommandButton.Slot` A slot at which a button can be displayed in a UI surface. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_ALBUM() = 57369` An icon showing an album symbol (a stylized LP record). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_ARTIST() = 57370` An icon showing an artist symbol (a stylized person with a musical note). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_BLOCK() = 57675` An icon showing a block symbol (a circle with a diagonal line). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_BOOKMARK_FILLED() = 1042534` An icon showing a filled bookmark symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_BOOKMARK_UNFILLED() = 59494` An icon showing an unfilled bookmark symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_CHECK_CIRCLE_FILLED() = 1042540` An icon showing a filled circle with a check mark. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_CHECK_CIRCLE_UNFILLED() = 59500` An icon showing a unfilled circle with a check mark. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_CLOSED_CAPTIONS() = 57372` An icon showing a closed caption symbol (a rectangle with the letters CC). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_CLOSED_CAPTIONS_OFF() = 61916` An icon showing a closed caption off symbol (a rectangle with the letters CC, with a large diagonal line across). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_FAST_FORWARD() = 57375` An icon showing a fast forward symbol (two right facing triangles). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_FEED() = 57573` An icon showing an feed symbol (a dot in the bottom-left with multiple concentric quarter circles). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_FLAG_FILLED() = 1040723` An icon showing a filled flag symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_FLAG_UNFILLED() = 57683` An icon showing an unfilled flag symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_HEART_FILLED() = 1042557` An icon showing a filled heart symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_HEART_UNFILLED() = 59517` An icon showing an unfilled heart symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_MINUS() = 57691` An icon showing a minus symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_MINUS_CIRCLE_FILLED() = 1040712` An icon showing a filled circle with a minus. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_MINUS_CIRCLE_UNFILLED() = 1040713` An icon showing an unfilled circle with a minus. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_NEXT() = 57412` An icon showing a next symbol (a right facing triangle with a vertical bar). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PAUSE() = 57396` An icon showing a pause symbol (two vertical bars). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLAY() = 57399` An icon showing a play symbol (a right facing triangle). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLAYBACK_SPEED() = 57448` An icon showing a playback speed symbol (a right facing triangle in a circle with half-dashed, half-solid contour). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLAYBACK_SPEED_0_5() = 62690` An icon showing a 0.5x speed symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLAYBACK_SPEED_0_8() = 1045730` An icon showing a 0.8x speed symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLAYBACK_SPEED_1_0() = 61389` An icon showing a 1.0x speed symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLAYBACK_SPEED_1_2() = 62689` An icon showing a 1.2x speed symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLAYBACK_SPEED_1_5() = 62688` An icon showing a 1.5x speed symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLAYBACK_SPEED_1_8() = 1045728` An icon showing a 1.8x speed symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLAYBACK_SPEED_2_0() = 62699` An icon showing a 2.0x speed symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLAYLIST_ADD() = 57403` An icon showing an add to playlist symbol (multiple horizontal bars with a small plus). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLAYLIST_REMOVE() = 60288` An icon showing an remove from playlist symbol (multiple horizontal bars with a small minus). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLUS() = 57669` An icon showing a plus symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLUS_CIRCLE_FILLED() = 1040711` An icon showing a filled circle with a plus. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PLUS_CIRCLE_UNFILLED() = 57671` An icon showing an unfilled circle with a plus. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_PREVIOUS() = 57413` An icon showing a previous symbol (a left facing triangle with a vertical bar). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_QUALITY() = 58409` An icon showing a quality selection symbol (multiple horizontal bars with sliders). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_QUEUE_ADD() = 57436` An icon showing an add to queue symbol (a stylized TV with a plus). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_QUEUE_NEXT() = 57446` An icon showing a play next queue item symbol (a stylized TV with a plus and a right-facing arrow). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_QUEUE_REMOVE() = 57447` An icon showing a remove from queue symbol (a stylized TV with a minus). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_RADIO() = 58654` An icon showing a radio symbol (left and right facing sound waves). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_REPEAT_ALL() = 57408` An icon showing a repeat all symbol (two open clockwise arrows). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_REPEAT_OFF() = 1040448` An icon showing a disabled repeat symbol (two open clockwise arrows, in a color representing a disabled state). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_REPEAT_ONE() = 57409` An icon showing a repeat one symbol (two open clockwise arrows with an overlaid number 1). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_REWIND() = 57376` An icon showing a rewind symbol (two left facing triangles). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SETTINGS() = 59576` An icon showing a settings symbol (a stylized cog). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SHARE() = 59405` An icon showing a share symbol (three dots connected by two diagonal lines, open on the right). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SHUFFLE_OFF() = 1040452` An icon showing a disabled shuffle symbol (two diagonal upward and downward facing arrows, in a color representing a disabled state). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SHUFFLE_ON() = 57411` An icon showing a shuffle symbol (two diagonal upward and downward facing arrows). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SHUFFLE_STAR() = 1040451` An icon showing a shuffle symbol with a start (two diagonal upward and downward facing arrows with an overlaid star). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SIGNAL() = 61512` An icon showing an signal symbol (a vertical mast with circular sounds waves). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SKIP_BACK() = 57410` An icon showing a skip back symbol (an open anti-clockwise arrow). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SKIP_BACK_10() = 57433` An icon showing a skip back 10 seconds symbol (an open anti-clockwise arrow with the number 10). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SKIP_BACK_15() = 1040473` An icon showing a skip back 15 seconds symbol (an open anti-clockwise arrow with the number 15). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SKIP_BACK_30() = 57434` An icon showing a skip back 30 seconds symbol (an open anti-clockwise arrow with the number 30). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SKIP_BACK_5() = 57435` An icon showing a skip back 5 seconds symbol (an open anti-clockwise arrow with the number 5). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SKIP_FORWARD() = 63220` An icon showing a skip forward symbol (an open clock-wise arrow). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SKIP_FORWARD_10() = 57430` An icon showing a skip forward 10 seconds symbol (an open clockwise arrow with the number 10). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SKIP_FORWARD_15() = 1040470` An icon showing a skip forward 15 seconds symbol (an open clockwise arrow with the number 15). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SKIP_FORWARD_30() = 57431` An icon showing a skip forward 30 seconds symbol (an open clockwise arrow with the number 30). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SKIP_FORWARD_5() = 57432` An icon showing a skip forward 5 seconds symbol (an open clockwise arrow with the number 5). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_STAR_FILLED() = 1042488` An icon showing a filled star symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_STAR_UNFILLED() = 59448` An icon showing an unfilled star symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_STOP() = 57415` An icon showing a stop symbol (a square). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SUBTITLES() = 57416` An icon showing a subtitles symbol (a rectangle filled with dots and horizontal lines). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SUBTITLES_OFF() = 61298` An icon showing a subtitles off symbol (a rectangle filled with dots and horizontal lines, with a large diagonal line across). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_SYNC() = 58919` An icon showing a sync symbol (two open anti-clockwise arrows). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_THUMB_DOWN_FILLED() = 1042651` An icon showing a filled thumb-down symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_THUMB_DOWN_UNFILLED() = 59611` An icon showing an unfilled thumb-down symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_THUMB_UP_FILLED() = 1042652` An icon showing a filled thumb-up symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_THUMB_UP_UNFILLED() = 59612` An icon showing an unfilled thumb-up symbol. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_UNDEFINED() = 0` An icon constant representing an undefined icon, for example a custom icon not covered by the existing constants. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_VOLUME_DOWN() = 57421` An icon showing a volume down symbol (a stylized speaker with a single small sound wave). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_VOLUME_OFF() = 57423` An icon showing a volume off symbol (a stylized speaker with multiple sound waves, with a large diagonal line across). |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_VOLUME_UP() = 57424` An icon showing a volume up symbol (a stylized speaker with multiple sound waves). |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#SLOT_BACK() = 2` A slot in a playback control UI for backward-directed playback actions, most commonly used for previous or rewind actions. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#SLOT_BACK_SECONDARY() = 4` A slot in a playback control UI for secondary backward-directed playback actions, most commonly used for previous or rewind actions. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#SLOT_CENTRAL() = 1` A central slot in a playback control UI, most commonly used for play or pause actions. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#SLOT_FORWARD() = 3` A slot in a playback control UI for forward-directed playback actions, most commonly used for next or fast-forward actions. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#SLOT_FORWARD_SECONDARY() = 5` A slot in a playback control UI for secondary forward-directed playback actions, most commonly used for next or fast-forward actions. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#SLOT_OVERFLOW() = 6` A slot in a playback control UI for additional actions that don't fit into other slots. |

| ### Public fields |
|---|---|
| `final https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#displayName()` The display name of the button. |
| `final https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#extras()` The extra `https://developer.android.com/reference/android/os/Bundle.html` of the button. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon https://developer.android.com/reference/androidx/media3/session/CommandButton#icon()` The `https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon` of the button. |
| `final @https://developer.android.com/reference/androidx/annotation/DrawableRes int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#iconResId()` The fallback icon resource ID of the button. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#iconUri()` The fallback `https://developer.android.com/reference/android/content/ContentResolver.html#SCHEME_CONTENT` or `https://developer.android.com/reference/android/content/ContentResolver.html#SCHEME_ANDROID_RESOURCE``https://developer.android.com/reference/android/net/Uri.html` for the icon of the button. |
| `final boolean` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#isEnabled()` Whether the button is enabled. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` The optional parameter needed to execute the action associated with this button via `https://developer.android.com/reference/androidx/media3/session/CommandButton#executeAction(androidx.media3.session.MediaController)`. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/Player.Command https://developer.android.com/reference/androidx/media3/session/CommandButton#playerCommand()` The `https://developer.android.com/reference/androidx/media3/common/Player.Command` command of the button. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/session/SessionCommand` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#sessionCommand()` The session command of the button. |
| `final https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/ImmutableIntArray.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#slots()` The allowed `https://developer.android.com/reference/androidx/media3/session/CommandButton.Slot` positions for this button. |

| ### Public methods |
|---|---|
| `boolean` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#canExecuteAction()()` Returns whether the command button has a configuration that allows to execute the associated action via a `https://developer.android.com/reference/androidx/media3/session/MediaController`. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html obj)` Checks the given command button for equality while ignoring `https://developer.android.com/reference/androidx/media3/session/CommandButton#extras()`. |
| `void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#executeAction(androidx.media3.session.MediaController)(https://developer.android.com/reference/androidx/media3/session/MediaController controller)` Executes the intended action of the command button by calling the appropriate `https://developer.android.com/reference/androidx/media3/session/MediaController` method. |
| `static https://developer.android.com/reference/androidx/media3/session/CommandButton` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [fromBundle](https://developer.android.com/reference/androidx/media3/session/CommandButton#fromBundle(android.os.Bundle))(https://developer.android.com/reference/android/os/Bundle.html bundle)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/session/CommandButton#fromBundle(android.os.Bundle,int)` instead. <br /> |
| `static https://developer.android.com/reference/androidx/media3/session/CommandButton` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#fromBundle(android.os.Bundle,int)(https://developer.android.com/reference/android/os/Bundle.html bundle, int interfaceVersion)` Restores a `CommandButton` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `static int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/androidx/media3/session/CommandButton.Slot https://developer.android.com/reference/androidx/media3/session/CommandButton#getDefaultSlot(int,int)( @https://developer.android.com/reference/androidx/media3/common/Player.Command int playerCommand, @https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon int icon )` Returns the default `https://developer.android.com/reference/androidx/media3/session/CommandButton.Slot` for a button. |
| `static @https://developer.android.com/reference/androidx/annotation/DrawableRes int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#getIconResIdForIconConstant(int)(@https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon int icon)` Returns a drawable resource id for the given `https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon` constant. |
| `int` | `https://developer.android.com/reference/androidx/media3/session/CommandButton#hashCode()()` |
| `https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [toBundle](https://developer.android.com/reference/androidx/media3/session/CommandButton#toBundle())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/session/CommandButton#toBundle(int)` instead. <br /> |
| `https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/CommandButton#toBundle(int)(int interfaceVersion)` Writes this command button to a `https://developer.android.com/reference/android/os/Bundle.html`. |

## Constants

### ICON_ALBUM

```
public static final int ICON_ALBUM = 57369
```

An icon showing an album symbol (a stylized LP record).

### ICON_ARTIST

```
public static final int ICON_ARTIST = 57370
```

An icon showing an artist symbol (a stylized person with a musical note).

### ICON_BLOCK

```
public static final int ICON_BLOCK = 57675
```

An icon showing a block symbol (a circle with a diagonal line).

### ICON_BOOKMARK_FILLED

```
public static final int ICON_BOOKMARK_FILLED = 1042534
```

An icon showing a filled bookmark symbol.

### ICON_BOOKMARK_UNFILLED

```
public static final int ICON_BOOKMARK_UNFILLED = 59494
```

An icon showing an unfilled bookmark symbol.

### ICON_CHECK_CIRCLE_FILLED

```
public static final int ICON_CHECK_CIRCLE_FILLED = 1042540
```

An icon showing a filled circle with a check mark.

### ICON_CHECK_CIRCLE_UNFILLED

```
public static final int ICON_CHECK_CIRCLE_UNFILLED = 59500
```

An icon showing a unfilled circle with a check mark.

### ICON_CLOSED_CAPTIONS

```
public static final int ICON_CLOSED_CAPTIONS = 57372
```

An icon showing a closed caption symbol (a rectangle with the letters CC).

### ICON_CLOSED_CAPTIONS_OFF

```
public static final int ICON_CLOSED_CAPTIONS_OFF = 61916
```

An icon showing a closed caption off symbol (a rectangle with the letters CC, with a large diagonal line across).

### ICON_FAST_FORWARD

```
public static final int ICON_FAST_FORWARD = 57375
```

An icon showing a fast forward symbol (two right facing triangles).

### ICON_FEED

```
public static final int ICON_FEED = 57573
```

An icon showing an feed symbol (a dot in the bottom-left with multiple concentric quarter circles).

### ICON_FLAG_FILLED

```
public static final int ICON_FLAG_FILLED = 1040723
```

An icon showing a filled flag symbol.

### ICON_FLAG_UNFILLED

```
public static final int ICON_FLAG_UNFILLED = 57683
```

An icon showing an unfilled flag symbol.

### ICON_HEART_FILLED

```
public static final int ICON_HEART_FILLED = 1042557
```

An icon showing a filled heart symbol.

### ICON_HEART_UNFILLED

```
public static final int ICON_HEART_UNFILLED = 59517
```

An icon showing an unfilled heart symbol.

### ICON_MINUS

```
public static final int ICON_MINUS = 57691
```

An icon showing a minus symbol.

### ICON_MINUS_CIRCLE_FILLED

```
public static final int ICON_MINUS_CIRCLE_FILLED = 1040712
```

An icon showing a filled circle with a minus.

### ICON_MINUS_CIRCLE_UNFILLED

```
public static final int ICON_MINUS_CIRCLE_UNFILLED = 1040713
```

An icon showing an unfilled circle with a minus.

### ICON_NEXT

```
public static final int ICON_NEXT = 57412
```

An icon showing a next symbol (a right facing triangle with a vertical bar).

### ICON_PAUSE

```
public static final int ICON_PAUSE = 57396
```

An icon showing a pause symbol (two vertical bars).

### ICON_PLAY

```
public static final int ICON_PLAY = 57399
```

An icon showing a play symbol (a right facing triangle).

### ICON_PLAYBACK_SPEED

```
public static final int ICON_PLAYBACK_SPEED = 57448
```

An icon showing a playback speed symbol (a right facing triangle in a circle with half-dashed, half-solid contour).

### ICON_PLAYBACK_SPEED_0_5

```
public static final int ICON_PLAYBACK_SPEED_0_5 = 62690
```

An icon showing a 0.5x speed symbol.

### ICON_PLAYBACK_SPEED_0_8

```
public static final int ICON_PLAYBACK_SPEED_0_8 = 1045730
```

An icon showing a 0.8x speed symbol.

### ICON_PLAYBACK_SPEED_1_0

```
public static final int ICON_PLAYBACK_SPEED_1_0 = 61389
```

An icon showing a 1.0x speed symbol.

### ICON_PLAYBACK_SPEED_1_2

```
public static final int ICON_PLAYBACK_SPEED_1_2 = 62689
```

An icon showing a 1.2x speed symbol.

### ICON_PLAYBACK_SPEED_1_5

```
public static final int ICON_PLAYBACK_SPEED_1_5 = 62688
```

An icon showing a 1.5x speed symbol.

### ICON_PLAYBACK_SPEED_1_8

```
public static final int ICON_PLAYBACK_SPEED_1_8 = 1045728
```

An icon showing a 1.8x speed symbol.

### ICON_PLAYBACK_SPEED_2_0

```
public static final int ICON_PLAYBACK_SPEED_2_0 = 62699
```

An icon showing a 2.0x speed symbol.

### ICON_PLAYLIST_ADD

```
public static final int ICON_PLAYLIST_ADD = 57403
```

An icon showing an add to playlist symbol (multiple horizontal bars with a small plus).

### ICON_PLAYLIST_REMOVE

```
public static final int ICON_PLAYLIST_REMOVE = 60288
```

An icon showing an remove from playlist symbol (multiple horizontal bars with a small minus).

### ICON_PLUS

```
public static final int ICON_PLUS = 57669
```

An icon showing a plus symbol.

### ICON_PLUS_CIRCLE_FILLED

```
public static final int ICON_PLUS_CIRCLE_FILLED = 1040711
```

An icon showing a filled circle with a plus.

### ICON_PLUS_CIRCLE_UNFILLED

```
public static final int ICON_PLUS_CIRCLE_UNFILLED = 57671
```

An icon showing an unfilled circle with a plus.

### ICON_PREVIOUS

```
public static final int ICON_PREVIOUS = 57413
```

An icon showing a previous symbol (a left facing triangle with a vertical bar).

### ICON_QUALITY

```
public static final int ICON_QUALITY = 58409
```

An icon showing a quality selection symbol (multiple horizontal bars with sliders).

### ICON_QUEUE_ADD

```
public static final int ICON_QUEUE_ADD = 57436
```

An icon showing an add to queue symbol (a stylized TV with a plus).

### ICON_QUEUE_NEXT

```
public static final int ICON_QUEUE_NEXT = 57446
```

An icon showing a play next queue item symbol (a stylized TV with a plus and a right-facing arrow).

### ICON_QUEUE_REMOVE

```
public static final int ICON_QUEUE_REMOVE = 57447
```

An icon showing a remove from queue symbol (a stylized TV with a minus).

### ICON_RADIO

```
public static final int ICON_RADIO = 58654
```

An icon showing a radio symbol (left and right facing sound waves).

### ICON_REPEAT_ALL

```
public static final int ICON_REPEAT_ALL = 57408
```

An icon showing a repeat all symbol (two open clockwise arrows).

### ICON_REPEAT_OFF

```
public static final int ICON_REPEAT_OFF = 1040448
```

An icon showing a disabled repeat symbol (two open clockwise arrows, in a color representing a disabled state).

### ICON_REPEAT_ONE

```
public static final int ICON_REPEAT_ONE = 57409
```

An icon showing a repeat one symbol (two open clockwise arrows with an overlaid number 1).

### ICON_REWIND

```
public static final int ICON_REWIND = 57376
```

An icon showing a rewind symbol (two left facing triangles).

### ICON_SETTINGS

```
public static final int ICON_SETTINGS = 59576
```

An icon showing a settings symbol (a stylized cog).

### ICON_SHARE

```
public static final int ICON_SHARE = 59405
```

An icon showing a share symbol (three dots connected by two diagonal lines, open on the right).

### ICON_SHUFFLE_OFF

```
public static final int ICON_SHUFFLE_OFF = 1040452
```

An icon showing a disabled shuffle symbol (two diagonal upward and downward facing arrows, in a color representing a disabled state).

### ICON_SHUFFLE_ON

```
public static final int ICON_SHUFFLE_ON = 57411
```

An icon showing a shuffle symbol (two diagonal upward and downward facing arrows).

### ICON_SHUFFLE_STAR

```
public static final int ICON_SHUFFLE_STAR = 1040451
```

An icon showing a shuffle symbol with a start (two diagonal upward and downward facing arrows with an overlaid star).

### ICON_SIGNAL

```
public static final int ICON_SIGNAL = 61512
```

An icon showing an signal symbol (a vertical mast with circular sounds waves).

### ICON_SKIP_BACK

```
public static final int ICON_SKIP_BACK = 57410
```

An icon showing a skip back symbol (an open anti-clockwise arrow).

### ICON_SKIP_BACK_10

```
public static final int ICON_SKIP_BACK_10 = 57433
```

An icon showing a skip back 10 seconds symbol (an open anti-clockwise arrow with the number 10).

### ICON_SKIP_BACK_15

```
public static final int ICON_SKIP_BACK_15 = 1040473
```

An icon showing a skip back 15 seconds symbol (an open anti-clockwise arrow with the number 15).

### ICON_SKIP_BACK_30

```
public static final int ICON_SKIP_BACK_30 = 57434
```

An icon showing a skip back 30 seconds symbol (an open anti-clockwise arrow with the number 30).

### ICON_SKIP_BACK_5

```
public static final int ICON_SKIP_BACK_5 = 57435
```

An icon showing a skip back 5 seconds symbol (an open anti-clockwise arrow with the number 5).

### ICON_SKIP_FORWARD

```
public static final int ICON_SKIP_FORWARD = 63220
```

An icon showing a skip forward symbol (an open clock-wise arrow).

### ICON_SKIP_FORWARD_10

```
public static final int ICON_SKIP_FORWARD_10 = 57430
```

An icon showing a skip forward 10 seconds symbol (an open clockwise arrow with the number 10).

### ICON_SKIP_FORWARD_15

```
public static final int ICON_SKIP_FORWARD_15 = 1040470
```

An icon showing a skip forward 15 seconds symbol (an open clockwise arrow with the number 15).

### ICON_SKIP_FORWARD_30

```
public static final int ICON_SKIP_FORWARD_30 = 57431
```

An icon showing a skip forward 30 seconds symbol (an open clockwise arrow with the number 30).

### ICON_SKIP_FORWARD_5

```
public static final int ICON_SKIP_FORWARD_5 = 57432
```

An icon showing a skip forward 5 seconds symbol (an open clockwise arrow with the number 5).

### ICON_STAR_FILLED

```
public static final int ICON_STAR_FILLED = 1042488
```

An icon showing a filled star symbol.

### ICON_STAR_UNFILLED

```
public static final int ICON_STAR_UNFILLED = 59448
```

An icon showing an unfilled star symbol.

### ICON_STOP

```
public static final int ICON_STOP = 57415
```

An icon showing a stop symbol (a square).

### ICON_SUBTITLES

```
public static final int ICON_SUBTITLES = 57416
```

An icon showing a subtitles symbol (a rectangle filled with dots and horizontal lines).

### ICON_SUBTITLES_OFF

```
public static final int ICON_SUBTITLES_OFF = 61298
```

An icon showing a subtitles off symbol (a rectangle filled with dots and horizontal lines, with a large diagonal line across).

### ICON_SYNC

```
public static final int ICON_SYNC = 58919
```

An icon showing a sync symbol (two open anti-clockwise arrows).

### ICON_THUMB_DOWN_FILLED

```
public static final int ICON_THUMB_DOWN_FILLED = 1042651
```

An icon showing a filled thumb-down symbol.

### ICON_THUMB_DOWN_UNFILLED

```
public static final int ICON_THUMB_DOWN_UNFILLED = 59611
```

An icon showing an unfilled thumb-down symbol.

### ICON_THUMB_UP_FILLED

```
public static final int ICON_THUMB_UP_FILLED = 1042652
```

An icon showing a filled thumb-up symbol.

### ICON_THUMB_UP_UNFILLED

```
public static final int ICON_THUMB_UP_UNFILLED = 59612
```

An icon showing an unfilled thumb-up symbol.

### ICON_UNDEFINED

```
public static final int ICON_UNDEFINED = 0
```

An icon constant representing an undefined icon, for example a custom icon not covered by the existing constants.

### ICON_VOLUME_DOWN

```
public static final int ICON_VOLUME_DOWN = 57421
```

An icon showing a volume down symbol (a stylized speaker with a single small sound wave).

### ICON_VOLUME_OFF

```
public static final int ICON_VOLUME_OFF = 57423
```

An icon showing a volume off symbol (a stylized speaker with multiple sound waves, with a large diagonal line across).

### ICON_VOLUME_UP

```
public static final int ICON_VOLUME_UP = 57424
```

An icon showing a volume up symbol (a stylized speaker with multiple sound waves).

### SLOT_BACK

```
@UnstableApi
public static final int SLOT_BACK = 2
```

A slot in a playback control UI for backward-directed playback actions, most commonly used for previous or rewind actions.

### SLOT_BACK_SECONDARY

```
@UnstableApi
public static final int SLOT_BACK_SECONDARY = 4
```

A slot in a playback control UI for secondary backward-directed playback actions, most commonly used for previous or rewind actions.

### SLOT_CENTRAL

```
@UnstableApi
public static final int SLOT_CENTRAL = 1
```

A central slot in a playback control UI, most commonly used for play or pause actions.

### SLOT_FORWARD

```
@UnstableApi
public static final int SLOT_FORWARD = 3
```

A slot in a playback control UI for forward-directed playback actions, most commonly used for next or fast-forward actions.

### SLOT_FORWARD_SECONDARY

```
@UnstableApi
public static final int SLOT_FORWARD_SECONDARY = 5
```

A slot in a playback control UI for secondary forward-directed playback actions, most commonly used for next or fast-forward actions.

### SLOT_OVERFLOW

```
@UnstableApi
public static final int SLOT_OVERFLOW = 6
```

A slot in a playback control UI for additional actions that don't fit into other slots.

## Public fields

### displayName

```
public final CharSequence displayName
```

The display name of the button. Can be empty if the command is predefined and a custom name isn't needed.

### extras

```
public final Bundle extras
```

The extra `https://developer.android.com/reference/android/os/Bundle.html` of the button. It's private information between session and controller.

### icon

```
@CommandButton.Icon
public final int icon
```

The `https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon` of the button.

### iconResId

```
public final @DrawableRes int iconResId
```

The fallback icon resource ID of the button.

This is used when either the predefined `https://developer.android.com/reference/androidx/media3/session/CommandButton#icon()` is not available, or it's set to `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_UNDEFINED()`.

Can be `0` if not needed.

### iconUri

```
public final @Nullable Uri iconUri
```

The fallback `https://developer.android.com/reference/android/content/ContentResolver.html#SCHEME_CONTENT` or `https://developer.android.com/reference/android/content/ContentResolver.html#SCHEME_ANDROID_RESOURCE``https://developer.android.com/reference/android/net/Uri.html` for the icon of the button.

This is used when either the predefined `https://developer.android.com/reference/androidx/media3/session/CommandButton#icon()` is not available, or it's set to `https://developer.android.com/reference/androidx/media3/session/CommandButton#ICON_UNDEFINED()`.

Can be `null`.

Note that this value can be used in addition to `https://developer.android.com/reference/androidx/media3/session/CommandButton#iconResId()` for consumers that are capable of loading the content or resource `https://developer.android.com/reference/android/net/Uri.html`.

### isEnabled

```
public final boolean isEnabled
```

Whether the button is enabled.

Note that this value will be set to `false` for `https://developer.android.com/reference/androidx/media3/session/MediaController` instances if the corresponding command is not available to this controller (see `https://developer.android.com/reference/androidx/media3/session/CommandButton#playerCommand()` and `https://developer.android.com/reference/androidx/media3/session/CommandButton#sessionCommand()`).

### parameter

```
@UnstableApi
public final @Nullable Object parameter
```

The optional parameter needed to execute the action associated with this button via `https://developer.android.com/reference/androidx/media3/session/CommandButton#executeAction(androidx.media3.session.MediaController)`.

### playerCommand

```
@Player.Command
public final int playerCommand
```

The `https://developer.android.com/reference/androidx/media3/common/Player.Command` command of the button. Will be `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_INVALID()` if `https://developer.android.com/reference/androidx/media3/session/CommandButton#sessionCommand()` is set.

### sessionCommand

```
public final @Nullable SessionCommand sessionCommand
```

The session command of the button. Will be `null` if `https://developer.android.com/reference/androidx/media3/session/CommandButton#playerCommand()` is set.

### slots

```
@UnstableApi
public final ImmutableIntArray slots
```

The allowed `https://developer.android.com/reference/androidx/media3/session/CommandButton.Slot` positions for this button.

The button is only allowed in the defined slots. If none of the slots can display the button, either because the slots do not exist, are already occupied or the UI surface does not allow the specific type of button in these slots, the button will not be displayed at all.

When multiple slots are provided, they define a preference order. The button will be placed in the first slot in the list that exists, isn't already occupied and that allows this type of button.

## Public methods

### canExecuteAction

```
@UnstableApi
public boolean canExecuteAction()
```

Returns whether the command button has a configuration that allows to execute the associated action via a `https://developer.android.com/reference/androidx/media3/session/MediaController`. See `https://developer.android.com/reference/androidx/media3/session/CommandButton#executeAction(androidx.media3.session.MediaController)` for a list of valid configurations.

| Returns |
|---|---|
| `boolean` | Whether `https://developer.android.com/reference/androidx/media3/session/CommandButton#executeAction(androidx.media3.session.MediaController)` is successful assuming the associated `https://developer.android.com/reference/androidx/media3/common/Player.Command` or `https://developer.android.com/reference/androidx/media3/session/SessionCommand` is available. |

### equals

```
public boolean equals(@Nullable Object obj)
```

Checks the given command button for equality while ignoring `https://developer.android.com/reference/androidx/media3/session/CommandButton#extras()`.

### executeAction

```
@UnstableApi
public void executeAction(MediaController controller)
```

Executes the intended action of the command button by calling the appropriate `https://developer.android.com/reference/androidx/media3/session/MediaController` method.

The following player and session commands are supported. Whether the command button has a configuration that can be executed can also be checked with `https://developer.android.com/reference/androidx/media3/session/CommandButton#canExecuteAction()`.

If `https://developer.android.com/reference/androidx/media3/session/CommandButton#playerCommand()` is set, the following commands are supported:

- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_PLAY_PAUSE()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#setPlayWhenReady(boolean)` with `!controller.getPlayWhenReady()`, or with `https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` if provided via `https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder#setPlayerCommand(int,java.lang.Object)`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_PREPARE()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#prepare()`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_STOP()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#stop()`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#seekToPrevious()`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_NEXT()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#seekToNext()`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#seekToPreviousMediaItem()`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_NEXT_MEDIA_ITEM()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#seekToNextMediaItem()`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_BACK()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#seekBack()`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_FORWARD()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#seekForward()`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_DEFAULT_POSITION()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#seekToDefaultPosition()`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#seekTo(long)` with `https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` if provided via `https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder#setPlayerCommand(int,java.lang.Object)`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_MEDIA_ITEM()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#seekToDefaultPosition(int)` with `https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` if provided via `https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder#setPlayerCommand(int,java.lang.Object)`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_SPEED_AND_PITCH()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#setPlaybackSpeed(float)` with `https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` if provided via `https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder#setPlayerCommand(int,java.lang.Object)`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_SHUFFLE_MODE()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#setShuffleModeEnabled(boolean)` with ` !controller.getShuffleModeEnabled()`, or with `https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` if provided via `https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder#setPlayerCommand(int,java.lang.Object)`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_REPEAT_MODE()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#setRepeatMode(int)` with `https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` if provided via `https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder#setPlayerCommand(int,java.lang.Object)`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_MEDIA_ITEM()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#setMediaItem(androidx.media3.common.MediaItem)` with `https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` if provided via `https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder#setPlayerCommand(int,java.lang.Object)`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_PLAYLIST_METADATA()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#setPlaylistMetadata(androidx.media3.common.MediaMetadata)` with `https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` if provided via `https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder#setPlayerCommand(int,java.lang.Object)`.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_VOLUME()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#setVolume(float)` with `https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` if provided via `https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder#setPlayerCommand(int,java.lang.Object)`, or calls `https://developer.android.com/reference/androidx/media3/session/MediaController#mute()`/`https://developer.android.com/reference/androidx/media3/session/MediaController#unmute()` otherwise.
- `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_TRACK_SELECTION_PARAMETERS()`: Calls `https://developer.android.com/reference/androidx/media3/session/MediaController#setTrackSelectionParameters(androidx.media3.common.TrackSelectionParameters)` with `https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` if provided via `https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder#setPlayerCommand(int,java.lang.Object)`.

If `https://developer.android.com/reference/androidx/media3/session/CommandButton#sessionCommand()` is set, the following commands are supported:

- If `sessionCommand.commandCode` is `https://developer.android.com/reference/androidx/media3/session/SessionCommand#COMMAND_CODE_CUSTOM()`, calls `https://developer.android.com/reference/androidx/media3/session/MediaController#sendCustomCommand(androidx.media3.session.SessionCommand,android.os.Bundle)` with `https://developer.android.com/reference/androidx/media3/session/CommandButton#sessionCommand()` and `https://developer.android.com/reference/androidx/media3/session/CommandButton#extras()`.
- If `sessionCommand.commandCode` is `https://developer.android.com/reference/androidx/media3/session/SessionCommand#COMMAND_CODE_SESSION_SET_RATING()`, calls `https://developer.android.com/reference/androidx/media3/session/MediaController#setRating(androidx.media3.common.Rating)` with `https://developer.android.com/reference/androidx/media3/session/CommandButton#parameter()` if it is provided via `https://developer.android.com/reference/androidx/media3/session/CommandButton.Builder#setSessionCommand(androidx.media3.session.SessionCommand,java.lang.Object)`.

Will do nothing if `https://developer.android.com/reference/androidx/media3/session/CommandButton#isEnabled()` is `false`.

### fromBundle

```
@UnstableApi
public static CommandButton [fromBundle](https://developer.android.com/reference/androidx/media3/session/CommandButton#fromBundle(android.os.Bundle))(Bundle bundle)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/session/CommandButton#fromBundle(android.os.Bundle,int)` instead.

### fromBundle

```
@UnstableApi
public static CommandButton fromBundle(Bundle bundle, int interfaceVersion)
```

Restores a `CommandButton` from a `https://developer.android.com/reference/android/os/Bundle.html`.

### getDefaultSlot

```
@UnstableApi
@CommandButton.Slot
public static int getDefaultSlot(
    @Player.Command int playerCommand,
    @CommandButton.Icon int icon
)
```

Returns the default `https://developer.android.com/reference/androidx/media3/session/CommandButton.Slot` for a button.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/Player.Command int playerCommand` | The `https://developer.android.com/reference/androidx/media3/common/Player.Command` associated with this button. |
| `@https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon int icon` | The `https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon` of this button. |

| Returns |
|---|---|
| `int` | The default `https://developer.android.com/reference/androidx/media3/session/CommandButton.Slot` for this button. |

### getIconResIdForIconConstant

```
@UnstableApi
public static @DrawableRes int getIconResIdForIconConstant(@CommandButton.Icon int icon)
```

Returns a drawable resource id for the given `https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon` constant.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon int icon` | The `https://developer.android.com/reference/androidx/media3/session/CommandButton.Icon`. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/DrawableRes int` | The drawable resource if for the `icon`, or 0 if not found. |

### hashCode

```
public int hashCode()
```

### toBundle

```
@UnstableApi
public Bundle [toBundle](https://developer.android.com/reference/androidx/media3/session/CommandButton#toBundle())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/session/CommandButton#toBundle(int)` instead.

### toBundle

```
@UnstableApi
public Bundle toBundle(int interfaceVersion)
```

Writes this command button to a `https://developer.android.com/reference/android/os/Bundle.html`.

| Parameters |
|---|---|
| `int interfaceVersion` | The `https://developer.android.com/reference/androidx/media3/common/MediaLibraryInfo#INTERFACE_VERSION()` of the receiving process. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/os/Bundle.html` | The `https://developer.android.com/reference/android/os/Bundle.html` containing the data of this instance. |