MediaMetadata


public final class MediaMetadata


Metadata of a MediaItem, playlist, or a combination of multiple sources of .

Summary

Nested types

public final class MediaMetadata.Builder

A builder for MediaMetadata instances.

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = )
@IntDef(value = )
public annotation MediaMetadata.FolderType

This annotation is deprecated.

Use isBrowsable to indicate if an item is a browsable folder and use mediaType to indicate the type of the folder.

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation MediaMetadata.MediaType

The type of content described by the media item.

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = )
@IntDef(value = )
public annotation MediaMetadata.PictureType

The picture type of the artwork.

Constants

static final MediaMetadata

Empty MediaMetadata.

static final int

This field is deprecated.

Use isBrowsable set to true and mediaType set to MEDIA_TYPE_FOLDER_ALBUMS instead.

static final int

This field is deprecated.

Use isBrowsable set to true and mediaType set to MEDIA_TYPE_FOLDER_ARTISTS instead.

static final int

This field is deprecated.

Use isBrowsable set to true and mediaType set to MEDIA_TYPE_FOLDER_GENRES instead.

static final int

This field is deprecated.

Use isBrowsable set to true and mediaType set to MEDIA_TYPE_FOLDER_MIXED instead.

static final int

This field is deprecated.

Use isBrowsable set to false instead.

static final int

This field is deprecated.

Use isBrowsable set to true and mediaType set to MEDIA_TYPE_FOLDER_PLAYLISTS instead.

static final int

This field is deprecated.

Use isBrowsable set to true instead.

static final int

This field is deprecated.

Use isBrowsable set to true and mediaType set to MEDIA_TYPE_FOLDER_YEARS instead.

static final int

MediaType for a group of items (e.g., music) belonging to an album.

static final int

MediaType for a group of items (e.g., music) from the same artist.

static final int

MediaType for a group of items forming an audio book.

static final int

MediaType for an audio book chapter.

static final int

MediaType for a folder containing albums.

static final int

MediaType for a folder containing artists.

static final int

MediaType for a folder containing audio books.

static final int

MediaType for a folder containing genres.

static final int

MediaType for a folder with mixed or undetermined content.

static final int

MediaType for a folder containing movies.

static final int

MediaType for a folder containing news.

static final int

MediaType for a folder containing playlists.

static final int

MediaType for a folder containing podcasts.

static final int

MediaType for a folder containing radio stations.

static final int

MediaType for a folder containing movie trailers.

static final int

MediaType for a folder containing TV channels.

static final int

MediaType for a folder containing TV series.

static final int

MediaType for a folder containing TV shows.

static final int

MediaType for a folder containing videos.

static final int

MediaType for a folder containing years.

static final int

MediaType for a group of items (e.g., music) of the same genre.

static final int

Media of undetermined type or a mix of multiple media types.

static final int

MediaType for a movie.

static final int

MediaType for music.

static final int

MediaType for news.

static final int

MediaType for a group of items (e.g., music) forming a playlist.

static final int

MediaType for a group of items belonging to a podcast.

static final int

MediaType for a podcast episode.

static final int

MediaType for a radio station.

static final int

MediaType for a movie trailer.

static final int

MediaType for a group of items that are part of a TV channel.

static final int

MediaType for a group of items that are part of a TV series.

static final int

MediaType for a group of items that are part of a TV series.

static final int

MediaType for a TV show.

static final int

MediaType for a video.

static final int

MediaType for a group of items (e.g., music) from the same year.

static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int

Public fields

final @Nullable CharSequence

Optional album artist.

final @Nullable CharSequence

Optional album title.

final @Nullable CharSequence

Optional artist.

final @Nullable byte[]

Optional artwork data as a compressed byte array.

final @Nullable @MediaMetadata.PictureType Integer

Optional PictureType of the artwork data.

final @Nullable Uri

Optional artwork Uri.

final @Nullable CharSequence

Optional compilation.

final @Nullable CharSequence

Optional composer.

final @Nullable CharSequence

Optional conductor.

final @Nullable CharSequence

Optional description.

final @Nullable Integer

Optional disc number.

final @Nullable CharSequence

Optional display title.

final @Nullable Long

Optional duration, non-negative and in milliseconds.

final @Nullable Bundle

Optional extras Bundle.

final @Nullable @MediaMetadata.FolderType Integer

This field is deprecated.

Use isBrowsable to indicate if an item is a browsable folder and use mediaType to indicate the type of the folder.

final @Nullable CharSequence

Optional genre.

final @Nullable Boolean

Optional boolean to indicate that the media is a browsable folder.

final @Nullable Boolean

Optional boolean to indicate that the media is playable.

final @Nullable @MediaMetadata.MediaType Integer

Optional MediaType.

final @Nullable Rating

Optional overall Rating.

final @Nullable Integer

Optional day of the recording date.

final @Nullable Integer

Optional month of the recording date.

final @Nullable Integer

Optional year of the recording date.

final @Nullable Integer

Optional day of the release date.

final @Nullable Integer

Optional month of the release date.

final @Nullable Integer

Optional year of the release date.

final @Nullable CharSequence

Optional name of the station streaming the media.

final @Nullable CharSequence

Optional subtitle.

final @Nullable CharSequence

Optional title.

final @Nullable Integer

Optional total number of discs.

final @Nullable Integer

Optional total number of tracks.

final @Nullable Integer

Optional track number.

final @Nullable Rating

Optional user Rating.

final @Nullable CharSequence

Optional writer.

final @Nullable Integer

This field is deprecated.

Use recordingYear instead.

Public methods

MediaMetadata.Builder

Returns a new Builder instance with the current MediaMetadata fields.

boolean

Note: Equality checking does not consider extras.

static MediaMetadata

Restores a MediaMetadata from a Bundle.

int
Bundle

Constants

EMPTY

public static final MediaMetadata EMPTY

Empty MediaMetadata.

FOLDER_TYPE_ALBUMS

public static final int FOLDER_TYPE_ALBUMS = 2

Type for a folder containing media categorized by album.

FOLDER_TYPE_ARTISTS

public static final int FOLDER_TYPE_ARTISTS = 3

Type for a folder containing media categorized by artist.

FOLDER_TYPE_GENRES

public static final int FOLDER_TYPE_GENRES = 4

Type for a folder containing media categorized by genre.

FOLDER_TYPE_MIXED

public static final int FOLDER_TYPE_MIXED = 0

Type for a folder containing media of mixed types.

FOLDER_TYPE_NONE

public static final int FOLDER_TYPE_NONE = -1

Type for an item that is not a folder.

FOLDER_TYPE_PLAYLISTS

public static final int FOLDER_TYPE_PLAYLISTS = 5

Type for a folder containing a playlist.

FOLDER_TYPE_TITLES

public static final int FOLDER_TYPE_TITLES = 1

Type for a folder containing only playable media.

FOLDER_TYPE_YEARS

public static final int FOLDER_TYPE_YEARS = 6

Type for a folder containing media categorized by year.

MEDIA_TYPE_ALBUM

public static final int MEDIA_TYPE_ALBUM = 10

MediaType for a group of items (e.g., music) belonging to an album.

MEDIA_TYPE_ARTIST

public static final int MEDIA_TYPE_ARTIST = 11

MediaType for a group of items (e.g., music) from the same artist.

MEDIA_TYPE_AUDIO_BOOK

public static final int MEDIA_TYPE_AUDIO_BOOK = 15

MediaType for a group of items forming an audio book. Items in this group are typically of type MEDIA_TYPE_AUDIO_BOOK_CHAPTER.

MEDIA_TYPE_AUDIO_BOOK_CHAPTER

public static final int MEDIA_TYPE_AUDIO_BOOK_CHAPTER = 2

MediaType for an audio book chapter.

MEDIA_TYPE_FOLDER_ALBUMS

public static final int MEDIA_TYPE_FOLDER_ALBUMS = 21

MediaType for a folder containing albums.

MEDIA_TYPE_FOLDER_ARTISTS

public static final int MEDIA_TYPE_FOLDER_ARTISTS = 22

MediaType for a folder containing artists.

MEDIA_TYPE_FOLDER_AUDIO_BOOKS

public static final int MEDIA_TYPE_FOLDER_AUDIO_BOOKS = 26

MediaType for a folder containing audio books.

MEDIA_TYPE_FOLDER_GENRES

public static final int MEDIA_TYPE_FOLDER_GENRES = 23

MediaType for a folder containing genres.

MEDIA_TYPE_FOLDER_MIXED

public static final int MEDIA_TYPE_FOLDER_MIXED = 20

MediaType for a folder with mixed or undetermined content.

MEDIA_TYPE_FOLDER_MOVIES

public static final int MEDIA_TYPE_FOLDER_MOVIES = 35

MediaType for a folder containing movies.

MEDIA_TYPE_FOLDER_NEWS

public static final int MEDIA_TYPE_FOLDER_NEWS = 32

MediaType for a folder containing news.

MEDIA_TYPE_FOLDER_PLAYLISTS

public static final int MEDIA_TYPE_FOLDER_PLAYLISTS = 24

MediaType for a folder containing playlists.

MEDIA_TYPE_FOLDER_PODCASTS

public static final int MEDIA_TYPE_FOLDER_PODCASTS = 27

MediaType for a folder containing podcasts.

MEDIA_TYPE_FOLDER_RADIO_STATIONS

public static final int MEDIA_TYPE_FOLDER_RADIO_STATIONS = 31

MediaType for a folder containing radio stations.

MEDIA_TYPE_FOLDER_TRAILERS

public static final int MEDIA_TYPE_FOLDER_TRAILERS = 34

MediaType for a folder containing movie trailers.

MEDIA_TYPE_FOLDER_TV_CHANNELS

public static final int MEDIA_TYPE_FOLDER_TV_CHANNELS = 28

MediaType for a folder containing TV channels.

MEDIA_TYPE_FOLDER_TV_SERIES

public static final int MEDIA_TYPE_FOLDER_TV_SERIES = 29

MediaType for a folder containing TV series.

MEDIA_TYPE_FOLDER_TV_SHOWS

public static final int MEDIA_TYPE_FOLDER_TV_SHOWS = 30

MediaType for a folder containing TV shows.

MEDIA_TYPE_FOLDER_VIDEOS

public static final int MEDIA_TYPE_FOLDER_VIDEOS = 33

MediaType for a folder containing videos.

MEDIA_TYPE_FOLDER_YEARS

public static final int MEDIA_TYPE_FOLDER_YEARS = 25

MediaType for a folder containing years.

MEDIA_TYPE_GENRE

public static final int MEDIA_TYPE_GENRE = 12

MediaType for a group of items (e.g., music) of the same genre.

MEDIA_TYPE_MIXED

public static final int MEDIA_TYPE_MIXED = 0

Media of undetermined type or a mix of multiple media types.

MEDIA_TYPE_MOVIE

public static final int MEDIA_TYPE_MOVIE = 8

MediaType for a movie.

MEDIA_TYPE_MUSIC

public static final int MEDIA_TYPE_MUSIC = 1

MediaType for music.

MEDIA_TYPE_NEWS

public static final int MEDIA_TYPE_NEWS = 5

MediaType for news.

MEDIA_TYPE_PLAYLIST

public static final int MEDIA_TYPE_PLAYLIST = 13

MediaType for a group of items (e.g., music) forming a playlist.

MEDIA_TYPE_PODCAST

public static final int MEDIA_TYPE_PODCAST = 16

MediaType for a group of items belonging to a podcast. Items in this group are typically of type MEDIA_TYPE_PODCAST_EPISODE.

MEDIA_TYPE_PODCAST_EPISODE

public static final int MEDIA_TYPE_PODCAST_EPISODE = 3

MediaType for a podcast episode.

MEDIA_TYPE_RADIO_STATION

public static final int MEDIA_TYPE_RADIO_STATION = 4

MediaType for a radio station.

MEDIA_TYPE_TRAILER

public static final int MEDIA_TYPE_TRAILER = 7

MediaType for a movie trailer.

MEDIA_TYPE_TV_CHANNEL

public static final int MEDIA_TYPE_TV_CHANNEL = 17

MediaType for a group of items that are part of a TV channel. Items in this group are typically of type MEDIA_TYPE_TV_SHOW, MEDIA_TYPE_TV_SERIES or MEDIA_TYPE_MOVIE.

MEDIA_TYPE_TV_SEASON

public static final int MEDIA_TYPE_TV_SEASON = 19

MediaType for a group of items that are part of a TV series. Items in this group are typically of type MEDIA_TYPE_TV_SHOW.

MEDIA_TYPE_TV_SERIES

public static final int MEDIA_TYPE_TV_SERIES = 18

MediaType for a group of items that are part of a TV series. Items in this group are typically of type MEDIA_TYPE_TV_SHOW or MEDIA_TYPE_TV_SEASON.

MEDIA_TYPE_TV_SHOW

public static final int MEDIA_TYPE_TV_SHOW = 9

MediaType for a TV show.

MEDIA_TYPE_VIDEO

public static final int MEDIA_TYPE_VIDEO = 6

MediaType for a video.

MEDIA_TYPE_YEAR

public static final int MEDIA_TYPE_YEAR = 14

MediaType for a group of items (e.g., music) from the same year.

PICTURE_TYPE_ARTIST_PERFORMER

public static final int PICTURE_TYPE_ARTIST_PERFORMER = 8

PICTURE_TYPE_A_BRIGHT_COLORED_FISH

public static final int PICTURE_TYPE_A_BRIGHT_COLORED_FISH = 17

PICTURE_TYPE_BACK_COVER

public static final int PICTURE_TYPE_BACK_COVER = 4

PICTURE_TYPE_BAND_ARTIST_LOGO

public static final int PICTURE_TYPE_BAND_ARTIST_LOGO = 19

PICTURE_TYPE_BAND_ORCHESTRA

public static final int PICTURE_TYPE_BAND_ORCHESTRA = 10

PICTURE_TYPE_COMPOSER

public static final int PICTURE_TYPE_COMPOSER = 11

PICTURE_TYPE_CONDUCTOR

public static final int PICTURE_TYPE_CONDUCTOR = 9

PICTURE_TYPE_DURING_PERFORMANCE

public static final int PICTURE_TYPE_DURING_PERFORMANCE = 15

PICTURE_TYPE_DURING_RECORDING

public static final int PICTURE_TYPE_DURING_RECORDING = 14

PICTURE_TYPE_FILE_ICON

public static final int PICTURE_TYPE_FILE_ICON = 1

PICTURE_TYPE_FILE_ICON_OTHER

public static final int PICTURE_TYPE_FILE_ICON_OTHER = 2

PICTURE_TYPE_FRONT_COVER

public static final int PICTURE_TYPE_FRONT_COVER = 3

PICTURE_TYPE_ILLUSTRATION

public static final int PICTURE_TYPE_ILLUSTRATION = 18

PICTURE_TYPE_LEAD_ARTIST_PERFORMER

public static final int PICTURE_TYPE_LEAD_ARTIST_PERFORMER = 7

PICTURE_TYPE_LEAFLET_PAGE

public static final int PICTURE_TYPE_LEAFLET_PAGE = 5

PICTURE_TYPE_LYRICIST

public static final int PICTURE_TYPE_LYRICIST = 12

PICTURE_TYPE_MEDIA

public static final int PICTURE_TYPE_MEDIA = 6

PICTURE_TYPE_MOVIE_VIDEO_SCREEN_CAPTURE

public static final int PICTURE_TYPE_MOVIE_VIDEO_SCREEN_CAPTURE = 16

PICTURE_TYPE_OTHER

public static final int PICTURE_TYPE_OTHER = 0

PICTURE_TYPE_PUBLISHER_STUDIO_LOGO

public static final int PICTURE_TYPE_PUBLISHER_STUDIO_LOGO = 20

PICTURE_TYPE_RECORDING_LOCATION

public static final int PICTURE_TYPE_RECORDING_LOCATION = 13

Public fields

albumArtist

public final @Nullable CharSequence albumArtist

Optional album artist.

albumTitle

public final @Nullable CharSequence albumTitle

Optional album title.

artist

public final @Nullable CharSequence artist

Optional artist.

artworkData

public final @Nullable byte[] artworkData

Optional artwork data as a compressed byte array.

artworkDataType

@MediaMetadata.PictureType
public final @Nullable @MediaMetadata.PictureType Integer artworkDataType

Optional PictureType of the artwork data.

artworkUri

public final @Nullable Uri artworkUri

Optional artwork Uri.

compilation

public final @Nullable CharSequence compilation

Optional compilation.

composer

public final @Nullable CharSequence composer

Optional composer.

conductor

public final @Nullable CharSequence conductor

Optional conductor.

description

public final @Nullable CharSequence description

Optional description.

discNumber

public final @Nullable Integer discNumber

Optional disc number.

displayTitle

public final @Nullable CharSequence displayTitle

Optional display title.

durationMs

@UnstableApi
public final @Nullable Long durationMs

Optional duration, non-negative and in milliseconds.

This field is populated by the app when building the metadata object and is for informational purpose only. For retrieving the duration of the media item currently being played, use getDuration instead.

extras

public final @Nullable Bundle extras

Optional extras Bundle.

Given the complexities of checking the equality of two Bundle instances, the contents of these extras are not considered in the equals and hashCode implementation.

folderType

@MediaMetadata.FolderType
public final @Nullable @MediaMetadata.FolderType Integer folderType

Optional FolderType.

genre

public final @Nullable CharSequence genre

Optional genre.

isBrowsable

public final @Nullable Boolean isBrowsable

Optional boolean to indicate that the media is a browsable folder.

isPlayable

public final @Nullable Boolean isPlayable

Optional boolean to indicate that the media is playable.

overallRating

public final @Nullable Rating overallRating

Optional overall Rating.

recordingDay

public final @Nullable Integer recordingDay

Optional day of the recording date.

Note that there is no guarantee that the month and day are a valid combination.

recordingMonth

public final @Nullable Integer recordingMonth

Optional month of the recording date.

Note that there is no guarantee that the month and day are a valid combination.

recordingYear

public final @Nullable Integer recordingYear

Optional year of the recording date.

releaseDay

public final @Nullable Integer releaseDay

Optional day of the release date.

Note that there is no guarantee that the month and day are a valid combination.

releaseMonth

public final @Nullable Integer releaseMonth

Optional month of the release date.

Note that there is no guarantee that the month and day are a valid combination.

releaseYear

public final @Nullable Integer releaseYear

Optional year of the release date.

station

public final @Nullable CharSequence station

Optional name of the station streaming the media.

subtitle

public final @Nullable CharSequence subtitle

Optional subtitle.

This is the secondary title of the media, unrelated to closed captions.

title

public final @Nullable CharSequence title

Optional title.

totalDiscCount

public final @Nullable Integer totalDiscCount

Optional total number of discs.

totalTrackCount

public final @Nullable Integer totalTrackCount

Optional total number of tracks.

trackNumber

public final @Nullable Integer trackNumber

Optional track number.

userRating

public final @Nullable Rating userRating

Optional user Rating.

writer

public final @Nullable CharSequence writer

Optional writer.

year

@UnstableApi
public final @Nullable Integer year

Public methods

buildUpon

public MediaMetadata.Builder buildUpon()

Returns a new Builder instance with the current MediaMetadata fields.

equals

public boolean equals(@Nullable Object obj)

Note: Equality checking does not consider extras.

fromBundle

@UnstableApi
public static MediaMetadata fromBundle(Bundle bundle)

Restores a MediaMetadata from a Bundle.

hashCode

public int hashCode()

toBundle

@UnstableApi
public Bundle toBundle()