Stay organized with collections Save and categorize content based on your preferences.

MediaMetadata.Builder

class MediaMetadata.Builder


A builder for MediaMetadata instances.

Summary

Public constructors

Public functions

MediaMetadata!

Returns a new MediaMetadata instance with the current builder values.

MediaMetadata.Builder!
@CanIgnoreReturnValue
maybeSetArtworkData(
    artworkData: ByteArray!,
    @MediaMetadata.PictureType artworkDataType: Int
)

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, provided they are non-null.

MediaMetadata.Builder!

Sets all fields supported by the entries within the Metadata.

MediaMetadata.Builder!

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

MediaMetadata.Builder!

Sets the album artist.

MediaMetadata.Builder!

Sets the album title.

MediaMetadata.Builder!

Sets the artist.

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!

Sets the FolderType.

MediaMetadata.Builder!

Sets the genre.

MediaMetadata.Builder!

Sets whether the media is playable.

MediaMetadata.Builder!

Sets the overall Rating.

MediaMetadata.Builder!
@CanIgnoreReturnValue
setRecordingDay(recordingDay: @IntRange(from = 1, to = 31) Int?)

Sets the day of the recording date.

MediaMetadata.Builder!
@CanIgnoreReturnValue
setRecordingMonth(recordingMonth: @IntRange(from = 1, to = 12) Int?)

Sets the month of the recording date.

MediaMetadata.Builder!

Sets the year of the recording date.

MediaMetadata.Builder!
@CanIgnoreReturnValue
setReleaseDay(releaseDay: @IntRange(from = 1, to = 31) Int?)

Sets the day of the release date.

MediaMetadata.Builder!
@CanIgnoreReturnValue
setReleaseMonth(releaseMonth: @IntRange(from = 1, to = 12) Int?)

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 function is deprecated.

Use setRecordingYear instead.

Public constructors

Builder

Builder()

Public functions

build

fun build(): MediaMetadata!

Returns a new MediaMetadata instance with the current builder values.

maybeSetArtworkData

@CanIgnoreReturnValue
fun maybeSetArtworkData(
    artworkData: ByteArray!,
    @MediaMetadata.PictureType artworkDataType: Int
): MediaMetadata.Builder!

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
fun populate(mediaMetadata: MediaMetadata?): MediaMetadata.Builder!

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

populateFromMetadata

@CanIgnoreReturnValue
@UnstableApi
fun populateFromMetadata(metadata: Metadata!): MediaMetadata.Builder!

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.

populateFromMetadata

@CanIgnoreReturnValue
@UnstableApi
fun populateFromMetadata(metadataList: (Mutable)List<Metadata!>!): MediaMetadata.Builder!

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.

setAlbumArtist

@CanIgnoreReturnValue
fun setAlbumArtist(albumArtist: CharSequence?): MediaMetadata.Builder!

Sets the album artist.

setAlbumTitle

@CanIgnoreReturnValue
fun setAlbumTitle(albumTitle: CharSequence?): MediaMetadata.Builder!

Sets the album title.

setArtist

@CanIgnoreReturnValue
fun setArtist(artist: CharSequence?): MediaMetadata.Builder!

Sets the artist.

setArtworkUri

@CanIgnoreReturnValue
fun setArtworkUri(artworkUri: Uri?): MediaMetadata.Builder!

Sets the artwork Uri.

setCompilation

@CanIgnoreReturnValue
fun setCompilation(compilation: CharSequence?): MediaMetadata.Builder!

Sets the compilation.

setComposer

@CanIgnoreReturnValue
fun setComposer(composer: CharSequence?): MediaMetadata.Builder!

Sets the composer.

setConductor

@CanIgnoreReturnValue
fun setConductor(conductor: CharSequence?): MediaMetadata.Builder!

Sets the conductor.

setDescription

@CanIgnoreReturnValue
fun setDescription(description: CharSequence?): MediaMetadata.Builder!

Sets the description.

setDiscNumber

@CanIgnoreReturnValue
fun setDiscNumber(discNumber: Int?): MediaMetadata.Builder!

Sets the disc number.

setDisplayTitle

@CanIgnoreReturnValue
fun setDisplayTitle(displayTitle: CharSequence?): MediaMetadata.Builder!

Sets the display title.

setExtras

@CanIgnoreReturnValue
fun setExtras(extras: Bundle?): MediaMetadata.Builder!

Sets the extras Bundle.

setGenre

@CanIgnoreReturnValue
fun setGenre(genre: CharSequence?): MediaMetadata.Builder!

Sets the genre.

setIsPlayable

@CanIgnoreReturnValue
fun setIsPlayable(isPlayable: Boolean?): MediaMetadata.Builder!

Sets whether the media is playable.

setOverallRating

@CanIgnoreReturnValue
fun setOverallRating(overallRating: Rating?): MediaMetadata.Builder!

Sets the overall Rating.

setRecordingDay

@CanIgnoreReturnValue
fun setRecordingDay(recordingDay: @IntRange(from = 1, to = 31) Int?): MediaMetadata.Builder!

Sets the day of the recording date.

Value should be between 1 and 31.

setRecordingMonth

@CanIgnoreReturnValue
fun setRecordingMonth(recordingMonth: @IntRange(from = 1, to = 12) Int?): MediaMetadata.Builder!

Sets the month of the recording date.

Value should be between 1 and 12.

setRecordingYear

@CanIgnoreReturnValue
fun setRecordingYear(recordingYear: Int?): MediaMetadata.Builder!

Sets the year of the recording date.

setReleaseDay

@CanIgnoreReturnValue
fun setReleaseDay(releaseDay: @IntRange(from = 1, to = 31) Int?): MediaMetadata.Builder!

Sets the day of the release date.

Value should be between 1 and 31.

setReleaseMonth

@CanIgnoreReturnValue
fun setReleaseMonth(releaseMonth: @IntRange(from = 1, to = 12) Int?): MediaMetadata.Builder!

Sets the month of the release date.

Value should be between 1 and 12.

setReleaseYear

@CanIgnoreReturnValue
fun setReleaseYear(releaseYear: Int?): MediaMetadata.Builder!

Sets the year of the release date.

setStation

@CanIgnoreReturnValue
fun setStation(station: CharSequence?): MediaMetadata.Builder!

Sets the name of the station streaming the media.

setSubtitle

@CanIgnoreReturnValue
fun setSubtitle(subtitle: CharSequence?): MediaMetadata.Builder!

Sets the subtitle.

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

setTitle

@CanIgnoreReturnValue
fun setTitle(title: CharSequence?): MediaMetadata.Builder!

Sets the title.

setTotalDiscCount

@CanIgnoreReturnValue
fun setTotalDiscCount(totalDiscCount: Int?): MediaMetadata.Builder!

Sets the total number of discs.

setTotalTrackCount

@CanIgnoreReturnValue
fun setTotalTrackCount(totalTrackCount: Int?): MediaMetadata.Builder!

Sets the total number of tracks.

setTrackNumber

@CanIgnoreReturnValue
fun setTrackNumber(trackNumber: Int?): MediaMetadata.Builder!

Sets the track number.

setUserRating

@CanIgnoreReturnValue
fun setUserRating(userRating: Rating?): MediaMetadata.Builder!

Sets the user Rating.

setWriter

@CanIgnoreReturnValue
fun setWriter(writer: CharSequence?): MediaMetadata.Builder!

Sets the writer.

setYear

@CanIgnoreReturnValue
@UnstableApi
fun setYear(year: Int?): MediaMetadata.Builder!