public final class

MediaMetadata.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.common.MediaMetadata.Builder

Overview

A builder for MediaMetadata instances.

Summary

Constructors
publicBuilder()

Methods
public MediaMetadatabuild()

Returns a new MediaMetadata instance with the current builder values.

public MediaMetadata.BuildermaybeSetArtworkData(byte[] artworkData[], int artworkDataType)

Sets the artwork data as a compressed byte array in the event that the associated MediaMetadata.PictureType is MediaMetadata.PICTURE_TYPE_FRONT_COVER, the existing MediaMetadata.PictureType is not MediaMetadata.PICTURE_TYPE_FRONT_COVER, or the current artworkData is not set.

public MediaMetadata.Builderpopulate(MediaMetadata mediaMetadata)

Populates all the fields from mediaMetadata, provided they are non-null.

public MediaMetadata.BuilderpopulateFromMetadata(java.util.List<Metadata> metadataList)

Sets all fields supported by the entries within the list of Metadata.

public MediaMetadata.BuilderpopulateFromMetadata(Metadata metadata)

Sets all fields supported by the entries within the Metadata.

public MediaMetadata.BuildersetAlbumArtist(java.lang.CharSequence albumArtist)

Sets the album artist.

public MediaMetadata.BuildersetAlbumTitle(java.lang.CharSequence albumTitle)

Sets the album title.

public MediaMetadata.BuildersetArtist(java.lang.CharSequence artist)

Sets the artist.

public MediaMetadata.BuildersetArtworkData(byte[] artworkData[])

public MediaMetadata.BuildersetArtworkData(byte[] artworkData[], java.lang.Integer artworkDataType)

Sets the artwork data as a compressed byte array with an associated artworkDataType.

public MediaMetadata.BuildersetArtworkUri(Uri artworkUri)

Sets the artwork .

public MediaMetadata.BuildersetCompilation(java.lang.CharSequence compilation)

Sets the compilation.

public MediaMetadata.BuildersetComposer(java.lang.CharSequence composer)

Sets the composer.

public MediaMetadata.BuildersetConductor(java.lang.CharSequence conductor)

Sets the conductor.

public MediaMetadata.BuildersetDescription(java.lang.CharSequence description)

Sets the description.

public MediaMetadata.BuildersetDiscNumber(java.lang.Integer discNumber)

Sets the disc number.

public MediaMetadata.BuildersetDisplayTitle(java.lang.CharSequence displayTitle)

Sets the display title.

public MediaMetadata.BuildersetExtras(Bundle extras)

Sets the extras .

public MediaMetadata.BuildersetFolderType(java.lang.Integer folderType)

Sets the MediaMetadata.FolderType.

public MediaMetadata.BuildersetGenre(java.lang.CharSequence genre)

Sets the genre.

public MediaMetadata.BuildersetIsPlayable(java.lang.Boolean isPlayable)

Sets whether the media is playable.

public MediaMetadata.BuildersetMediaUri(Uri mediaUri)

Sets the media .

public MediaMetadata.BuildersetOverallRating(Rating overallRating)

Sets the overall Rating.

public MediaMetadata.BuildersetRecordingDay(java.lang.Integer recordingDay)

Sets the day of the recording date.

public MediaMetadata.BuildersetRecordingMonth(java.lang.Integer recordingMonth)

Sets the month of the recording date.

public MediaMetadata.BuildersetRecordingYear(java.lang.Integer recordingYear)

Sets the year of the recording date.

public MediaMetadata.BuildersetReleaseDay(java.lang.Integer releaseDay)

Sets the day of the release date.

public MediaMetadata.BuildersetReleaseMonth(java.lang.Integer releaseMonth)

Sets the month of the release date.

public MediaMetadata.BuildersetReleaseYear(java.lang.Integer releaseYear)

Sets the year of the release date.

public MediaMetadata.BuildersetStation(java.lang.CharSequence station)

Sets the name of the station streaming the media.

public MediaMetadata.BuildersetSubtitle(java.lang.CharSequence subtitle)

Sets the subtitle.

public MediaMetadata.BuildersetTitle(java.lang.CharSequence title)

Sets the title.

public MediaMetadata.BuildersetTotalDiscCount(java.lang.Integer totalDiscCount)

Sets the total number of discs.

public MediaMetadata.BuildersetTotalTrackCount(java.lang.Integer totalTrackCount)

Sets the total number of tracks.

public MediaMetadata.BuildersetTrackNumber(java.lang.Integer trackNumber)

Sets the track number.

public MediaMetadata.BuildersetUserRating(Rating userRating)

Sets the user Rating.

public MediaMetadata.BuildersetWriter(java.lang.CharSequence writer)

Sets the writer.

public MediaMetadata.BuildersetYear(java.lang.Integer year)

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Methods

public MediaMetadata.Builder setTitle(java.lang.CharSequence title)

Sets the title.

public MediaMetadata.Builder setArtist(java.lang.CharSequence artist)

Sets the artist.

public MediaMetadata.Builder setAlbumTitle(java.lang.CharSequence albumTitle)

Sets the album title.

public MediaMetadata.Builder setAlbumArtist(java.lang.CharSequence albumArtist)

Sets the album artist.

public MediaMetadata.Builder setDisplayTitle(java.lang.CharSequence displayTitle)

Sets the display title.

public MediaMetadata.Builder setSubtitle(java.lang.CharSequence subtitle)

Sets the subtitle.

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

public MediaMetadata.Builder setDescription(java.lang.CharSequence description)

Sets the description.

public MediaMetadata.Builder setMediaUri(Uri mediaUri)

Sets the media .

public MediaMetadata.Builder setUserRating(Rating userRating)

Sets the user Rating.

public MediaMetadata.Builder setOverallRating(Rating overallRating)

Sets the overall Rating.

public MediaMetadata.Builder setArtworkData(byte[] artworkData[])

Deprecated: Use MediaMetadata.Builder.setArtworkData(byte[], Integer) or MediaMetadata.Builder.maybeSetArtworkData(byte[], int), providing a MediaMetadata.PictureType.

public MediaMetadata.Builder setArtworkData(byte[] artworkData[], java.lang.Integer artworkDataType)

Sets the artwork data as a compressed byte array with an associated artworkDataType.

public MediaMetadata.Builder maybeSetArtworkData(byte[] artworkData[], int artworkDataType)

Sets the artwork data as a compressed byte array in the event that the associated MediaMetadata.PictureType is MediaMetadata.PICTURE_TYPE_FRONT_COVER, the existing MediaMetadata.PictureType is not MediaMetadata.PICTURE_TYPE_FRONT_COVER, or the current artworkData is not set.

Use MediaMetadata.Builder.setArtworkData(byte[], Integer) to set the artwork data without checking the MediaMetadata.PictureType.

public MediaMetadata.Builder setArtworkUri(Uri artworkUri)

Sets the artwork .

public MediaMetadata.Builder setTrackNumber(java.lang.Integer trackNumber)

Sets the track number.

public MediaMetadata.Builder setTotalTrackCount(java.lang.Integer totalTrackCount)

Sets the total number of tracks.

public MediaMetadata.Builder setFolderType(java.lang.Integer folderType)

Sets the MediaMetadata.FolderType.

public MediaMetadata.Builder setIsPlayable(java.lang.Boolean isPlayable)

Sets whether the media is playable.

public MediaMetadata.Builder setYear(java.lang.Integer year)

Deprecated: Use MediaMetadata.Builder.setRecordingYear(Integer) instead.

public MediaMetadata.Builder setRecordingYear(java.lang.Integer recordingYear)

Sets the year of the recording date.

public MediaMetadata.Builder setRecordingMonth(java.lang.Integer recordingMonth)

Sets the month of the recording date.

Value should be between 1 and 12.

public MediaMetadata.Builder setRecordingDay(java.lang.Integer recordingDay)

Sets the day of the recording date.

Value should be between 1 and 31.

public MediaMetadata.Builder setReleaseYear(java.lang.Integer releaseYear)

Sets the year of the release date.

public MediaMetadata.Builder setReleaseMonth(java.lang.Integer releaseMonth)

Sets the month of the release date.

Value should be between 1 and 12.

public MediaMetadata.Builder setReleaseDay(java.lang.Integer releaseDay)

Sets the day of the release date.

Value should be between 1 and 31.

public MediaMetadata.Builder setWriter(java.lang.CharSequence writer)

Sets the writer.

public MediaMetadata.Builder setComposer(java.lang.CharSequence composer)

Sets the composer.

public MediaMetadata.Builder setConductor(java.lang.CharSequence conductor)

Sets the conductor.

public MediaMetadata.Builder setDiscNumber(java.lang.Integer discNumber)

Sets the disc number.

public MediaMetadata.Builder setTotalDiscCount(java.lang.Integer totalDiscCount)

Sets the total number of discs.

public MediaMetadata.Builder setGenre(java.lang.CharSequence genre)

Sets the genre.

public MediaMetadata.Builder setCompilation(java.lang.CharSequence compilation)

Sets the compilation.

public MediaMetadata.Builder setStation(java.lang.CharSequence station)

Sets the name of the station streaming the media.

public MediaMetadata.Builder setExtras(Bundle extras)

Sets the extras .

public MediaMetadata.Builder populateFromMetadata(Metadata metadata)

Sets all fields supported by the entries within the Metadata.

Fields are only set if the Metadata.Entry has an implementation for Metadata.Entry.

In the event that multiple Metadata.Entry objects within the Metadata relate to the same MediaMetadata field, then the last one will be used.

public MediaMetadata.Builder populateFromMetadata(java.util.List<Metadata> metadataList)

Sets all fields supported by the entries within the list of Metadata.

Fields are only set if the Metadata.Entry has an implementation for Metadata.Entry.

In the event that multiple Metadata.Entry objects within any of the Metadata relate to the same MediaMetadata field, then the last one will be used.

public MediaMetadata.Builder populate(MediaMetadata mediaMetadata)

Populates all the fields from mediaMetadata, provided they are non-null.

public MediaMetadata build()

Returns a new MediaMetadata instance with the current builder values.