class CommandButton


A button for a SessionCommand or Player.Command that can be displayed by controllers.

Summary

Nested types

A builder for CommandButton.

@UnstableApi
@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
annotation CommandButton.Icon

An icon constant for a button.

@UnstableApi
@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
annotation CommandButton.Slot

A slot at which a button can be displayed in a UI surface.

Constants

const Int

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

const Int

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

const Int

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

const Int

An icon showing a filled bookmark symbol.

const Int

An icon showing an unfilled bookmark symbol.

const Int

An icon showing a filled circle with a check mark.

const Int

An icon showing a unfilled circle with a check mark.

const Int

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

const Int

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

const Int

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

const Int

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

const Int

An icon showing a filled flag symbol.

const Int

An icon showing an unfilled flag symbol.

const Int

An icon showing a filled heart symbol.

const Int

An icon showing an unfilled heart symbol.

const Int

An icon showing a minus symbol.

const Int

An icon showing a filled circle with a minus.

const Int

An icon showing an unfilled circle with a minus.

const Int

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

const Int

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

const Int

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

const Int

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

const Int

An icon showing a 0.5x speed symbol.

const Int

An icon showing a 0.8x speed symbol.

const Int

An icon showing a 1.0x speed symbol.

const Int

An icon showing a 1.2x speed symbol.

const Int

An icon showing a 1.5x speed symbol.

const Int

An icon showing a 1.8x speed symbol.

const Int

An icon showing a 2.0x speed symbol.

const Int

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

const Int

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

const Int

An icon showing a plus symbol.

const Int

An icon showing a filled circle with a plus.

const Int

An icon showing an unfilled circle with a plus.

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

An icon showing a filled star symbol.

const Int

An icon showing an unfilled star symbol.

const Int

An icon showing a stop symbol (a square).

const Int

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

const Int

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

const Int

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

const Int

An icon showing a filled thumb-down symbol.

const Int

An icon showing an unfilled thumb-down symbol.

const Int

An icon showing a filled thumb-up symbol.

const Int

An icon showing an unfilled thumb-up symbol.

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

Public functions

Boolean
equals(obj: Any?)

Checks the given command button for equality while ignoring extras.

java-static CommandButton!

This function is deprecated.

Use fromBundle instead.

java-static CommandButton!
@UnstableApi
fromBundle(bundle: Bundle!, sessionInterfaceVersion: Int)

Restores a CommandButton from a Bundle.

java-static Int

Returns the default Slot for a button.

java-static @DrawableRes Int

Returns a drawable resource id for the given Icon constant.

Int
Bundle!

Public properties

CharSequence!

The display name of the button.

Bundle!

The extra Bundle of the button.

Int

The Icon of the button.

@DrawableRes Int

The icon resource id of the button that is used when the predefined icon is not available or set to ICON_UNDEFINED.

Uri?

The content or resourceUri for the icon of the button that is used when the predefined icon is not available or set to ICON_UNDEFINED.

Boolean

Whether the button is enabled.

Int

The Player.Command command of the button.

SessionCommand?

The session command of the button.

ImmutableIntArray!

The allowed Slot positions for this button.

Constants

ICON_ALBUM

@UnstableApi
const val ICON_ALBUM = 57369: Int

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

ICON_ARTIST

@UnstableApi
const val ICON_ARTIST = 57370: Int

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

ICON_BLOCK

@UnstableApi
const val ICON_BLOCK = 57675: Int

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

ICON_BOOKMARK_FILLED

@UnstableApi
const val ICON_BOOKMARK_FILLED = 1042534: Int

An icon showing a filled bookmark symbol.

ICON_BOOKMARK_UNFILLED

@UnstableApi
const val ICON_BOOKMARK_UNFILLED = 59494: Int

An icon showing an unfilled bookmark symbol.

ICON_CHECK_CIRCLE_FILLED

@UnstableApi
const val ICON_CHECK_CIRCLE_FILLED = 1042540: Int

An icon showing a filled circle with a check mark.

ICON_CHECK_CIRCLE_UNFILLED

@UnstableApi
const val ICON_CHECK_CIRCLE_UNFILLED = 59500: Int

An icon showing a unfilled circle with a check mark.

ICON_CLOSED_CAPTIONS

@UnstableApi
const val ICON_CLOSED_CAPTIONS = 57372: Int

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

ICON_CLOSED_CAPTIONS_OFF

@UnstableApi
const val ICON_CLOSED_CAPTIONS_OFF = 61916: Int

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

ICON_FAST_FORWARD

@UnstableApi
const val ICON_FAST_FORWARD = 57375: Int

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

ICON_FEED

@UnstableApi
const val ICON_FEED = 57573: Int

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

ICON_FLAG_FILLED

@UnstableApi
const val ICON_FLAG_FILLED = 1040723: Int

An icon showing a filled flag symbol.

ICON_FLAG_UNFILLED

@UnstableApi
const val ICON_FLAG_UNFILLED = 57683: Int

An icon showing an unfilled flag symbol.

ICON_HEART_FILLED

@UnstableApi
const val ICON_HEART_FILLED = 1042557: Int

An icon showing a filled heart symbol.

ICON_HEART_UNFILLED

@UnstableApi
const val ICON_HEART_UNFILLED = 59517: Int

An icon showing an unfilled heart symbol.

ICON_MINUS

@UnstableApi
const val ICON_MINUS = 57691: Int

An icon showing a minus symbol.

ICON_MINUS_CIRCLE_FILLED

@UnstableApi
const val ICON_MINUS_CIRCLE_FILLED = 1040712: Int

An icon showing a filled circle with a minus.

ICON_MINUS_CIRCLE_UNFILLED

@UnstableApi
const val ICON_MINUS_CIRCLE_UNFILLED = 1040713: Int

An icon showing an unfilled circle with a minus.

ICON_NEXT

@UnstableApi
const val ICON_NEXT = 57412: Int

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

ICON_PAUSE

@UnstableApi
const val ICON_PAUSE = 57396: Int

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

ICON_PLAY

@UnstableApi
const val ICON_PLAY = 57399: Int

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

ICON_PLAYBACK_SPEED

@UnstableApi
const val ICON_PLAYBACK_SPEED = 57448: Int

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

@UnstableApi
const val ICON_PLAYBACK_SPEED_0_5 = 62690: Int

An icon showing a 0.5x speed symbol.

ICON_PLAYBACK_SPEED_0_8

@UnstableApi
const val ICON_PLAYBACK_SPEED_0_8 = 1045730: Int

An icon showing a 0.8x speed symbol.

ICON_PLAYBACK_SPEED_1_0

@UnstableApi
const val ICON_PLAYBACK_SPEED_1_0 = 61389: Int

An icon showing a 1.0x speed symbol.

ICON_PLAYBACK_SPEED_1_2

@UnstableApi
const val ICON_PLAYBACK_SPEED_1_2 = 62689: Int

An icon showing a 1.2x speed symbol.

ICON_PLAYBACK_SPEED_1_5

@UnstableApi
const val ICON_PLAYBACK_SPEED_1_5 = 62688: Int

An icon showing a 1.5x speed symbol.

ICON_PLAYBACK_SPEED_1_8

@UnstableApi
const val ICON_PLAYBACK_SPEED_1_8 = 1045728: Int

An icon showing a 1.8x speed symbol.

ICON_PLAYBACK_SPEED_2_0

@UnstableApi
const val ICON_PLAYBACK_SPEED_2_0 = 62699: Int

An icon showing a 2.0x speed symbol.

ICON_PLAYLIST_ADD

@UnstableApi
const val ICON_PLAYLIST_ADD = 57403: Int

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

ICON_PLAYLIST_REMOVE

@UnstableApi
const val ICON_PLAYLIST_REMOVE = 60288: Int

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

ICON_PLUS

@UnstableApi
const val ICON_PLUS = 57669: Int

An icon showing a plus symbol.

ICON_PLUS_CIRCLE_FILLED

@UnstableApi
const val ICON_PLUS_CIRCLE_FILLED = 1040711: Int

An icon showing a filled circle with a plus.

ICON_PLUS_CIRCLE_UNFILLED

@UnstableApi
const val ICON_PLUS_CIRCLE_UNFILLED = 57671: Int

An icon showing an unfilled circle with a plus.

ICON_PREVIOUS

@UnstableApi
const val ICON_PREVIOUS = 57413: Int

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

ICON_QUALITY

@UnstableApi
const val ICON_QUALITY = 58409: Int

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

ICON_QUEUE_ADD

@UnstableApi
const val ICON_QUEUE_ADD = 57436: Int

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

ICON_QUEUE_NEXT

@UnstableApi
const val ICON_QUEUE_NEXT = 57446: Int

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

ICON_QUEUE_REMOVE

@UnstableApi
const val ICON_QUEUE_REMOVE = 57447: Int

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

ICON_RADIO

@UnstableApi
const val ICON_RADIO = 58654: Int

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

ICON_REPEAT_ALL

@UnstableApi
const val ICON_REPEAT_ALL = 57408: Int

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

ICON_REPEAT_OFF

@UnstableApi
const val ICON_REPEAT_OFF = 1040448: Int

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

ICON_REPEAT_ONE

@UnstableApi
const val ICON_REPEAT_ONE = 57409: Int

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

ICON_REWIND

@UnstableApi
const val ICON_REWIND = 57376: Int

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

ICON_SETTINGS

@UnstableApi
const val ICON_SETTINGS = 59576: Int

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

ICON_SHARE

@UnstableApi
const val ICON_SHARE = 59405: Int

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

ICON_SHUFFLE_OFF

@UnstableApi
const val ICON_SHUFFLE_OFF = 1040452: Int

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

ICON_SHUFFLE_ON

@UnstableApi
const val ICON_SHUFFLE_ON = 57411: Int

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

ICON_SHUFFLE_STAR

@UnstableApi
const val ICON_SHUFFLE_STAR = 1040451: Int

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

ICON_SIGNAL

@UnstableApi
const val ICON_SIGNAL = 61512: Int

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

ICON_SKIP_BACK

@UnstableApi
const val ICON_SKIP_BACK = 57410: Int

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

ICON_SKIP_BACK_10

@UnstableApi
const val ICON_SKIP_BACK_10 = 57433: Int

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

ICON_SKIP_BACK_15

@UnstableApi
const val ICON_SKIP_BACK_15 = 1040473: Int

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

ICON_SKIP_BACK_30

@UnstableApi
const val ICON_SKIP_BACK_30 = 57434: Int

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

ICON_SKIP_BACK_5

@UnstableApi
const val ICON_SKIP_BACK_5 = 57435: Int

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

ICON_SKIP_FORWARD

@UnstableApi
const val ICON_SKIP_FORWARD = 63220: Int

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

ICON_SKIP_FORWARD_10

@UnstableApi
const val ICON_SKIP_FORWARD_10 = 57430: Int

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

ICON_SKIP_FORWARD_15

@UnstableApi
const val ICON_SKIP_FORWARD_15 = 1040470: Int

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

ICON_SKIP_FORWARD_30

@UnstableApi
const val ICON_SKIP_FORWARD_30 = 57431: Int

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

ICON_SKIP_FORWARD_5

@UnstableApi
const val ICON_SKIP_FORWARD_5 = 57432: Int

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

ICON_STAR_FILLED

@UnstableApi
const val ICON_STAR_FILLED = 1042488: Int

An icon showing a filled star symbol.

ICON_STAR_UNFILLED

@UnstableApi
const val ICON_STAR_UNFILLED = 59448: Int

An icon showing an unfilled star symbol.

ICON_STOP

@UnstableApi
const val ICON_STOP = 57415: Int

An icon showing a stop symbol (a square).

ICON_SUBTITLES

@UnstableApi
const val ICON_SUBTITLES = 57416: Int

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

ICON_SUBTITLES_OFF

@UnstableApi
const val ICON_SUBTITLES_OFF = 61298: Int

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

ICON_SYNC

@UnstableApi
const val ICON_SYNC = 58919: Int

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

ICON_THUMB_DOWN_FILLED

@UnstableApi
const val ICON_THUMB_DOWN_FILLED = 1042651: Int

An icon showing a filled thumb-down symbol.

ICON_THUMB_DOWN_UNFILLED

@UnstableApi
const val ICON_THUMB_DOWN_UNFILLED = 59611: Int

An icon showing an unfilled thumb-down symbol.

ICON_THUMB_UP_FILLED

@UnstableApi
const val ICON_THUMB_UP_FILLED = 1042652: Int

An icon showing a filled thumb-up symbol.

ICON_THUMB_UP_UNFILLED

@UnstableApi
const val ICON_THUMB_UP_UNFILLED = 59612: Int

An icon showing an unfilled thumb-up symbol.

ICON_UNDEFINED

@UnstableApi
const val ICON_UNDEFINED = 0: Int

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

ICON_VOLUME_DOWN

@UnstableApi
const val ICON_VOLUME_DOWN = 57421: Int

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

ICON_VOLUME_OFF

@UnstableApi
const val ICON_VOLUME_OFF = 57423: Int

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

ICON_VOLUME_UP

@UnstableApi
const val ICON_VOLUME_UP = 57424: Int

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

SLOT_BACK

@UnstableApi
const val SLOT_BACK = 2: Int

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

SLOT_BACK_SECONDARY

@UnstableApi
const val SLOT_BACK_SECONDARY = 4: Int

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

SLOT_CENTRAL

@UnstableApi
const val SLOT_CENTRAL = 1: Int

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

SLOT_FORWARD

@UnstableApi
const val SLOT_FORWARD = 3: Int

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
const val SLOT_FORWARD_SECONDARY = 5: Int

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
const val SLOT_OVERFLOW = 6: Int

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

Public functions

equals

fun equals(obj: Any?): Boolean

Checks the given command button for equality while ignoring extras.

fromBundle

@UnstableApi
java-static fun fromBundle(bundle: Bundle!): CommandButton!

fromBundle

@UnstableApi
java-static fun fromBundle(bundle: Bundle!, sessionInterfaceVersion: Int): CommandButton!

Restores a CommandButton from a Bundle.

getDefaultSlot

@UnstableApi
@CommandButton.Slot
java-static fun getDefaultSlot(
    @Player.Command playerCommand: Int,
    @CommandButton.Icon icon: Int
): Int

Returns the default Slot for a button.

Parameters
@Player.Command playerCommand: Int

The Player.Command associated with this button.

@CommandButton.Icon icon: Int

The Icon of this button.

Returns
Int

The default Slot for this button.

getIconResIdForIconConstant

@UnstableApi
java-static fun getIconResIdForIconConstant(@CommandButton.Icon icon: Int): @DrawableRes Int

Returns a drawable resource id for the given Icon constant.

Parameters
@CommandButton.Icon icon: Int

The Icon.

Returns
@DrawableRes Int

The drawable resource if for the icon, or 0 if not found.

hashCode

fun hashCode(): Int

toBundle

@UnstableApi
fun toBundle(): Bundle!

Public properties

displayName

val displayNameCharSequence!

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

extras

@UnstableApi
val extrasBundle!

The extra Bundle of the button. It's private information between session and controller.

icon

@UnstableApi
@CommandButton.Icon
val iconInt

The Icon of the button.

iconResId

val iconResId: @DrawableRes Int

The icon resource id of the button that is used when the predefined icon is not available or set to ICON_UNDEFINED. Can be 0 if not needed.

iconUri

@UnstableApi
val iconUriUri?

The content or resourceUri for the icon of the button that is used when the predefined icon is not available or set to ICON_UNDEFINED. Can be null.

Note that this value can be used in addition to iconResId for consumers that are capable of loading the content or resource Uri.

isEnabled

val isEnabledBoolean

Whether the button is enabled.

Note that this value will be set to false for MediaController instances if the corresponding command is not available to this controller (see playerCommand and sessionCommand).

playerCommand

@Player.Command
val playerCommandInt

The Player.Command command of the button. Will be COMMAND_INVALID if sessionCommand is set.

sessionCommand

val sessionCommandSessionCommand?

The session command of the button. Will be null if playerCommand is set.

slots

@UnstableApi
val slotsImmutableIntArray!

The allowed 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.