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 forMediaMetadatainstances.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MediaMetadatabuild()Returns a newMediaMetadatainstance with the current builder values.MediaMetadata.BuildermaybeSetArtworkData(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.PictureTypeisMediaMetadata.PICTURE_TYPE_FRONT_COVER, the existingMediaMetadata.PictureTypeis notMediaMetadata.PICTURE_TYPE_FRONT_COVER, or the current artworkData is not set.MediaMetadata.Builderpopulate(MediaMetadata mediaMetadata)Populates all the fields frommediaMetadata, provided they are non-null.MediaMetadata.BuilderpopulateFromMetadata(Metadata metadata)MediaMetadata.BuilderpopulateFromMetadata(List<Metadata> metadataList)MediaMetadata.BuildersetAlbumArtist(CharSequence albumArtist)Sets the album artist.MediaMetadata.BuildersetAlbumTitle(CharSequence albumTitle)Sets the album title.MediaMetadata.BuildersetArtist(CharSequence artist)Sets the artist.MediaMetadata.BuildersetArtworkData(byte[] artworkData)Deprecated.MediaMetadata.BuildersetArtworkData(byte[] artworkData, @PictureType Integer artworkDataType)Sets the artwork data as a compressed byte array with an associatedartworkDataType.MediaMetadata.BuildersetArtworkUri(Uri artworkUri)Sets the artworkUri.MediaMetadata.BuildersetCompilation(CharSequence compilation)Sets the compilation.MediaMetadata.BuildersetComposer(CharSequence composer)Sets the composer.MediaMetadata.BuildersetConductor(CharSequence conductor)Sets the conductor.MediaMetadata.BuildersetDescription(CharSequence description)Sets the description.MediaMetadata.BuildersetDiscNumber(Integer discNumber)Sets the disc number.MediaMetadata.BuildersetDisplayTitle(CharSequence displayTitle)Sets the display title.MediaMetadata.BuildersetExtras(Bundle extras)Sets the extrasBundle.MediaMetadata.BuildersetFolderType(@FolderType Integer folderType)Sets theMediaMetadata.FolderType.MediaMetadata.BuildersetGenre(CharSequence genre)Sets the genre.MediaMetadata.BuildersetIsPlayable(Boolean isPlayable)Sets whether the media is playable.MediaMetadata.BuildersetMediaUri(Uri mediaUri)Sets the mediaUri.MediaMetadata.BuildersetOverallRating(Rating overallRating)Sets the overallRating.MediaMetadata.BuildersetRecordingDay(Integer recordingDay)Sets the day of the recording date.MediaMetadata.BuildersetRecordingMonth(Integer recordingMonth)Sets the month of the recording date.MediaMetadata.BuildersetRecordingYear(Integer recordingYear)Sets the year of the recording date.MediaMetadata.BuildersetReleaseDay(Integer releaseDay)Sets the day of the release date.MediaMetadata.BuildersetReleaseMonth(Integer releaseMonth)Sets the month of the release date.MediaMetadata.BuildersetReleaseYear(Integer releaseYear)Sets the year of the release date.MediaMetadata.BuildersetStation(CharSequence station)Sets the name of the station streaming the media.MediaMetadata.BuildersetSubtitle(CharSequence subtitle)Sets the subtitle.MediaMetadata.BuildersetTitle(CharSequence title)Sets the title.MediaMetadata.BuildersetTotalDiscCount(Integer totalDiscCount)Sets the total number of discs.MediaMetadata.BuildersetTotalTrackCount(Integer totalTrackCount)Sets the total number of tracks.MediaMetadata.BuildersetTrackNumber(Integer trackNumber)Sets the track number.MediaMetadata.BuildersetUserRating(Rating userRating)Sets the userRating.MediaMetadata.BuildersetWriter(CharSequence writer)Sets the writer.MediaMetadata.BuildersetYear(Integer year)Deprecated.UsesetRecordingYear(Integer)instead.
-
-
-
Method Detail
-
setTitle
public MediaMetadata.Builder setTitle(@Nullable CharSequence title)
Sets the title.
-
setArtist
public MediaMetadata.Builder setArtist(@Nullable CharSequence artist)
Sets the artist.
-
setAlbumTitle
public MediaMetadata.Builder setAlbumTitle(@Nullable CharSequence albumTitle)
Sets the album title.
-
setAlbumArtist
public MediaMetadata.Builder setAlbumArtist(@Nullable CharSequence albumArtist)
Sets the album artist.
-
setDisplayTitle
public MediaMetadata.Builder setDisplayTitle(@Nullable CharSequence displayTitle)
Sets the display title.
-
setSubtitle
public MediaMetadata.Builder setSubtitle(@Nullable CharSequence subtitle)
Sets the subtitle.This is the secondary title of the media, unrelated to closed captions.
-
setDescription
public MediaMetadata.Builder setDescription(@Nullable CharSequence description)
Sets the description.
-
setMediaUri
public MediaMetadata.Builder setMediaUri(@Nullable Uri mediaUri)
Sets the mediaUri.
-
setUserRating
public MediaMetadata.Builder setUserRating(@Nullable Rating userRating)
Sets the userRating.
-
setOverallRating
public MediaMetadata.Builder setOverallRating(@Nullable Rating overallRating)
Sets the overallRating.
-
setArtworkData
@Deprecated public MediaMetadata.Builder setArtworkData(@Nullable byte[] artworkData)
Deprecated.
-
setArtworkData
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
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.PictureTypeisMediaMetadata.PICTURE_TYPE_FRONT_COVER, the existingMediaMetadata.PictureTypeis 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
public MediaMetadata.Builder setArtworkUri(@Nullable Uri artworkUri)
Sets the artworkUri.
-
setTrackNumber
public MediaMetadata.Builder setTrackNumber(@Nullable Integer trackNumber)
Sets the track number.
-
setTotalTrackCount
public MediaMetadata.Builder setTotalTrackCount(@Nullable Integer totalTrackCount)
Sets the total number of tracks.
-
setFolderType
public MediaMetadata.Builder setFolderType(@Nullable @FolderType @FolderType Integer folderType)
Sets theMediaMetadata.FolderType.
-
setIsPlayable
public MediaMetadata.Builder setIsPlayable(@Nullable Boolean isPlayable)
Sets whether the media is playable.
-
setYear
@Deprecated public MediaMetadata.Builder setYear(@Nullable Integer year)
Deprecated.UsesetRecordingYear(Integer)instead.
-
setRecordingYear
public MediaMetadata.Builder setRecordingYear(@Nullable Integer recordingYear)
Sets the year of the recording date.
-
setRecordingMonth
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
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
public MediaMetadata.Builder setReleaseYear(@Nullable Integer releaseYear)
Sets the year of the release date.
-
setReleaseMonth
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
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
public MediaMetadata.Builder setWriter(@Nullable CharSequence writer)
Sets the writer.
-
setComposer
public MediaMetadata.Builder setComposer(@Nullable CharSequence composer)
Sets the composer.
-
setConductor
public MediaMetadata.Builder setConductor(@Nullable CharSequence conductor)
Sets the conductor.
-
setDiscNumber
public MediaMetadata.Builder setDiscNumber(@Nullable Integer discNumber)
Sets the disc number.
-
setTotalDiscCount
public MediaMetadata.Builder setTotalDiscCount(@Nullable Integer totalDiscCount)
Sets the total number of discs.
-
setGenre
public MediaMetadata.Builder setGenre(@Nullable CharSequence genre)
Sets the genre.
-
setCompilation
public MediaMetadata.Builder setCompilation(@Nullable CharSequence compilation)
Sets the compilation.
-
setStation
public MediaMetadata.Builder setStation(@Nullable CharSequence station)
Sets the name of the station streaming the media.
-
setExtras
public MediaMetadata.Builder setExtras(@Nullable Bundle extras)
Sets the extrasBundle.
-
populateFromMetadata
public MediaMetadata.Builder populateFromMetadata(Metadata metadata)
Sets all fields supported by theentrieswithin theMetadata.Fields are only set if the
Metadata.Entryhas an implementation forMetadata.Entry.populateMediaMetadata(Builder).In the event that multiple
Metadata.Entryobjects within theMetadatarelate to the sameMediaMetadatafield, then the last one will be used.
-
populateFromMetadata
public MediaMetadata.Builder populateFromMetadata(List<Metadata> metadataList)
Sets all fields supported by theentrieswithin the list ofMetadata.Fields are only set if the
Metadata.Entryhas an implementation forMetadata.Entry.populateMediaMetadata(Builder).In the event that multiple
Metadata.Entryobjects within any of theMetadatarelate to the sameMediaMetadatafield, then the last one will be used.
-
populate
public MediaMetadata.Builder populate(@Nullable MediaMetadata mediaMetadata)
Populates all the fields frommediaMetadata, provided they are non-null.
-
build
public MediaMetadata build()
Returns a newMediaMetadatainstance with the current builder values.
-
-