# MediaMetadata.Builder

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/MediaMetadata.java+class:androidx.media3.common.MediaMetadata.Builder)

*** ** * ** ***


```
public final class MediaMetadata.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#Builder()()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` | `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#build()()` Returns a new `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` instance with the current builder values. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#maybeSetArtworkData(byte[],int)( byte[] artworkData, @https://developer.android.com/reference/androidx/media3/common/MediaMetadata.PictureType int artworkDataType )` Sets the artwork data as a compressed byte array in the event that the associated `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.PictureType` is `https://developer.android.com/reference/androidx/media3/common/MediaMetadata#PICTURE_TYPE_FRONT_COVER()`, the existing `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.PictureType` is not `https://developer.android.com/reference/androidx/media3/common/MediaMetadata#PICTURE_TYPE_FRONT_COVER()`, or the current artworkData is not set. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#populate(androidx.media3.common.MediaMetadata)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/MediaMetadata mediaMetadata)` Populates all the fields from `mediaMetadata`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#populateFromMetadata(java.util.List<androidx.media3.common.Metadata>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Metadata> metadataList)` Sets all fields supported by the `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` within the list of `https://developer.android.com/reference/androidx/media3/common/Metadata`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#populateFromMetadata(androidx.media3.common.Metadata)(https://developer.android.com/reference/androidx/media3/common/Metadata metadata)` Sets all fields supported by the `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` within the `https://developer.android.com/reference/androidx/media3/common/Metadata`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setAlbumArtist(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html albumArtist)` Sets the album artist. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setAlbumTitle(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html albumTitle)` Sets the album title. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setArtist(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html artist)` Sets the artist. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [setArtworkData](https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setArtworkData(byte[]))(@https://developer.android.com/reference/androidx/annotation/Nullable byte[] artworkData)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setArtworkData(byte[],java.lang.Integer)` or `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#maybeSetArtworkData(byte[],int)`, providing a `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.PictureType`. <br /> |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setArtworkData(byte[],java.lang.Integer)( @https://developer.android.com/reference/androidx/annotation/Nullable byte[] artworkData, @https://developer.android.com/reference/androidx/media3/common/MediaMetadata.PictureType @https://developer.android.com/reference/androidx/annotation/Nullable @https://developer.android.com/reference/androidx/media3/common/MediaMetadata.PictureType https://developer.android.com/reference/java/lang/Integer.html artworkDataType )` Sets the artwork data as a compressed byte array with an associated `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.PictureType`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setArtworkUri(android.net.Uri)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/net/Uri.html artworkUri)` Sets the artwork `https://developer.android.com/reference/android/net/Uri.html`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setAuthor(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html author)` Sets the author. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setCategories(java.util.List<java.lang.String>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> categories)` Sets the list of categories or category tokens of the media. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setCompilation(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html compilation)` Sets the compilation. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setComposer(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html composer)` Sets the composer. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setConductor(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html conductor)` Sets the conductor. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setDescription(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html description)` Sets the description. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setDiscNumber(java.lang.Integer)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Integer.html discNumber)` Sets the disc number. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setDiscSubtitle(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html discSubtitle)` Sets the disc subtitle. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setDisplayTitle(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html displayTitle)` Sets the display title. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setDurationMs(java.lang.Long)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Long.html durationMs)` Sets the optional duration, non-negative and in milliseconds. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setExtras(android.os.Bundle)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/os/Bundle.html extras)` Sets the extras `https://developer.android.com/reference/android/os/Bundle.html`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html [setFolderType](https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setFolderType(java.lang.Integer))( @https://developer.android.com/reference/androidx/media3/common/MediaMetadata.FolderType @https://developer.android.com/reference/androidx/annotation/Nullable @https://developer.android.com/reference/androidx/media3/common/MediaMetadata.FolderType https://developer.android.com/reference/java/lang/Integer.html folderType )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setIsBrowsable(java.lang.Boolean)` to indicate if an item is a browsable folder and use `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setMediaType(java.lang.Integer)` to indicate the type of the folder. <br /> |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setGenre(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html genre)` Sets the genre. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setIsBrowsable(java.lang.Boolean)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Boolean.html isBrowsable)` Sets whether the media is a browsable folder. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setIsPlayable(java.lang.Boolean)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Boolean.html isPlayable)` Sets whether the media is playable. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setMediaType(java.lang.Integer)( @https://developer.android.com/reference/androidx/media3/common/MediaMetadata.MediaType @https://developer.android.com/reference/androidx/annotation/Nullable @https://developer.android.com/reference/androidx/media3/common/MediaMetadata.MediaType https://developer.android.com/reference/java/lang/Integer.html mediaType )` Sets the `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.MediaType`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setOverallRating(androidx.media3.common.Rating)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/Rating overallRating)` Sets the overall `https://developer.android.com/reference/androidx/media3/common/Rating`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setPlaylistId(java.lang.String)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html playlistId)` Sets the playlist ID. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setRecordingDay(java.lang.Integer)(@https://developer.android.com/reference/androidx/annotation/Nullable @https://developer.android.com/reference/androidx/annotation/IntRange(from = 1, to = 31) https://developer.android.com/reference/java/lang/Integer.html recordingDay)` Sets the day of the recording date. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setRecordingMonth(java.lang.Integer)( @https://developer.android.com/reference/androidx/annotation/Nullable @https://developer.android.com/reference/androidx/annotation/IntRange(from = 1, to = 12) https://developer.android.com/reference/java/lang/Integer.html recordingMonth )` Sets the month of the recording date. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setRecordingYear(java.lang.Integer)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Integer.html recordingYear)` Sets the year of the recording date. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setReleaseDay(java.lang.Integer)(@https://developer.android.com/reference/androidx/annotation/Nullable @https://developer.android.com/reference/androidx/annotation/IntRange(from = 1, to = 31) https://developer.android.com/reference/java/lang/Integer.html releaseDay)` Sets the day of the release date. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setReleaseMonth(java.lang.Integer)(@https://developer.android.com/reference/androidx/annotation/Nullable @https://developer.android.com/reference/androidx/annotation/IntRange(from = 1, to = 12) https://developer.android.com/reference/java/lang/Integer.html releaseMonth)` Sets the month of the release date. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setReleaseYear(java.lang.Integer)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Integer.html releaseYear)` Sets the year of the release date. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setStation(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html station)` Sets the name of the station streaming the media. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setSubtitle(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html subtitle)` Sets the subtitle. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setSupportedCommands(java.util.List<java.lang.String>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> supportedCommands)` Sets the IDs of the supported commands (see for instance ` CommandButton.sessionCommand.customAction` of the Media3 session module). |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setTitle(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html title)` Sets the title. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setTotalDiscCount(java.lang.Integer)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Integer.html totalDiscCount)` Sets the total number of discs. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setTotalTrackCount(java.lang.Integer)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Integer.html totalTrackCount)` Sets the total number of tracks. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setTrackNumber(java.lang.Integer)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Integer.html trackNumber)` Sets the track number. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setUserRating(androidx.media3.common.Rating)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/Rating userRating)` Sets the user `https://developer.android.com/reference/androidx/media3/common/Rating`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setWriter(java.lang.CharSequence)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/CharSequence.html writer)` Sets the writer. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [setYear](https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setYear(java.lang.Integer))(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Integer.html year)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setRecordingYear(java.lang.Integer)` instead. <br /> |

## Public constructors

### Builder

```
public Builder()
```

## Public methods

### build

```
public MediaMetadata build()
```

Returns a new `https://developer.android.com/reference/androidx/media3/common/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 `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.PictureType` is `https://developer.android.com/reference/androidx/media3/common/MediaMetadata#PICTURE_TYPE_FRONT_COVER()`, the existing `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.PictureType` is not `https://developer.android.com/reference/androidx/media3/common/MediaMetadata#PICTURE_TYPE_FRONT_COVER()`, or the current artworkData is not set.

Use `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setArtworkData(byte[],java.lang.Integer)` to set the artwork data without checking the `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.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 `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` within the list of `https://developer.android.com/reference/androidx/media3/common/Metadata`.

Fields are only set if the `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` has an implementation for `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry#populateMediaMetadata(androidx.media3.common.MediaMetadata.Builder)`.

In the event that multiple `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` objects within any of the `https://developer.android.com/reference/androidx/media3/common/Metadata` relate to the same `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` field, then the last one will be used.

### populateFromMetadata

```
@CanIgnoreReturnValue
@UnstableApi
public MediaMetadata.Builder populateFromMetadata(Metadata metadata)
```

Sets all fields supported by the `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` within the `https://developer.android.com/reference/androidx/media3/common/Metadata`.

Fields are only set if the `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` has an implementation for `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry#populateMediaMetadata(androidx.media3.common.MediaMetadata.Builder)`.

In the event that multiple `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` objects within the `https://developer.android.com/reference/androidx/media3/common/Metadata` relate to the same `https://developer.android.com/reference/androidx/media3/common/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](https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setArtworkData(byte[]))(@Nullable byte[] artworkData)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setArtworkData(byte[],java.lang.Integer)` or `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#maybeSetArtworkData(byte[],int)`, providing a `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.PictureType`.

### 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 `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.PictureType`.

### setArtworkUri

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

Sets the artwork `https://developer.android.com/reference/android/net/Uri.html`.

### setAuthor

```
@CanIgnoreReturnValue
@UnstableApi
public MediaMetadata.Builder setAuthor(@Nullable CharSequence author)
```

Sets the author.

### setCategories

```
@CanIgnoreReturnValue
@UnstableApi
public MediaMetadata.Builder setCategories(List<String> categories)
```

Sets the list of categories or category tokens of the media.

### 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.

### setDiscSubtitle

```
@UnstableApi
@CanIgnoreReturnValue
public MediaMetadata.Builder setDiscSubtitle(@Nullable CharSequence discSubtitle)
```

Sets the disc subtitle.

### setDisplayTitle

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

Sets the display title.

### setDurationMs

```
@CanIgnoreReturnValue
public MediaMetadata.Builder setDurationMs(@Nullable Long durationMs)
```

Sets the optional duration, non-negative and in milliseconds.

The duration is populated by the app when building the metadata object and is for informational purpose only. For retrieving the duration of the media item currently being played, use `https://developer.android.com/reference/androidx/media3/common/Player#getDuration()` instead.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the duration is negative. |

### setExtras

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

Sets the extras `https://developer.android.com/reference/android/os/Bundle.html`.

### setFolderType

```
@CanIgnoreReturnValue
public MediaMetadata.Builder [setFolderType](https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setFolderType(java.lang.Integer))(
    @MediaMetadata.FolderType @Nullable @MediaMetadata.FolderType Integer folderType
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setIsBrowsable(java.lang.Boolean)` to indicate if an item is a browsable folder and use `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setMediaType(java.lang.Integer)` to indicate the type of the folder.

Sets the `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.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.

### setMediaType

```
@CanIgnoreReturnValue
public MediaMetadata.Builder setMediaType(
    @MediaMetadata.MediaType @Nullable @MediaMetadata.MediaType Integer mediaType
)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.MediaType`.

### setOverallRating

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

Sets the overall `https://developer.android.com/reference/androidx/media3/common/Rating`.

### setPlaylistId

```
@CanIgnoreReturnValue
@UnstableApi
public MediaMetadata.Builder setPlaylistId(@Nullable String playlistId)
```

Sets the playlist ID.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `playlistId` is empty. |

### 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.

### setSupportedCommands

```
@CanIgnoreReturnValue
@UnstableApi
public MediaMetadata.Builder setSupportedCommands(List<String> supportedCommands)
```

Sets the IDs of the supported commands (see for instance `
CommandButton.sessionCommand.customAction` of the Media3 session module).

### 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 `https://developer.android.com/reference/androidx/media3/common/Rating`.

### setWriter

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

Sets the writer.

### setYear

```
@CanIgnoreReturnValue
@UnstableApi
public MediaMetadata.Builder [setYear](https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setYear(java.lang.Integer))(@Nullable Integer year)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder#setRecordingYear(java.lang.Integer)` instead.