public final class MediaMetadata extends Object implements Parcelable
Modifier and Type | Class and Description |
---|---|
static interface |
MediaMetadata.BitmapKey |
static class |
MediaMetadata.Builder
Use to build MediaMetadata objects.
|
static interface |
MediaMetadata.LongKey |
static interface |
MediaMetadata.RatingKey |
static interface |
MediaMetadata.TextKey |
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<MediaMetadata> |
CREATOR |
static String |
METADATA_KEY_ALBUM
The album title for the media.
|
static String |
METADATA_KEY_ALBUM_ART
The artwork for the album of the media's original source as a
Bitmap . |
static String |
METADATA_KEY_ALBUM_ART_URI
The artwork for the album of the media's original source as a Uri
formatted String.
|
static String |
METADATA_KEY_ALBUM_ARTIST
The artist for the album of the media's original source.
|
static String |
METADATA_KEY_ART
The artwork for the media as a
Bitmap . |
static String |
METADATA_KEY_ART_URI
The artwork for the media as a Uri formatted String.
|
static String |
METADATA_KEY_ARTIST
The artist of the media.
|
static String |
METADATA_KEY_AUTHOR
The author of the media.
|
static String |
METADATA_KEY_COMPILATION
The compilation status of the media.
|
static String |
METADATA_KEY_COMPOSER
The composer of the media.
|
static String |
METADATA_KEY_DATE
The date the media was created or published.
|
static String |
METADATA_KEY_DISC_NUMBER
The disc number for the media's original source.
|
static String |
METADATA_KEY_DISPLAY_DESCRIPTION
A description that is suitable for display to the user.
|
static String |
METADATA_KEY_DISPLAY_ICON
An icon or thumbnail that is suitable for display to the user.
|
static String |
METADATA_KEY_DISPLAY_ICON_URI
A Uri formatted String for an icon or thumbnail that is suitable for
display to the user.
|
static String |
METADATA_KEY_DISPLAY_SUBTITLE
A subtitle that is suitable for display to the user.
|
static String |
METADATA_KEY_DISPLAY_TITLE
A title that is suitable for display to the user.
|
static String |
METADATA_KEY_DURATION
The duration of the media in ms.
|
static String |
METADATA_KEY_GENRE
The genre of the media.
|
static String |
METADATA_KEY_MEDIA_ID
A String key for identifying the content.
|
static String |
METADATA_KEY_NUM_TRACKS
The number of tracks in the media's original source.
|
static String |
METADATA_KEY_RATING
The overall rating for the media.
|
static String |
METADATA_KEY_TITLE
The title of the media.
|
static String |
METADATA_KEY_TRACK_NUMBER
The track number for the media.
|
static String |
METADATA_KEY_USER_RATING
The user's rating for the media.
|
static String |
METADATA_KEY_WRITER
The writer of the media.
|
static String |
METADATA_KEY_YEAR
The year the media was created or published as a long.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
Returns true if the given key is contained in the metadata
|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
Bitmap |
getBitmap(String key)
Returns a
Bitmap for the given key or null if no bitmap exists
for the given key. |
MediaDescription |
getDescription()
Returns a simple description of this metadata for display purposes.
|
static String |
getKeyFromMetadataEditorKey(int editorKey)
Helper for getting the String key used by
MediaMetadata from the
integer key that MediaMetadataEditor uses. |
long |
getLong(String key)
Returns the value associated with the given key, or 0L if no long exists
for the given key.
|
Rating |
getRating(String key)
Returns a
Rating for the given key or null if no rating exists
for the given key. |
String |
getString(String key)
Returns the text value associated with the given key as a String, 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(String key)
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.
|
Set<String> |
keySet()
Returns a Set containing the Strings used as keys in this metadata.
|
int |
size()
Returns the number of fields in this metadata.
|
void |
writeToParcel(Parcel dest,
int flags)
Flatten this object in to a Parcel.
|
public static final String METADATA_KEY_TITLE
public static final String METADATA_KEY_ARTIST
public static final String METADATA_KEY_DURATION
public static final String METADATA_KEY_ALBUM
public static final String METADATA_KEY_AUTHOR
public static final String METADATA_KEY_WRITER
public static final String METADATA_KEY_COMPOSER
public static final String METADATA_KEY_COMPILATION
public static final String METADATA_KEY_DATE
public static final String METADATA_KEY_YEAR
public static final String METADATA_KEY_GENRE
public static final String METADATA_KEY_TRACK_NUMBER
public static final String METADATA_KEY_NUM_TRACKS
public static final String METADATA_KEY_DISC_NUMBER
public static final String METADATA_KEY_ALBUM_ARTIST
public static final String METADATA_KEY_ART
Bitmap
.
The artwork should be relatively small and may be scaled down by the
system if it is too large. For higher resolution artwork
METADATA_KEY_ART_URI
should be used instead.
public static final String METADATA_KEY_ART_URI
ContentResolver.openInputStream(android.net.Uri)
and
BitmapFactory.decodeStream(java.io.InputStream, android.graphics.Rect, android.graphics.BitmapFactory.Options)
.
For the best results, Uris should use the content:// style and support
ContentResolver.EXTRA_SIZE
for retrieving scaled artwork through
ContentResolver.openTypedAssetFileDescriptor(Uri, String, Bundle)
.
public static final String METADATA_KEY_ALBUM_ART
Bitmap
.
The artwork should be relatively small and may be scaled down by the
system if it is too large. For higher resolution artwork
METADATA_KEY_ALBUM_ART_URI
should be used instead.
public static final String METADATA_KEY_ALBUM_ART_URI
ContentResolver.openInputStream(android.net.Uri)
and
BitmapFactory.decodeStream(java.io.InputStream, android.graphics.Rect, android.graphics.BitmapFactory.Options)
.
For the best results, Uris should use the content:// style and support
ContentResolver.EXTRA_SIZE
for retrieving scaled artwork through
ContentResolver.openTypedAssetFileDescriptor(Uri, String, Bundle)
.
public static final String METADATA_KEY_USER_RATING
Rating
,
Constant Field Valuespublic static final String METADATA_KEY_RATING
Rating
,
Constant Field Valuespublic static final String METADATA_KEY_DISPLAY_TITLE
METADATA_KEY_TITLE
but may differ for some formats.
When displaying media described by this metadata this should be preferred
if present.public static final String METADATA_KEY_DISPLAY_SUBTITLE
public static final String METADATA_KEY_DISPLAY_DESCRIPTION
public static final String METADATA_KEY_DISPLAY_ICON
Bitmap
.
The icon should be relatively small and may be scaled down by the system
if it is too large. For higher resolution artwork
METADATA_KEY_DISPLAY_ICON_URI
should be used instead.
public static final String METADATA_KEY_DISPLAY_ICON_URI
ContentResolver.openInputStream(android.net.Uri)
and
BitmapFactory.decodeStream(java.io.InputStream, android.graphics.Rect, android.graphics.BitmapFactory.Options)
.
For the best results, Uris should use the content:// style and support
ContentResolver.EXTRA_SIZE
for retrieving scaled artwork through
ContentResolver.openTypedAssetFileDescriptor(Uri, String, Bundle)
.
public static final String METADATA_KEY_MEDIA_ID
MediaController.TransportControls#playFromMediaId(String, Bundle)
to initiate playback when provided by a MediaBrowser
connected to
the same app.public static final Parcelable.Creator<MediaMetadata> CREATOR
public boolean containsKey(String key)
key
- a String keypublic CharSequence getText(String key)
key
- The key the value is stored underpublic String getString(String key)
getText().toString()
if the value is not null.key
- The key the value is stored underpublic long getLong(String key)
key
- The key the value is stored underpublic Rating getRating(String key)
Rating
for the given key or null if no rating exists
for the given key.key
- The key the value is stored underRating
or nullpublic Bitmap getBitmap(String key)
Bitmap
for the given key or null if no bitmap exists
for the given key.key
- The key the value is stored underBitmap
or nullpublic int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel dest, int flags)
Parcelable
writeToParcel
in interface Parcelable
dest
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.public int size()
public Set<String> keySet()
public MediaDescription getDescription()
public static String getKeyFromMetadataEditorKey(int editorKey)
MediaMetadata
from the
integer key that MediaMetadataEditor
uses.editorKey
- The key used by the editor