Class MediaMetadata.Builder
- java.lang.Object
-
- com.google.android.exoplayer2.MediaMetadata.Builder
-
- Enclosing class:
- MediaMetadata
public static final class MediaMetadata.Builder extends Object
A builder forMediaMetadata
instances.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MediaMetadata
build()
Returns a newMediaMetadata
instance with the current builder values.MediaMetadata.Builder
maybeSetArtworkData(byte[] artworkData, @com.google.android.exoplayer2.MediaMetadata.PictureType int artworkDataType)
Sets the artwork data as a compressed byte array in the event that the associatedMediaMetadata.PictureType
isMediaMetadata.PICTURE_TYPE_FRONT_COVER
, the existingMediaMetadata.PictureType
is notMediaMetadata.PICTURE_TYPE_FRONT_COVER
, or the current artworkData is not set.MediaMetadata.Builder
populate(MediaMetadata mediaMetadata)
Populates all the fields frommediaMetadata
, provided they are non-null.MediaMetadata.Builder
populateFromMetadata(Metadata metadata)
MediaMetadata.Builder
populateFromMetadata(List<Metadata> metadataList)
MediaMetadata.Builder
setAlbumArtist(CharSequence albumArtist)
Sets the album artist.MediaMetadata.Builder
setAlbumTitle(CharSequence albumTitle)
Sets the album title.MediaMetadata.Builder
setArtist(CharSequence artist)
Sets the artist.MediaMetadata.Builder
setArtworkData(byte[] artworkData)
Deprecated.MediaMetadata.Builder
setArtworkData(byte[] artworkData, @PictureType Integer artworkDataType)
Sets the artwork data as a compressed byte array with an associatedartworkDataType
.MediaMetadata.Builder
setArtworkUri(Uri artworkUri)
Sets the artworkUri
.MediaMetadata.Builder
setCompilation(CharSequence compilation)
Sets the compilation.MediaMetadata.Builder
setComposer(CharSequence composer)
Sets the composer.MediaMetadata.Builder
setConductor(CharSequence conductor)
Sets the conductor.MediaMetadata.Builder
setDescription(CharSequence description)
Sets the description.MediaMetadata.Builder
setDiscNumber(Integer discNumber)
Sets the disc number.MediaMetadata.Builder
setDisplayTitle(CharSequence displayTitle)
Sets the display title.MediaMetadata.Builder
setExtras(Bundle extras)
Sets the extrasBundle
.MediaMetadata.Builder
setFolderType(@FolderType Integer folderType)
Deprecated.UsesetIsBrowsable(java.lang.Boolean)
to indicate if an item is a browsable folder and usesetMediaType(java.lang.Integer)
to indicate the type of the folder.MediaMetadata.Builder
setGenre(CharSequence genre)
Sets the genre.MediaMetadata.Builder
setIsBrowsable(Boolean isBrowsable)
Sets whether the media is a browsable folder.MediaMetadata.Builder
setIsPlayable(Boolean isPlayable)
Sets whether the media is playable.MediaMetadata.Builder
setMediaType(@MediaType Integer mediaType)
Sets theMediaMetadata.MediaType
.MediaMetadata.Builder
setOverallRating(Rating overallRating)
Sets the overallRating
.MediaMetadata.Builder
setRecordingDay(Integer recordingDay)
Sets the day of the recording date.MediaMetadata.Builder
setRecordingMonth(Integer recordingMonth)
Sets the month of the recording date.MediaMetadata.Builder
setRecordingYear(Integer recordingYear)
Sets the year of the recording date.MediaMetadata.Builder
setReleaseDay(Integer releaseDay)
Sets the day of the release date.MediaMetadata.Builder
setReleaseMonth(Integer releaseMonth)
Sets the month of the release date.MediaMetadata.Builder
setReleaseYear(Integer releaseYear)
Sets the year of the release date.MediaMetadata.Builder
setStation(CharSequence station)
Sets the name of the station streaming the media.MediaMetadata.Builder
setSubtitle(CharSequence subtitle)
Sets the subtitle.MediaMetadata.Builder
setTitle(CharSequence title)
Sets the title.MediaMetadata.Builder
setTotalDiscCount(Integer totalDiscCount)
Sets the total number of discs.MediaMetadata.Builder
setTotalTrackCount(Integer totalTrackCount)
Sets the total number of tracks.MediaMetadata.Builder
setTrackNumber(Integer trackNumber)
Sets the track number.MediaMetadata.Builder
setUserRating(Rating userRating)
Sets the userRating
.MediaMetadata.Builder
setWriter(CharSequence writer)
Sets the writer.MediaMetadata.Builder
setYear(Integer year)
Deprecated.UsesetRecordingYear(Integer)
instead.
-
-
-
Method Detail
-
setTitle
@CanIgnoreReturnValue public MediaMetadata.Builder setTitle(@Nullable CharSequence title)
Sets the title.
-
setArtist
@CanIgnoreReturnValue public MediaMetadata.Builder setArtist(@Nullable CharSequence artist)
Sets the artist.
-
setAlbumTitle
@CanIgnoreReturnValue public MediaMetadata.Builder setAlbumTitle(@Nullable CharSequence albumTitle)
Sets the album title.
-
setAlbumArtist
@CanIgnoreReturnValue public MediaMetadata.Builder setAlbumArtist(@Nullable CharSequence albumArtist)
Sets the album artist.
-
setDisplayTitle
@CanIgnoreReturnValue public MediaMetadata.Builder setDisplayTitle(@Nullable CharSequence displayTitle)
Sets the display title.
-
setSubtitle
@CanIgnoreReturnValue public MediaMetadata.Builder setSubtitle(@Nullable CharSequence subtitle)
Sets the subtitle.This is the secondary title of the media, unrelated to closed captions.
-
setDescription
@CanIgnoreReturnValue public MediaMetadata.Builder setDescription(@Nullable CharSequence description)
Sets the description.
-
setUserRating
@CanIgnoreReturnValue public MediaMetadata.Builder setUserRating(@Nullable Rating userRating)
Sets the userRating
.
-
setOverallRating
@CanIgnoreReturnValue public MediaMetadata.Builder setOverallRating(@Nullable Rating overallRating)
Sets the overallRating
.
-
setArtworkData
@CanIgnoreReturnValue @Deprecated public MediaMetadata.Builder setArtworkData(@Nullable byte[] artworkData)
Deprecated.
-
setArtworkData
@CanIgnoreReturnValue public MediaMetadata.Builder setArtworkData(@Nullable byte[] artworkData, @Nullable @PictureType @PictureType Integer artworkDataType)
Sets the artwork data as a compressed byte array with an associatedartworkDataType
.
-
maybeSetArtworkData
@CanIgnoreReturnValue public MediaMetadata.Builder maybeSetArtworkData(byte[] artworkData, @PictureType @com.google.android.exoplayer2.MediaMetadata.PictureType int artworkDataType)
Sets the artwork data as a compressed byte array in the event that the associatedMediaMetadata.PictureType
isMediaMetadata.PICTURE_TYPE_FRONT_COVER
, the existingMediaMetadata.PictureType
is notMediaMetadata.PICTURE_TYPE_FRONT_COVER
, or the current artworkData is not set.Use
setArtworkData(byte[], Integer)
to set the artwork data without checking theMediaMetadata.PictureType
.
-
setArtworkUri
@CanIgnoreReturnValue public MediaMetadata.Builder setArtworkUri(@Nullable Uri artworkUri)
Sets the artworkUri
.
-
setTrackNumber
@CanIgnoreReturnValue public MediaMetadata.Builder setTrackNumber(@Nullable Integer trackNumber)
Sets the track number.
-
setTotalTrackCount
@CanIgnoreReturnValue public MediaMetadata.Builder setTotalTrackCount(@Nullable Integer totalTrackCount)
Sets the total number of tracks.
-
setFolderType
@Deprecated @CanIgnoreReturnValue public MediaMetadata.Builder setFolderType(@Nullable @FolderType @FolderType Integer folderType)
Deprecated.UsesetIsBrowsable(java.lang.Boolean)
to indicate if an item is a browsable folder and usesetMediaType(java.lang.Integer)
to indicate the type of the folder.Sets theMediaMetadata.FolderType
.
-
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.
-
setYear
@CanIgnoreReturnValue @Deprecated public MediaMetadata.Builder setYear(@Nullable Integer year)
Deprecated.UsesetRecordingYear(Integer)
instead.
-
setRecordingYear
@CanIgnoreReturnValue public MediaMetadata.Builder setRecordingYear(@Nullable Integer recordingYear)
Sets the year of the recording date.
-
setRecordingMonth
@CanIgnoreReturnValue public MediaMetadata.Builder setRecordingMonth(@Nullable @IntRange(from=1L,to=12L) Integer recordingMonth)
Sets the month of the recording date.Value should be between 1 and 12.
-
setRecordingDay
@CanIgnoreReturnValue public MediaMetadata.Builder setRecordingDay(@Nullable @IntRange(from=1L,to=31L) Integer recordingDay)
Sets the day of the recording date.Value should be between 1 and 31.
-
setReleaseYear
@CanIgnoreReturnValue public MediaMetadata.Builder setReleaseYear(@Nullable Integer releaseYear)
Sets the year of the release date.
-
setReleaseMonth
@CanIgnoreReturnValue public MediaMetadata.Builder setReleaseMonth(@Nullable @IntRange(from=1L,to=12L) Integer releaseMonth)
Sets the month of the release date.Value should be between 1 and 12.
-
setReleaseDay
@CanIgnoreReturnValue public MediaMetadata.Builder setReleaseDay(@Nullable @IntRange(from=1L,to=31L) Integer releaseDay)
Sets the day of the release date.Value should be between 1 and 31.
-
setWriter
@CanIgnoreReturnValue public MediaMetadata.Builder setWriter(@Nullable CharSequence writer)
Sets the writer.
-
setComposer
@CanIgnoreReturnValue public MediaMetadata.Builder setComposer(@Nullable CharSequence composer)
Sets the composer.
-
setConductor
@CanIgnoreReturnValue public MediaMetadata.Builder setConductor(@Nullable CharSequence conductor)
Sets the conductor.
-
setDiscNumber
@CanIgnoreReturnValue public MediaMetadata.Builder setDiscNumber(@Nullable Integer discNumber)
Sets the disc number.
-
setTotalDiscCount
@CanIgnoreReturnValue public MediaMetadata.Builder setTotalDiscCount(@Nullable Integer totalDiscCount)
Sets the total number of discs.
-
setGenre
@CanIgnoreReturnValue public MediaMetadata.Builder setGenre(@Nullable CharSequence genre)
Sets the genre.
-
setCompilation
@CanIgnoreReturnValue public MediaMetadata.Builder setCompilation(@Nullable CharSequence compilation)
Sets the compilation.
-
setStation
@CanIgnoreReturnValue public MediaMetadata.Builder setStation(@Nullable CharSequence station)
Sets the name of the station streaming the media.
-
setMediaType
@CanIgnoreReturnValue public MediaMetadata.Builder setMediaType(@Nullable @MediaType Integer mediaType)
Sets theMediaMetadata.MediaType
.
-
setExtras
@CanIgnoreReturnValue public MediaMetadata.Builder setExtras(@Nullable Bundle extras)
Sets the extrasBundle
.
-
populateFromMetadata
@CanIgnoreReturnValue public MediaMetadata.Builder populateFromMetadata(Metadata metadata)
Sets all fields supported by theentries
within theMetadata
.Fields are only set if the
Metadata.Entry
has an implementation forMetadata.Entry.populateMediaMetadata(Builder)
.In the event that multiple
Metadata.Entry
objects within theMetadata
relate to the sameMediaMetadata
field, then the last one will be used.
-
populateFromMetadata
@CanIgnoreReturnValue public MediaMetadata.Builder populateFromMetadata(List<Metadata> metadataList)
Sets all fields supported by theentries
within the list ofMetadata
.Fields are only set if the
Metadata.Entry
has an implementation forMetadata.Entry.populateMediaMetadata(Builder)
.In the event that multiple
Metadata.Entry
objects within any of theMetadata
relate to the sameMediaMetadata
field, then the last one will be used.
-
populate
@CanIgnoreReturnValue public MediaMetadata.Builder populate(@Nullable MediaMetadata mediaMetadata)
Populates all the fields frommediaMetadata
, provided they are non-null.
-
build
public MediaMetadata build()
Returns a newMediaMetadata
instance with the current builder values.
-
-