MediaMetadata.Builder


public final class MediaMetadata.Builder


A builder for MediaMetadata instances.

Summary

Public constructors

Public methods

MediaMetadata

Returns a new MediaMetadata instance with the current builder values.

MediaMetadata.Builder
@CanIgnoreReturnValue
maybeSetArtworkData(
    byte[] artworkData,
    @MediaMetadata.PictureType int artworkDataType
)

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

MediaMetadata.Builder

Populates all the fields from mediaMetadata.

MediaMetadata.Builder

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

MediaMetadata.Builder

Sets all fields supported by the entries within the Metadata.

MediaMetadata.Builder

Sets the album artist.

MediaMetadata.Builder

Sets the album title.

MediaMetadata.Builder

Sets the artist.

MediaMetadata.Builder

This method is deprecated.

Use setArtworkData or maybeSetArtworkData, providing a PictureType.

MediaMetadata.Builder

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

MediaMetadata.Builder

Sets the artwork Uri.

MediaMetadata.Builder

Sets the compilation.

MediaMetadata.Builder

Sets the composer.

MediaMetadata.Builder

Sets the conductor.

MediaMetadata.Builder

Sets the description.

MediaMetadata.Builder

Sets the disc number.

MediaMetadata.Builder

Sets the display title.

MediaMetadata.Builder

Sets the extras Bundle.

MediaMetadata.Builder

This method is deprecated.

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

MediaMetadata.Builder

Sets the genre.

MediaMetadata.Builder

Sets whether the media is a browsable folder.

MediaMetadata.Builder

Sets whether the media is playable.

MediaMetadata.Builder

Sets the MediaType.

MediaMetadata.Builder

Sets the overall Rating.

MediaMetadata.Builder
@CanIgnoreReturnValue
setRecordingDay(@Nullable @IntRange(from = 1, to = 31) Integer recordingDay)

Sets the day of the recording date.

MediaMetadata.Builder
@CanIgnoreReturnValue
setRecordingMonth(
    @Nullable @IntRange(from = 1, to = 12) Integer recordingMonth
)

Sets the month of the recording date.

MediaMetadata.Builder

Sets the year of the recording date.

MediaMetadata.Builder
@CanIgnoreReturnValue
setReleaseDay(@Nullable @IntRange(from = 1, to = 31) Integer releaseDay)

Sets the day of the release date.

MediaMetadata.Builder
@CanIgnoreReturnValue
setReleaseMonth(@Nullable @IntRange(from = 1, to = 12) Integer releaseMonth)

Sets the month of the release date.

MediaMetadata.Builder

Sets the year of the release date.

MediaMetadata.Builder

Sets the name of the station streaming the media.

MediaMetadata.Builder

Sets the subtitle.

MediaMetadata.Builder

Sets the title.

MediaMetadata.Builder

Sets the total number of discs.

MediaMetadata.Builder

Sets the total number of tracks.

MediaMetadata.Builder

Sets the track number.

MediaMetadata.Builder

Sets the user Rating.

MediaMetadata.Builder

Sets the writer.

MediaMetadata.Builder

This method is deprecated.

Use setRecordingYear instead.

Public constructors

Builder

public Builder()

Public methods

build

public MediaMetadata build()

Returns a new MediaMetadata instance with the current builder values.

maybeSetArtworkData

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

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

Use setArtworkData to set the artwork data without checking the PictureType.

populate

@CanIgnoreReturnValue
@UnstableApi
public MediaMetadata.Builder populate(@Nullable MediaMetadata mediaMetadata)

Populates all the fields from mediaMetadata.

Fields are populated when they are non-null with an exception that both artworkUri and artworkData are populated, when at least one of them is non-null.

populateFromMetadata

@CanIgnoreReturnValue
@UnstableApi
public MediaMetadata.Builder populateFromMetadata(List<Metadata> metadataList)

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

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

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

populateFromMetadata

@CanIgnoreReturnValue
@UnstableApi
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 populateMediaMetadata.

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

setAlbumArtist

@CanIgnoreReturnValue
public MediaMetadata.Builder setAlbumArtist(@Nullable CharSequence albumArtist)

Sets the album artist.

setAlbumTitle

@CanIgnoreReturnValue
public MediaMetadata.Builder setAlbumTitle(@Nullable CharSequence albumTitle)

Sets the album title.

setArtist

@CanIgnoreReturnValue
public MediaMetadata.Builder setArtist(@Nullable CharSequence artist)

Sets the artist.

setArtworkData

@CanIgnoreReturnValue
@UnstableApi
public MediaMetadata.Builder setArtworkData(@Nullable byte[] artworkData)

setArtworkData

@CanIgnoreReturnValue
public MediaMetadata.Builder setArtworkData(
    @Nullable byte[] artworkData,
    @MediaMetadata.PictureType @Nullable @MediaMetadata.PictureType Integer artworkDataType
)

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

setArtworkUri

@CanIgnoreReturnValue
public MediaMetadata.Builder setArtworkUri(@Nullable Uri artworkUri)

Sets the artwork Uri.

setCompilation

@CanIgnoreReturnValue
public MediaMetadata.Builder setCompilation(@Nullable CharSequence compilation)

Sets the compilation.

setComposer

@CanIgnoreReturnValue
public MediaMetadata.Builder setComposer(@Nullable CharSequence composer)

Sets the composer.

setConductor

@CanIgnoreReturnValue
public MediaMetadata.Builder setConductor(@Nullable CharSequence conductor)

Sets the conductor.

setDescription

@CanIgnoreReturnValue
public MediaMetadata.Builder setDescription(@Nullable CharSequence description)

Sets the description.

setDiscNumber

@CanIgnoreReturnValue
public MediaMetadata.Builder setDiscNumber(@Nullable Integer discNumber)

Sets the disc number.

setDisplayTitle

@CanIgnoreReturnValue
public MediaMetadata.Builder setDisplayTitle(@Nullable CharSequence displayTitle)

Sets the display title.

setExtras

@CanIgnoreReturnValue
public MediaMetadata.Builder setExtras(@Nullable Bundle extras)

Sets the extras Bundle.

setFolderType

@CanIgnoreReturnValue
public MediaMetadata.Builder setFolderType(
    @MediaMetadata.FolderType @Nullable @MediaMetadata.FolderType Integer folderType
)

Sets the FolderType.

setGenre

@CanIgnoreReturnValue
public MediaMetadata.Builder setGenre(@Nullable CharSequence genre)

Sets the genre.

setIsBrowsable

@CanIgnoreReturnValue
public MediaMetadata.Builder setIsBrowsable(@Nullable Boolean isBrowsable)

Sets whether the media is a browsable folder.

setIsPlayable

@CanIgnoreReturnValue
public MediaMetadata.Builder setIsPlayable(@Nullable Boolean isPlayable)

Sets whether the media is playable.

setOverallRating

@CanIgnoreReturnValue
public MediaMetadata.Builder setOverallRating(@Nullable Rating overallRating)

Sets the overall Rating.

setRecordingDay

@CanIgnoreReturnValue
public MediaMetadata.Builder setRecordingDay(@Nullable @IntRange(from = 1, to = 31) Integer recordingDay)

Sets the day of the recording date.

Value should be between 1 and 31.

setRecordingMonth

@CanIgnoreReturnValue
public MediaMetadata.Builder setRecordingMonth(
    @Nullable @IntRange(from = 1, to = 12) Integer recordingMonth
)

Sets the month of the recording date.

Value should be between 1 and 12.

setRecordingYear

@CanIgnoreReturnValue
public MediaMetadata.Builder setRecordingYear(@Nullable Integer recordingYear)

Sets the year of the recording date.

setReleaseDay

@CanIgnoreReturnValue
public MediaMetadata.Builder setReleaseDay(@Nullable @IntRange(from = 1, to = 31) Integer releaseDay)

Sets the day of the release date.

Value should be between 1 and 31.

setReleaseMonth

@CanIgnoreReturnValue
public MediaMetadata.Builder setReleaseMonth(@Nullable @IntRange(from = 1, to = 12) Integer releaseMonth)

Sets the month of the release date.

Value should be between 1 and 12.

setReleaseYear

@CanIgnoreReturnValue
public MediaMetadata.Builder setReleaseYear(@Nullable Integer releaseYear)

Sets the year of the release date.

setStation

@CanIgnoreReturnValue
public MediaMetadata.Builder setStation(@Nullable CharSequence station)

Sets the name of the station streaming the media.

setSubtitle

@CanIgnoreReturnValue
public MediaMetadata.Builder setSubtitle(@Nullable CharSequence subtitle)

Sets the subtitle.

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

setTitle

@CanIgnoreReturnValue
public MediaMetadata.Builder setTitle(@Nullable CharSequence title)

Sets the title.

setTotalDiscCount

@CanIgnoreReturnValue
public MediaMetadata.Builder setTotalDiscCount(@Nullable Integer totalDiscCount)

Sets the total number of discs.

setTotalTrackCount

@CanIgnoreReturnValue
public MediaMetadata.Builder setTotalTrackCount(@Nullable Integer totalTrackCount)

Sets the total number of tracks.

setTrackNumber

@CanIgnoreReturnValue
public MediaMetadata.Builder setTrackNumber(@Nullable Integer trackNumber)

Sets the track number.

setUserRating

@CanIgnoreReturnValue
public MediaMetadata.Builder setUserRating(@Nullable Rating userRating)

Sets the user Rating.

setWriter

@CanIgnoreReturnValue
public MediaMetadata.Builder setWriter(@Nullable CharSequence writer)

Sets the writer.

setYear

@CanIgnoreReturnValue
@UnstableApi
public MediaMetadata.Builder setYear(@Nullable Integer year)