MediaMetadataCompat

class MediaMetadataCompat : Parcelable


Contains metadata about an item, such as the title, artist, etc.

Summary

Nested types

Use to build MediaMetadata objects.

Constants

const Parcelable.Creator<MediaMetadataCompat!>!
const String!
METADATA_KEY_ADVERTISEMENT = "android.media.metadata.ADVERTISEMENT"

Whether the media is an advertisement.

const String!
METADATA_KEY_ALBUM = "android.media.metadata.ALBUM"

The album title for the media.

const String!
METADATA_KEY_ALBUM_ART = "android.media.metadata.ALBUM_ART"

The artwork for the album of the media's original source as a Bitmap.

const String!
METADATA_KEY_ALBUM_ARTIST = "android.media.metadata.ALBUM_ARTIST"

The artist for the album of the media's original source.

const String!
METADATA_KEY_ALBUM_ART_URI = "android.media.metadata.ALBUM_ART_URI"

The artwork for the album of the media's original source as a Uri style String.

const String!
METADATA_KEY_ART = "android.media.metadata.ART"

The artwork for the media as a Bitmap.

const String!
METADATA_KEY_ARTIST = "android.media.metadata.ARTIST"

The artist of the media.

const String!
METADATA_KEY_ART_URI = "android.media.metadata.ART_URI"

The artwork for the media as a Uri style String.

const String!
METADATA_KEY_AUTHOR = "android.media.metadata.AUTHOR"

The author of the media.

const String!
METADATA_KEY_BT_FOLDER_TYPE = "android.media.metadata.BT_FOLDER_TYPE"

The bluetooth folder type of the media specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

const String!
METADATA_KEY_COMPILATION = "android.media.metadata.COMPILATION"

The compilation status of the media.

const String!
METADATA_KEY_COMPOSER = "android.media.metadata.COMPOSER"

The composer of the media.

const String!
METADATA_KEY_DATE = "android.media.metadata.DATE"

The date the media was created or published.

const String!
METADATA_KEY_DISC_NUMBER = "android.media.metadata.DISC_NUMBER"

The disc number for the media's original source.

const String!
METADATA_KEY_DISPLAY_DESCRIPTION = "android.media.metadata.DISPLAY_DESCRIPTION"

A description that is suitable for display to the user.

const String!
METADATA_KEY_DISPLAY_ICON = "android.media.metadata.DISPLAY_ICON"

An icon or thumbnail that is suitable for display to the user.

const String!
METADATA_KEY_DISPLAY_ICON_URI = "android.media.metadata.DISPLAY_ICON_URI"

An icon or thumbnail that is suitable for display to the user.

const String!
METADATA_KEY_DISPLAY_SUBTITLE = "android.media.metadata.DISPLAY_SUBTITLE"

A subtitle that is suitable for display to the user.

const String!
METADATA_KEY_DISPLAY_TITLE = "android.media.metadata.DISPLAY_TITLE"

A title that is suitable for display to the user.

const String!
METADATA_KEY_DOWNLOAD_STATUS = "android.media.metadata.DOWNLOAD_STATUS"

The download status of the media which will be used for later offline playback.

const String!
METADATA_KEY_DURATION = "android.media.metadata.DURATION"

The duration of the media in ms.

const String!
METADATA_KEY_GENRE = "android.media.metadata.GENRE"

The genre of the media.

const String!
METADATA_KEY_MEDIA_ID = "android.media.metadata.MEDIA_ID"

A String key for identifying the content.

const String!
METADATA_KEY_MEDIA_URI = "android.media.metadata.MEDIA_URI"

A Uri formatted String representing the content.

const String!
METADATA_KEY_NUM_TRACKS = "android.media.metadata.NUM_TRACKS"

The number of tracks in the media's original source.

const String!
METADATA_KEY_RATING = "android.media.metadata.RATING"

The overall rating for the media.

const String!
METADATA_KEY_TITLE = "android.media.metadata.TITLE"

The title of the media.

const String!
METADATA_KEY_TRACK_NUMBER = "android.media.metadata.TRACK_NUMBER"

The track number for the media.

const String!
METADATA_KEY_USER_RATING = "android.media.metadata.USER_RATING"

The user's rating for the media.

const String!
METADATA_KEY_WRITER = "android.media.metadata.WRITER"

The writer of the media.

const String!
METADATA_KEY_YEAR = "android.media.metadata.YEAR"

The year the media was created or published as a long.

Public functions

Boolean

Returns true if the given key is contained in the metadata

Int
java-static MediaMetadataCompat!
fromMediaMetadata(metadataObj: Any!)

Creates an instance from a framework android.media.MediaMetadata object.

Bitmap!

Return a Bitmap for the given key or null if no bitmap exists for the given key.

Bundle!

Gets a copy of the bundle for this metadata object.

MediaDescriptionCompat!

Returns a simple description of this metadata for display purposes.

Long

Returns the value associated with the given key, or 0L if no long exists for the given key.

Any!

Gets the underlying framework android.media.MediaMetadata object.

RatingCompat!

Return a RatingCompat for the given key or null if no rating exists for the given key.

String!

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

CharSequence!

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

(Mutable)Set<String!>!

Returns a Set containing the Strings used as keys in this metadata.

Int

Get the number of fields in this metadata.

Unit
writeToParcel(dest: Parcel!, flags: Int)

Constants

CREATOR

Added in 1.1.0
const val CREATORParcelable.Creator<MediaMetadataCompat!>!

METADATA_KEY_ADVERTISEMENT

Added in 1.1.0
const val METADATA_KEY_ADVERTISEMENT = "android.media.metadata.ADVERTISEMENT": String!

Whether the media is an advertisement. A value of 0 indicates it is not an advertisement. A value of 1 or non-zero indicates it is an advertisement. If not specified, this value is set to 0 by default.

METADATA_KEY_ALBUM

Added in 1.1.0
const val METADATA_KEY_ALBUM = "android.media.metadata.ALBUM": String!

The album title for the media.

METADATA_KEY_ALBUM_ART

Added in 1.1.0
const val METADATA_KEY_ALBUM_ART = "android.media.metadata.ALBUM_ART": String!

The artwork for the album of the media's original source as a Bitmap. The artwork should be relatively small and may be scaled down if it is too large. For higher resolution artwork METADATA_KEY_ALBUM_ART_URI should be used instead.

METADATA_KEY_ALBUM_ARTIST

Added in 1.1.0
const val METADATA_KEY_ALBUM_ARTIST = "android.media.metadata.ALBUM_ARTIST": String!

The artist for the album of the media's original source.

METADATA_KEY_ALBUM_ART_URI

Added in 1.1.0
const val METADATA_KEY_ALBUM_ART_URI = "android.media.metadata.ALBUM_ART_URI": String!

The artwork for the album of the media's original source as a Uri style String.

METADATA_KEY_ART

Added in 1.1.0
const val METADATA_KEY_ART = "android.media.metadata.ART": String!

The artwork for the media as a Bitmap. The artwork should be relatively small and may be scaled down if it is too large. For higher resolution artwork METADATA_KEY_ART_URI should be used instead.

METADATA_KEY_ARTIST

Added in 1.1.0
const val METADATA_KEY_ARTIST = "android.media.metadata.ARTIST": String!

The artist of the media.

METADATA_KEY_ART_URI

Added in 1.1.0
const val METADATA_KEY_ART_URI = "android.media.metadata.ART_URI": String!

The artwork for the media as a Uri style String.

METADATA_KEY_AUTHOR

Added in 1.1.0
const val METADATA_KEY_AUTHOR = "android.media.metadata.AUTHOR": String!

The author of the media.

METADATA_KEY_BT_FOLDER_TYPE

Added in 1.1.0
const val METADATA_KEY_BT_FOLDER_TYPE = "android.media.metadata.BT_FOLDER_TYPE": String!

The bluetooth folder type of the media specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5. It should be one of the following:

METADATA_KEY_COMPILATION

Added in 1.1.0
const val METADATA_KEY_COMPILATION = "android.media.metadata.COMPILATION": String!

The compilation status of the media.

METADATA_KEY_COMPOSER

Added in 1.1.0
const val METADATA_KEY_COMPOSER = "android.media.metadata.COMPOSER": String!

The composer of the media.

METADATA_KEY_DATE

Added in 1.1.0
const val METADATA_KEY_DATE = "android.media.metadata.DATE": String!

The date the media was created or published. The format is unspecified but RFC 3339 is recommended.

METADATA_KEY_DISC_NUMBER

Added in 1.1.0
const val METADATA_KEY_DISC_NUMBER = "android.media.metadata.DISC_NUMBER": String!

The disc number for the media's original source.

METADATA_KEY_DISPLAY_DESCRIPTION

Added in 1.1.0
const val METADATA_KEY_DISPLAY_DESCRIPTION = "android.media.metadata.DISPLAY_DESCRIPTION": String!

A description that is suitable for display to the user. When displaying more information for media described by this metadata this should be preferred to other fields if present.

METADATA_KEY_DISPLAY_ICON

Added in 1.1.0
const val METADATA_KEY_DISPLAY_ICON = "android.media.metadata.DISPLAY_ICON": String!

An icon or thumbnail that is suitable for display to the user. When displaying an icon for media described by this metadata this should be preferred to other fields if present. This must be a Bitmap. The icon should be relatively small and may be scaled down if it is too large. For higher resolution artwork METADATA_KEY_DISPLAY_ICON_URI should be used instead.

METADATA_KEY_DISPLAY_ICON_URI

Added in 1.1.0
const val METADATA_KEY_DISPLAY_ICON_URI = "android.media.metadata.DISPLAY_ICON_URI": String!

An icon or thumbnail that is suitable for display to the user. When displaying more information for media described by this metadata the display description should be preferred to other fields when present. This must be a Uri style String.

METADATA_KEY_DISPLAY_SUBTITLE

Added in 1.1.0
const val METADATA_KEY_DISPLAY_SUBTITLE = "android.media.metadata.DISPLAY_SUBTITLE": String!

A subtitle that is suitable for display to the user. When displaying a second line for media described by this metadata this should be preferred to other fields if present.

METADATA_KEY_DISPLAY_TITLE

Added in 1.1.0
const val METADATA_KEY_DISPLAY_TITLE = "android.media.metadata.DISPLAY_TITLE": String!

A title that is suitable for display to the user. This will generally be the same as METADATA_KEY_TITLE but may differ for some formats. When displaying media described by this metadata this should be preferred if present.

METADATA_KEY_DOWNLOAD_STATUS

Added in 1.1.0
const val METADATA_KEY_DOWNLOAD_STATUS = "android.media.metadata.DOWNLOAD_STATUS": String!

The download status of the media which will be used for later offline playback. It should be one of the following:

METADATA_KEY_DURATION

Added in 1.1.0
const val METADATA_KEY_DURATION = "android.media.metadata.DURATION": String!

The duration of the media in ms. A negative duration indicates that the duration is unknown (or infinite).

METADATA_KEY_GENRE

Added in 1.1.0
const val METADATA_KEY_GENRE = "android.media.metadata.GENRE": String!

The genre of the media.

METADATA_KEY_MEDIA_ID

Added in 1.1.0
const val METADATA_KEY_MEDIA_ID = "android.media.metadata.MEDIA_ID": String!

A String key for identifying the content. This value is specific to the service providing the content. If used, this should be a persistent unique key for the underlying content.

METADATA_KEY_MEDIA_URI

Added in 1.1.0
const val METADATA_KEY_MEDIA_URI = "android.media.metadata.MEDIA_URI": String!

A Uri formatted String representing the content. This value is specific to the service providing the content. It may be used with playFromUri to initiate playback when provided by a MediaBrowserCompat connected to the same app.

METADATA_KEY_NUM_TRACKS

Added in 1.1.0
const val METADATA_KEY_NUM_TRACKS = "android.media.metadata.NUM_TRACKS": String!

The number of tracks in the media's original source.

METADATA_KEY_RATING

Added in 1.1.0
const val METADATA_KEY_RATING = "android.media.metadata.RATING": String!

The overall rating for the media.

See also
RatingCompat

METADATA_KEY_TITLE

Added in 1.1.0
const val METADATA_KEY_TITLE = "android.media.metadata.TITLE": String!

The title of the media.

METADATA_KEY_TRACK_NUMBER

Added in 1.1.0
const val METADATA_KEY_TRACK_NUMBER = "android.media.metadata.TRACK_NUMBER": String!

The track number for the media.

METADATA_KEY_USER_RATING

Added in 1.1.0
const val METADATA_KEY_USER_RATING = "android.media.metadata.USER_RATING": String!

The user's rating for the media.

See also
RatingCompat

METADATA_KEY_WRITER

Added in 1.1.0
const val METADATA_KEY_WRITER = "android.media.metadata.WRITER": String!

The writer of the media.

METADATA_KEY_YEAR

Added in 1.1.0
const val METADATA_KEY_YEAR = "android.media.metadata.YEAR": String!

The year the media was created or published as a long.

Public functions

containsKey

Added in 1.1.0
fun containsKey(key: String!): Boolean

Returns true if the given key is contained in the metadata

Parameters
key: String!

a String key

Returns
Boolean

true if the key exists in this metadata, false otherwise

describeContents

Added in 1.1.0
fun describeContents(): Int

fromMediaMetadata

Added in 1.1.0
java-static fun fromMediaMetadata(metadataObj: Any!): MediaMetadataCompat!

Creates an instance from a framework android.media.MediaMetadata object.

This method is only supported on LOLLIPOP and later.

Parameters
metadataObj: Any!

A android.media.MediaMetadata object, or null if none.

Returns
MediaMetadataCompat!

An equivalent MediaMetadataCompat object, or null if none.

getBitmap

Added in 1.1.0
fun getBitmap(@MediaMetadataCompat.BitmapKey key: String!): Bitmap!

Return a Bitmap for the given key or null if no bitmap exists for the given key.

Parameters
@MediaMetadataCompat.BitmapKey key: String!

The key the value is stored under

Returns
Bitmap!

A Bitmap or null

getBundle

Added in 1.1.0
fun getBundle(): Bundle!

Gets a copy of the bundle for this metadata object. This is available to support backwards compatibility.

Returns
Bundle!

A copy of the bundle for this metadata object.

getDescription

Added in 1.1.0
fun getDescription(): MediaDescriptionCompat!

Returns a simple description of this metadata for display purposes.

Returns
MediaDescriptionCompat!

A simple description of this metadata.

getLong

Added in 1.1.0
fun getLong(@MediaMetadataCompat.LongKey key: String!): Long

Returns the value associated with the given key, or 0L if no long exists for the given key.

Parameters
@MediaMetadataCompat.LongKey key: String!

The key the value is stored under

Returns
Long

a long value

getMediaMetadata

Added in 1.1.0
fun getMediaMetadata(): Any!

Gets the underlying framework android.media.MediaMetadata object.

This method is only supported on LOLLIPOP and later.

Returns
Any!

An equivalent android.media.MediaMetadata object, or null if none.

getRating

Added in 1.1.0
fun getRating(@MediaMetadataCompat.RatingKey key: String!): RatingCompat!

Return a RatingCompat for the given key or null if no rating exists for the given key.

Parameters
@MediaMetadataCompat.RatingKey key: String!

The key the value is stored under

Returns
RatingCompat!

A RatingCompat or null

getString

Added in 1.1.0
fun getString(@MediaMetadataCompat.TextKey key: String!): String!

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Parameters
@MediaMetadataCompat.TextKey key: String!

The key the value is stored under

Returns
String!

a String value, or null

getText

Added in 1.1.0
fun getText(@MediaMetadataCompat.TextKey key: String!): CharSequence!

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Parameters
@MediaMetadataCompat.TextKey key: String!

The key the value is stored under

Returns
CharSequence!

a CharSequence value, or null

keySet

Added in 1.1.0
fun keySet(): (Mutable)Set<String!>!

Returns a Set containing the Strings used as keys in this metadata.

Returns
(Mutable)Set<String!>!

a Set of String keys

size

Added in 1.1.0
fun size(): Int

Get the number of fields in this metadata.

Returns
Int

The number of fields in the metadata.

writeToParcel

Added in 1.1.0
fun writeToParcel(dest: Parcel!, flags: Int): Unit