MediaConstants


class MediaConstants


Constants that can be shared between media session and controller.

Summary

Constants

const Int

Bundle key used for the error code for expired authentication.

const 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.

const 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.

const 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.

const 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.

const 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.

const 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.

const 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.

const String!
EXTRAS_KEY_ERROR_RESOLUTION_ACTION_INTENT_COMPAT = "android.media.extras.ERROR_RESOLUTION_ACTION_INTENT"

Bundle key used for an error resolution intent.

const String!
EXTRAS_KEY_ERROR_RESOLUTION_ACTION_LABEL_COMPAT = "android.media.extras.ERROR_RESOLUTION_ACTION_LABEL"

Bundle key used for a localized error resolution string.

const 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.

const String!
@UnstableApi
EXTRAS_KEY_IS_ADVERTISEMENT = "android.media.metadata.ADVERTISEMENT"

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

const 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).

const 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.

const 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.

const 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 as a long extra and as a long value in android.support.v4.media.MediaMetadataCompat.

const String!

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

const 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.

const 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.

const 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.

const Long

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const 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

const val ERROR_CODE_AUTHENTICATION_EXPIRED_COMPAT = 3: Int

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
const val EXTRAS_KEY_APPLICATION_PREFERENCES_USING_CAR_APP_LIBRARY_INTENT = "androidx.media.BrowserRoot.Extras.APPLICATION_PREFERENCES_USING_CAR_APP_LIBRARY_INTENT": String!

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_COMPLETION_PERCENTAGE

@UnstableApi
const val EXTRAS_KEY_COMPLETION_PERCENTAGE = "androidx.media.MediaItem.Extras.COMPLETION_PERCENTAGE": String!

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
const val EXTRAS_KEY_COMPLETION_STATUS = "android.media.extra.PLAYBACK_STATUS": String!

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
const val EXTRAS_KEY_CONTENT_STYLE_BROWSABLE = "android.media.browse.CONTENT_STYLE_BROWSABLE_HINT": String!

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
const val EXTRAS_KEY_CONTENT_STYLE_GROUP_TITLE = "android.media.browse.CONTENT_STYLE_GROUP_TITLE_HINT": String!

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
const val EXTRAS_KEY_CONTENT_STYLE_PLAYABLE = "android.media.browse.CONTENT_STYLE_PLAYABLE_HINT": String!

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
const val EXTRAS_KEY_CONTENT_STYLE_SINGLE_ITEM = "android.media.browse.CONTENT_STYLE_SINGLE_ITEM_HINT": String!

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_ERROR_RESOLUTION_ACTION_INTENT_COMPAT

const val EXTRAS_KEY_ERROR_RESOLUTION_ACTION_INTENT_COMPAT = "android.media.extras.ERROR_RESOLUTION_ACTION_INTENT": String!

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

const val EXTRAS_KEY_ERROR_RESOLUTION_ACTION_LABEL_COMPAT = "android.media.extras.ERROR_RESOLUTION_ACTION_LABEL": String!

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
const val EXTRAS_KEY_ERROR_RESOLUTION_USING_CAR_APP_LIBRARY_INTENT_COMPAT = "androidx.media.PlaybackStateCompat.Extras.ERROR_RESOLUTION_USING_CAR_APP_LIBRARY_INTENT": String!

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
const val EXTRAS_KEY_IS_ADVERTISEMENT = "android.media.metadata.ADVERTISEMENT": String!

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
const val EXTRAS_KEY_IS_EXPLICIT = "android.media.IS_EXPLICIT": String!

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
const val EXTRAS_KEY_MEDIA_ART_SIZE_PIXELS = "android.media.extras.MEDIA_ART_SIZE_HINT_PIXELS": String!

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
const val EXTRAS_KEY_MEDIA_ID_COMPAT = "androidx.media.PlaybackStateCompat.Extras.KEY_MEDIA_ID": String!

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
const val EXTRAS_KEY_MEDIA_TYPE_COMPAT = "androidx.media3.session.EXTRAS_KEY_MEDIA_TYPE_COMPAT": String!

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

EXTRAS_KEY_PLAYBACK_SPEED_COMPAT

@UnstableApi
const val EXTRAS_KEY_PLAYBACK_SPEED_COMPAT = "EXO_SPEED": String!

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
const val EXTRAS_KEY_ROOT_CHILDREN_LIMIT = "androidx.media.MediaBrowserCompat.Extras.KEY_ROOT_CHILDREN_LIMIT": String!

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

const val EXTRAS_KEY_SLOT_RESERVATION_SEEK_TO_NEXT = "android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT": String!

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

const val EXTRAS_KEY_SLOT_RESERVATION_SEEK_TO_PREV = "android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS": String!

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
const val EXTRAS_VALUE_ATTRIBUTE_PRESENT = 1: Long

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

EXTRAS_VALUE_COMPLETION_STATUS_FULLY_PLAYED

@UnstableApi
const val EXTRAS_VALUE_COMPLETION_STATUS_FULLY_PLAYED = 2: Int

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
const val EXTRAS_VALUE_COMPLETION_STATUS_NOT_PLAYED = 0: Int

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
const val EXTRAS_VALUE_COMPLETION_STATUS_PARTIALLY_PLAYED = 1: Int

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
const val EXTRAS_VALUE_CONTENT_STYLE_CATEGORY_GRID_ITEM = 4: Int

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
const val EXTRAS_VALUE_CONTENT_STYLE_CATEGORY_LIST_ITEM = 3: Int

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
const val EXTRAS_VALUE_CONTENT_STYLE_GRID_ITEM = 2: Int

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
const val EXTRAS_VALUE_CONTENT_STYLE_LIST_ITEM = 1: Int

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

EXTRA_KEY_ROOT_CHILDREN_BROWSABLE_ONLY

@UnstableApi
const val EXTRA_KEY_ROOT_CHILDREN_BROWSABLE_ONLY = "androidx.media3.session.LibraryParams.Extras.KEY_ROOT_CHILDREN_BROWSABLE_ONLY": String!

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.