MediaConstants


public final class MediaConstants


Constants that can be shared between media session and controller.

Summary

Constants

static final int

Bundle key used for the error code for expired authentication.

static final String
@UnstableApi
EXTRAS_KEY_APPLICATION_PREFERENCES_USING_CAR_APP_LIBRARY_INTENT = "androidx.media.BrowserRoot.Extras.APPLICATION_PREFERENCES_USING_CAR_APP_LIBRARY_INTENT"

Bundle key used to indicate that the media app that provides the service supports showing a settings page.

static final String
@UnstableApi
EXTRAS_KEY_COMMAND_BUTTON_ICON_COMPAT = "androidx.media3.session.EXTRAS_KEY_COMMAND_BUTTON_ICON_COMPAT"

Bundle key used to indicate the CommandButton.Icon in the extras of the legacy PlaybackStateCompat.CustomAction.

static final String
@UnstableApi
EXTRAS_KEY_COMPLETION_PERCENTAGE = "androidx.media.MediaItem.Extras.COMPLETION_PERCENTAGE"

Bundle key used in extras to indicate an amount of completion progress for the corresponding MediaItem.

static final String
@UnstableApi
EXTRAS_KEY_COMPLETION_STATUS = "android.media.extra.PLAYBACK_STATUS"

Bundle key used in extras to indicate the playback completion status of the corresponding MediaItem.

static final String
@UnstableApi
EXTRAS_KEY_CONTENT_STYLE_BROWSABLE = "android.media.browse.CONTENT_STYLE_BROWSABLE_HINT"

Bundle key used to indicate a preference about how browsable instances of are presented.

static final String
@UnstableApi
EXTRAS_KEY_CONTENT_STYLE_GROUP_TITLE = "android.media.browse.CONTENT_STYLE_GROUP_TITLE_HINT"

Bundle key used in extras to indicate that certain instances of MediaItem are related as a group, with a title that is specified through the bundle value.

static final String
@UnstableApi
EXTRAS_KEY_CONTENT_STYLE_PLAYABLE = "android.media.browse.CONTENT_STYLE_PLAYABLE_HINT"

Bundle key used to indicate a preference about how playable instances of are presented.

static final String
@UnstableApi
EXTRAS_KEY_CONTENT_STYLE_SINGLE_ITEM = "android.media.browse.CONTENT_STYLE_SINGLE_ITEM_HINT"

Bundle key used in extras to indicate a preference about how the corresponding MediaItem is presented.

static final String
@UnstableApi
EXTRAS_KEY_DOWNLOAD_STATUS = "android.media.extra.DOWNLOAD_STATUS"

Bundle key used as a long extra field to indicate the download status of the media item.

static final String
EXTRAS_KEY_ERROR_RESOLUTION_ACTION_INTENT_COMPAT = "android.media.extras.ERROR_RESOLUTION_ACTION_INTENT"

Bundle key used for an error resolution intent.

static final String
EXTRAS_KEY_ERROR_RESOLUTION_ACTION_LABEL_COMPAT = "android.media.extras.ERROR_RESOLUTION_ACTION_LABEL"

Bundle key used for a localized error resolution string.

static final String
@UnstableApi
EXTRAS_KEY_ERROR_RESOLUTION_USING_CAR_APP_LIBRARY_INTENT_COMPAT = "androidx.media.PlaybackStateCompat.Extras.ERROR_RESOLUTION_USING_CAR_APP_LIBRARY_INTENT"

Bundle key used to store a PendingIntent.

static final String
@UnstableApi
EXTRAS_KEY_IS_ADVERTISEMENT = "android.media.metadata.ADVERTISEMENT"

Bundle key used in extras to indicate that the corresponding MediaItem is an advertisement.

static final String
@UnstableApi
EXTRAS_KEY_IS_EXPLICIT = "android.media.IS_EXPLICIT"

Bundle key used in extras to indicate that the corresponding MediaItem has explicit content (that is, user discretion is advised when viewing or listening to this content).

static final String
@UnstableApi
EXTRAS_KEY_MEDIA_ART_SIZE_PIXELS = "android.media.extras.MEDIA_ART_SIZE_HINT_PIXELS"

Bundle key used in extras passed by the MediaBrowser as root hints to onGetLibraryRoot to indicate the recommended size, in pixels, for media art bitmaps.

static final String
@UnstableApi
EXTRAS_KEY_MEDIA_ID_COMPAT = "androidx.media.PlaybackStateCompat.Extras.KEY_MEDIA_ID"

Bundle key used for the media id of the media being played.

static final String
@UnstableApi
EXTRAS_KEY_MEDIA_TYPE_COMPAT = "androidx.media3.session.EXTRAS_KEY_MEDIA_TYPE_COMPAT"

Bundle key used to indicate the MediaMetadata.MediaType in the legacy android.support.v4.media.MediaDescriptionCompat as a long extra and as a long value in android.support.v4.media.MediaMetadataCompat.

static final String

Bundle key used for the value of Player.getPlaybackParameters().speed.

static final String
@UnstableApi
EXTRAS_KEY_ROOT_CHILDREN_LIMIT = "androidx.media.MediaBrowserCompat.Extras.KEY_ROOT_CHILDREN_LIMIT"

Bundle key used in extras passed to onGetLibraryRoot to indicate the maximum number of children of the root node that can be supported by the MediaBrowser.

static final String
EXTRAS_KEY_SLOT_RESERVATION_SEEK_TO_NEXT = "android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT"

Bundle key to indicate a preference that a region of space for the skip to next control should always be blocked out in the UI, even when the seek to next standard action is not supported.

static final String
EXTRAS_KEY_SLOT_RESERVATION_SEEK_TO_PREV = "android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS"

Bundle key to indicate a preference that a region of space for the skip to previous control should always be blocked out in the UI, even when the seek to previous standard action is not supported.

static final long

Bundle value used to indicate the presence of an attribute described by its corresponding key.

static final int

Bundle value used in extras to indicate that the corresponding MediaItem has been fully played by the user.

static final int

Bundle value used in extras to indicate that the corresponding MediaItem has not been played by the user.

static final int

Bundle value used in extras to indicate that the corresponding MediaItem has been partially played by the user.

static final int

Bundle value used in extras to indicate a preference that browsable instances of MediaItem should be presented as "category" grid items.

static final int

Bundle value used in extras to indicate a preference that browsable instances of MediaItem should be presented as "category" list items.

static final int

Bundle value used in extras to indicate a preference that certain instances of MediaItem should be presented as grid items.

static final int

Bundle value used in extras to indicate a preference that certain instances of MediaItem should be presented as list items.

static final long

The extras value to indicate that the media item is downloaded for later offline playback.

static final long

The extras value to indicate that the media item is being downloaded.

static final long

The extras value to indicate that the media item is not downloaded.

static final String
@UnstableApi
EXTRA_KEY_ROOT_CHILDREN_BROWSABLE_ONLY = "androidx.media3.session.LibraryParams.Extras.KEY_ROOT_CHILDREN_BROWSABLE_ONLY"

Bundle key used in extras passed to onGetLibraryRoot to indicate whether only browsable media items are supported as children of the root node by the MediaBrowser.

Constants

ERROR_CODE_AUTHENTICATION_EXPIRED_COMPAT

public static final int ERROR_CODE_AUTHENTICATION_EXPIRED_COMPAT = 3

Bundle key used for the error code for expired authentication.

Use this error code to indicate an expired authentication when creating a library result for an unsuccessful service call.

EXTRAS_KEY_APPLICATION_PREFERENCES_USING_CAR_APP_LIBRARY_INTENT

@UnstableApi
public static final String EXTRAS_KEY_APPLICATION_PREFERENCES_USING_CAR_APP_LIBRARY_INTENT = "androidx.media.BrowserRoot.Extras.APPLICATION_PREFERENCES_USING_CAR_APP_LIBRARY_INTENT"

Bundle key used to indicate that the media app that provides the service supports showing a settings page.

Use this key to populate the extras of the LibraryResult returned by onGetLibraryRoot. Use this key with putParcelable to put a PendingIntent that is created using CarPendingIntent#getCarApp().

The Intent carried by the pending intent needs to have the component name set to a Car App Library service that needs to exist in the same application package as the media browser service.

TYPE: PendingIntent.

EXTRAS_KEY_COMMAND_BUTTON_ICON_COMPAT

@UnstableApi
public static final String EXTRAS_KEY_COMMAND_BUTTON_ICON_COMPAT = "androidx.media3.session.EXTRAS_KEY_COMMAND_BUTTON_ICON_COMPAT"

Bundle key used to indicate the CommandButton.Icon in the extras of the legacy PlaybackStateCompat.CustomAction. The corresponding value should be one of the CommandButton.ICON_ integer constants.

EXTRAS_KEY_COMPLETION_PERCENTAGE

@UnstableApi
public static final String EXTRAS_KEY_COMPLETION_PERCENTAGE = "androidx.media.MediaItem.Extras.COMPLETION_PERCENTAGE"

Bundle key used in extras to indicate an amount of completion progress for the corresponding MediaItem. This extra augments the partially played status by indicating how much has been played by the user.

TYPE: double, a value between 0.0 and 1.0, inclusive. 0.0 indicates no completion progress (item is not started) and 1.0 indicates full completion progress (item is fully played). Values in between indicate partial progress (for example, 0.75 indicates the item is 75% complete).

See also
setExtras
extras

EXTRAS_KEY_COMPLETION_STATUS

@UnstableApi
public static final String EXTRAS_KEY_COMPLETION_STATUS = "android.media.extra.PLAYBACK_STATUS"

Bundle key used in extras to indicate the playback completion status of the corresponding MediaItem.

TYPE: int. Possible values are separate constants.

EXTRAS_KEY_CONTENT_STYLE_BROWSABLE

@UnstableApi
public static final String EXTRAS_KEY_CONTENT_STYLE_BROWSABLE = "android.media.browse.CONTENT_STYLE_BROWSABLE_HINT"

Bundle key used to indicate a preference about how browsable instances of are presented.

If exposed through extras of the LibraryResult returned by getLibraryRoot, the preference applies to all browsable items within the browse tree.

If exposed through extras of a browsable media item, the preference applies to only the immediate browsable children. It takes precedence over preferences received with getLibraryRoot.

TYPE: int. Possible values are separate constants.

EXTRAS_KEY_CONTENT_STYLE_GROUP_TITLE

@UnstableApi
public static final String EXTRAS_KEY_CONTENT_STYLE_GROUP_TITLE = "android.media.browse.CONTENT_STYLE_GROUP_TITLE_HINT"

Bundle key used in extras to indicate that certain instances of MediaItem are related as a group, with a title that is specified through the bundle value. Items that are children of the same browsable node and have the same title are members of the same group. An app may present a group's items as a contiguous block and display the title alongside the group.

TYPE: String. Should be human readable and localized.

See also
setExtras
extras

EXTRAS_KEY_CONTENT_STYLE_PLAYABLE

@UnstableApi
public static final String EXTRAS_KEY_CONTENT_STYLE_PLAYABLE = "android.media.browse.CONTENT_STYLE_PLAYABLE_HINT"

Bundle key used to indicate a preference about how playable instances of are presented.

If exposed through extras of the LibraryResult returned by getLibraryRoot, the preference applies to all playable items within the browse tree.

If exposed through extras of a browsable media item, the preference applies to only the immediate playable children. It takes precedence over preferences received with getLibraryRoot.

TYPE: int. Possible values are separate constants.

EXTRAS_KEY_CONTENT_STYLE_SINGLE_ITEM

@UnstableApi
public static final String EXTRAS_KEY_CONTENT_STYLE_SINGLE_ITEM = "android.media.browse.CONTENT_STYLE_SINGLE_ITEM_HINT"

Bundle key used in extras to indicate a preference about how the corresponding MediaItem is presented.

This preference takes precedence over those expressed by EXTRAS_KEY_CONTENT_STYLE_PLAYABLE and EXTRAS_KEY_CONTENT_STYLE_BROWSABLE.

TYPE: int. Possible values are separate constants.

EXTRAS_KEY_DOWNLOAD_STATUS

@UnstableApi
public static final String EXTRAS_KEY_DOWNLOAD_STATUS = "android.media.extra.DOWNLOAD_STATUS"

Bundle key used as a long extra field to indicate the download status of the media item. The value should be one of the following:

EXTRAS_KEY_ERROR_RESOLUTION_ACTION_INTENT_COMPAT

public static final String EXTRAS_KEY_ERROR_RESOLUTION_ACTION_INTENT_COMPAT = "android.media.extras.ERROR_RESOLUTION_ACTION_INTENT"

Bundle key used for an error resolution intent.

Use this key to populate the extras bundle of the LibraryParams when creating a library result for an unsuccessful service call.

EXTRAS_KEY_ERROR_RESOLUTION_ACTION_LABEL_COMPAT

public static final String EXTRAS_KEY_ERROR_RESOLUTION_ACTION_LABEL_COMPAT = "android.media.extras.ERROR_RESOLUTION_ACTION_LABEL"

Bundle key used for a localized error resolution string.

Use this key to populate the extras bundle of the LibraryParams when creating a library result for an unsuccessful service call.

EXTRAS_KEY_ERROR_RESOLUTION_USING_CAR_APP_LIBRARY_INTENT_COMPAT

@UnstableApi
public static final String EXTRAS_KEY_ERROR_RESOLUTION_USING_CAR_APP_LIBRARY_INTENT_COMPAT = "androidx.media.PlaybackStateCompat.Extras.ERROR_RESOLUTION_USING_CAR_APP_LIBRARY_INTENT"

Bundle key used to store a PendingIntent. When launched, the should allow users to resolve the current playback state error.

Applications must also set the error message and EXTRAS_KEY_ERROR_RESOLUTION_ACTION_LABEL_COMPAT for cases in which the intent cannot be auto launched.

Use this key to populate the extras bundle of the LibraryParams when creating a library result for an unsuccessful service call. Must be inserted into the bundle as a parcelable.

TYPE: PendingIntent.

EXTRAS_KEY_IS_ADVERTISEMENT

@UnstableApi
public static final String EXTRAS_KEY_IS_ADVERTISEMENT = "android.media.metadata.ADVERTISEMENT"

Bundle key used in extras to indicate that the corresponding MediaItem is an advertisement.

TYPE: long (to enable, use value EXTRAS_VALUE_ATTRIBUTE_PRESENT)

See also
setExtras
extras

EXTRAS_KEY_IS_EXPLICIT

@UnstableApi
public static final String EXTRAS_KEY_IS_EXPLICIT = "android.media.IS_EXPLICIT"

Bundle key used in extras to indicate that the corresponding MediaItem has explicit content (that is, user discretion is advised when viewing or listening to this content).

TYPE: long (to enable, use value EXTRAS_VALUE_ATTRIBUTE_PRESENT)

See also
setExtras
extras

EXTRAS_KEY_MEDIA_ART_SIZE_PIXELS

@UnstableApi
public static final String EXTRAS_KEY_MEDIA_ART_SIZE_PIXELS = "android.media.extras.MEDIA_ART_SIZE_HINT_PIXELS"

Bundle key used in extras passed by the MediaBrowser as root hints to onGetLibraryRoot to indicate the recommended size, in pixels, for media art bitmaps. Much smaller images may not render well, and much larger images may cause inefficient resource consumption.

EXTRAS_KEY_MEDIA_ID_COMPAT

@UnstableApi
public static final String EXTRAS_KEY_MEDIA_ID_COMPAT = "androidx.media.PlaybackStateCompat.Extras.KEY_MEDIA_ID"

Bundle key used for the media id of the media being played.

Use this key in the extras bundle of the legacy PlaybackStateCompat.

EXTRAS_KEY_MEDIA_TYPE_COMPAT

@UnstableApi
public static final String EXTRAS_KEY_MEDIA_TYPE_COMPAT = "androidx.media3.session.EXTRAS_KEY_MEDIA_TYPE_COMPAT"

Bundle key used to indicate the MediaMetadata.MediaType in the legacy android.support.v4.media.MediaDescriptionCompat as a long extra and as a long value in android.support.v4.media.MediaMetadataCompat.

EXTRAS_KEY_PLAYBACK_SPEED_COMPAT

@UnstableApi
public static final String EXTRAS_KEY_PLAYBACK_SPEED_COMPAT = "EXO_SPEED"

Bundle key used for the value of Player.getPlaybackParameters().speed.

Use this key in the extras bundle of the legacy PlaybackStateCompat.

EXTRAS_KEY_ROOT_CHILDREN_LIMIT

@UnstableApi
public static final String EXTRAS_KEY_ROOT_CHILDREN_LIMIT = "androidx.media.MediaBrowserCompat.Extras.KEY_ROOT_CHILDREN_LIMIT"

Bundle key used in extras passed to onGetLibraryRoot to indicate the maximum number of children of the root node that can be supported by the MediaBrowser. Excess root children may be omitted or made less discoverable.

TYPE: int

EXTRAS_KEY_SLOT_RESERVATION_SEEK_TO_NEXT

public static final String EXTRAS_KEY_SLOT_RESERVATION_SEEK_TO_NEXT = "android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT"

Bundle key to indicate a preference that a region of space for the skip to next control should always be blocked out in the UI, even when the seek to next standard action is not supported.

This may be used when the session temporarily disallows COMMAND_SEEK_TO_NEXT by design.

EXTRAS_KEY_SLOT_RESERVATION_SEEK_TO_PREV

public static final String EXTRAS_KEY_SLOT_RESERVATION_SEEK_TO_PREV = "android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS"

Bundle key to indicate a preference that a region of space for the skip to previous control should always be blocked out in the UI, even when the seek to previous standard action is not supported.

This may be used when the session temporarily disallows COMMAND_SEEK_TO_PREVIOUS by design.

EXTRAS_VALUE_ATTRIBUTE_PRESENT

@UnstableApi
public static final long EXTRAS_VALUE_ATTRIBUTE_PRESENT = 1

Bundle value used to indicate the presence of an attribute described by its corresponding key.

EXTRAS_VALUE_COMPLETION_STATUS_FULLY_PLAYED

@UnstableApi
public static final int EXTRAS_VALUE_COMPLETION_STATUS_FULLY_PLAYED = 2

Bundle value used in extras to indicate that the corresponding MediaItem has been fully played by the user.

EXTRAS_VALUE_COMPLETION_STATUS_NOT_PLAYED

@UnstableApi
public static final int EXTRAS_VALUE_COMPLETION_STATUS_NOT_PLAYED = 0

Bundle value used in extras to indicate that the corresponding MediaItem has not been played by the user.

EXTRAS_VALUE_COMPLETION_STATUS_PARTIALLY_PLAYED

@UnstableApi
public static final int EXTRAS_VALUE_COMPLETION_STATUS_PARTIALLY_PLAYED = 1

Bundle value used in extras to indicate that the corresponding MediaItem has been partially played by the user.

EXTRAS_VALUE_CONTENT_STYLE_CATEGORY_GRID_ITEM

@UnstableApi
public static final int EXTRAS_VALUE_CONTENT_STYLE_CATEGORY_GRID_ITEM = 4

Bundle value used in extras to indicate a preference that browsable instances of MediaItem should be presented as "category" grid items. This means the items provide icons that render well when they do not fill all of the available area.

EXTRAS_VALUE_CONTENT_STYLE_CATEGORY_LIST_ITEM

@UnstableApi
public static final int EXTRAS_VALUE_CONTENT_STYLE_CATEGORY_LIST_ITEM = 3

Bundle value used in extras to indicate a preference that browsable instances of MediaItem should be presented as "category" list items. This means the items provide icons that render well when they do not fill all of the available area.

EXTRAS_VALUE_CONTENT_STYLE_GRID_ITEM

@UnstableApi
public static final int EXTRAS_VALUE_CONTENT_STYLE_GRID_ITEM = 2

Bundle value used in extras to indicate a preference that certain instances of MediaItem should be presented as grid items.

EXTRAS_VALUE_CONTENT_STYLE_LIST_ITEM

@UnstableApi
public static final int EXTRAS_VALUE_CONTENT_STYLE_LIST_ITEM = 1

Bundle value used in extras to indicate a preference that certain instances of MediaItem should be presented as list items.

EXTRAS_VALUE_STATUS_DOWNLOADED

@UnstableApi
public static final long EXTRAS_VALUE_STATUS_DOWNLOADED = 2

The extras value to indicate that the media item is downloaded for later offline playback. Used with EXTRAS_KEY_DOWNLOAD_STATUS.

EXTRAS_VALUE_STATUS_DOWNLOADING

@UnstableApi
public static final long EXTRAS_VALUE_STATUS_DOWNLOADING = 1

The extras value to indicate that the media item is being downloaded. Used with EXTRAS_KEY_DOWNLOAD_STATUS.

EXTRAS_VALUE_STATUS_NOT_DOWNLOADED

@UnstableApi
public static final long EXTRAS_VALUE_STATUS_NOT_DOWNLOADED = 0

The extras value to indicate that the media item is not downloaded. Used with EXTRAS_KEY_DOWNLOAD_STATUS.

EXTRA_KEY_ROOT_CHILDREN_BROWSABLE_ONLY

@UnstableApi
public static final String EXTRA_KEY_ROOT_CHILDREN_BROWSABLE_ONLY = "androidx.media3.session.LibraryParams.Extras.KEY_ROOT_CHILDREN_BROWSABLE_ONLY"

Bundle key used in extras passed to onGetLibraryRoot to indicate whether only browsable media items are supported as children of the root node by the MediaBrowser. If true, root children that are not browsable may be omitted or made less discoverable.

TYPE: boolean.