Register now for Android Dev Summit 2019!

MediaMetadataCompat

class MediaMetadataCompat : Parcelable
kotlin.Any
   ↳ android.support.v4.media.MediaMetadataCompat

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

Summary

Nested classes

Use to build MediaMetadata objects.

Constants

static String

Whether the media is an advertisement.

static String

The album title for the media.

static String

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

static String

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

static String

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

static String

The artwork for the media as a Bitmap.

static String

The artist of the media.

static String

The artwork for the media as a Uri style String.

static String

The author of the media.

static String

The bluetooth folder type of the media specified in the section 6.

static String

The compilation status of the media.

static String

The composer of the media.

static String

The date the media was created or published.

static String

The disc number for the media's original source.

static String

A description that is suitable for display to the user.

static String

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

static String

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

static String

A subtitle that is suitable for display to the user.

static String

A title that is suitable for display to the user.

static String

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

static String

The duration of the media in ms.

static String

The genre of the media.

static String

A String key for identifying the content.

static String

A Uri formatted String representing the content.

static String

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

static String

The overall rating for the media.

static String

The title of the media.

static String

The track number for the media.

static String

The user's rating for the media.

static String

The writer of the media.

static String

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

Public methods

Boolean

Returns true if the given key is contained in the metadata

Int

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
getLong(key: String!)

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!
getText(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.

MutableSet<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)

Properties

static Creator<MediaMetadataCompat!>!

Constants

METADATA_KEY_ADVERTISEMENT

static val METADATA_KEY_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.

Value: "android.media.metadata.ADVERTISEMENT"

METADATA_KEY_ALBUM

static val METADATA_KEY_ALBUM: String

The album title for the media.

Value: "android.media.metadata.ALBUM"

METADATA_KEY_ALBUM_ART

static val METADATA_KEY_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.

Value: "android.media.metadata.ALBUM_ART"

METADATA_KEY_ALBUM_ARTIST

static val METADATA_KEY_ALBUM_ARTIST: String

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

Value: "android.media.metadata.ALBUM_ARTIST"

METADATA_KEY_ALBUM_ART_URI

static val METADATA_KEY_ALBUM_ART_URI: String

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

Value: "android.media.metadata.ALBUM_ART_URI"

METADATA_KEY_ART

static val METADATA_KEY_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.

Value: "android.media.metadata.ART"

METADATA_KEY_ARTIST

static val METADATA_KEY_ARTIST: String

The artist of the media.

Value: "android.media.metadata.ARTIST"

METADATA_KEY_ART_URI

static val METADATA_KEY_ART_URI: String

The artwork for the media as a Uri style String.

Value: "android.media.metadata.ART_URI"

METADATA_KEY_AUTHOR

static val METADATA_KEY_AUTHOR: String

The author of the media.

Value: "android.media.metadata.AUTHOR"

METADATA_KEY_BT_FOLDER_TYPE

static val METADATA_KEY_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:

Value: "android.media.metadata.BT_FOLDER_TYPE"

METADATA_KEY_COMPILATION

static val METADATA_KEY_COMPILATION: String

The compilation status of the media.

Value: "android.media.metadata.COMPILATION"

METADATA_KEY_COMPOSER

static val METADATA_KEY_COMPOSER: String

The composer of the media.

Value: "android.media.metadata.COMPOSER"

METADATA_KEY_DATE

static val METADATA_KEY_DATE: String

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

Value: "android.media.metadata.DATE"

METADATA_KEY_DISC_NUMBER

static val METADATA_KEY_DISC_NUMBER: String

The disc number for the media's original source.

Value: "android.media.metadata.DISC_NUMBER"

METADATA_KEY_DISPLAY_DESCRIPTION

static val METADATA_KEY_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.

Value: "android.media.metadata.DISPLAY_DESCRIPTION"

METADATA_KEY_DISPLAY_ICON

static val METADATA_KEY_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.

Value: "android.media.metadata.DISPLAY_ICON"

METADATA_KEY_DISPLAY_ICON_URI

static val METADATA_KEY_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.

Value: "android.media.metadata.DISPLAY_ICON_URI"

METADATA_KEY_DISPLAY_SUBTITLE

static val METADATA_KEY_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.

Value: "android.media.metadata.DISPLAY_SUBTITLE"

METADATA_KEY_DISPLAY_TITLE

static val METADATA_KEY_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.

Value: "android.media.metadata.DISPLAY_TITLE"

METADATA_KEY_DOWNLOAD_STATUS

static val METADATA_KEY_DOWNLOAD_STATUS: String

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

Value: "android.media.metadata.DOWNLOAD_STATUS"

METADATA_KEY_DURATION

static val METADATA_KEY_DURATION: String

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

Value: "android.media.metadata.DURATION"

METADATA_KEY_GENRE

static val METADATA_KEY_GENRE: String

The genre of the media.

Value: "android.media.metadata.GENRE"

METADATA_KEY_MEDIA_ID

static val METADATA_KEY_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.

Value: "android.media.metadata.MEDIA_ID"

METADATA_KEY_MEDIA_URI

static val METADATA_KEY_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 TransportControls#playFromUri(Uri, Bundle) to initiate playback when provided by a MediaBrowserCompat connected to the same app.

Value: "android.media.metadata.MEDIA_URI"

METADATA_KEY_NUM_TRACKS

static val METADATA_KEY_NUM_TRACKS: String

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

Value: "android.media.metadata.NUM_TRACKS"

METADATA_KEY_RATING

static val METADATA_KEY_RATING: String

The overall rating for the media.

Value: "android.media.metadata.RATING"

See Also

METADATA_KEY_TITLE

static val METADATA_KEY_TITLE: String

The title of the media.

Value: "android.media.metadata.TITLE"

METADATA_KEY_TRACK_NUMBER

static val METADATA_KEY_TRACK_NUMBER: String

The track number for the media.

Value: "android.media.metadata.TRACK_NUMBER"

METADATA_KEY_USER_RATING

static val METADATA_KEY_USER_RATING: String

The user's rating for the media.

Value: "android.media.metadata.USER_RATING"

See Also

METADATA_KEY_WRITER

static val METADATA_KEY_WRITER: String

The writer of the media.

Value: "android.media.metadata.WRITER"

METADATA_KEY_YEAR

static val METADATA_KEY_YEAR: String

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

Value: "android.media.metadata.YEAR"

Public methods

containsKey

fun containsKey(key: String!): Boolean

Returns true if the given key is contained in the metadata

Parameters
key String!: a String key
Return
Boolean: true if the key exists in this metadata, false otherwise

describeContents

fun describeContents(): Int

fromMediaMetadata

static fun fromMediaMetadata(metadataObj: Any!): MediaMetadataCompat!

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

This method is only supported on android.os.Build.VERSION_CODES#LOLLIPOP and later.

Parameters
metadataObj Any!: A android.media.MediaMetadata object, or null if none.
Return
MediaMetadataCompat!: An equivalent MediaMetadataCompat object, or null if none.

getBitmap

fun getBitmap(key: String!): Bitmap!

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

Parameters
key String!: The key the value is stored under
Return
Bitmap!: A Bitmap or null

getBundle

fun getBundle(): Bundle!

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

Return
Bundle!: A copy of the bundle for this metadata object.

getDescription

fun getDescription(): MediaDescriptionCompat!

Returns a simple description of this metadata for display purposes.

Return
MediaDescriptionCompat!: A simple description of this metadata.

getLong

fun getLong(key: String!): Long

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

Parameters
key String!: The key the value is stored under
Return
Long: a long value

getMediaMetadata

fun getMediaMetadata(): Any!

Gets the underlying framework android.media.MediaMetadata object.

This method is only supported on android.os.Build.VERSION_CODES#LOLLIPOP and later.

Return
Any!: An equivalent android.media.MediaMetadata object, or null if none.

getRating

fun getRating(key: String!): RatingCompat!

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

Parameters
key String!: The key the value is stored under
Return
RatingCompat!: A RatingCompat or null

getString

fun getString(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
key String!: The key the value is stored under
Return
String!: a String value, or null

getText

fun getText(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
key String!: The key the value is stored under
Return
CharSequence!: a CharSequence value, or null

keySet

fun keySet(): MutableSet<String!>!

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

Return
MutableSet<String!>!: a Set of String keys

size

fun size(): Int

Get the number of fields in this metadata.

Return
Int: The number of fields in the metadata.

writeToParcel

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

Properties

CREATOR

static val CREATOR: Creator<MediaMetadataCompat!>!