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

*** ** * ** ***


```
class MediaMetadata.Builder
```

<br />

*** ** * ** ***

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

## Summary

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

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

## Public constructors

### Builder

```
Builder()
```

## Public functions

### build

```
fun build(): MediaMetadata!
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata` instance with the current builder values.

### maybeSetArtworkData

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

Sets the artwork data as a compressed byte array in the event that the associated `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata.PictureType` is `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata#PICTURE_TYPE_FRONT_COVER()`, the existing `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata.PictureType` is not `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata#PICTURE_TYPE_FRONT_COVER()`, or the current artworkData is not set.

Use `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata.Builder#setArtworkData(byte[],java.lang.Integer)` to set the artwork data without checking the `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata.PictureType`.

### populate

```
@CanIgnoreReturnValue
@UnstableApi
fun populate(mediaMetadata: MediaMetadata?): MediaMetadata.Builder!
```

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
fun populateFromMetadata(metadataList: (Mutable)List<Metadata!>!): MediaMetadata.Builder!
```

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

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

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

### populateFromMetadata

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

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

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

In the event that multiple `https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata.Entry` objects within the `https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata` relate to the same `https://developer.android.com/reference/kotlin/androidx/media3/common/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.

### setArtworkData

```
@CanIgnoreReturnValue
@UnstableApi
fun [setArtworkData](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata.Builder#setArtworkData(byte[]))(artworkData: ByteArray<Byte>?): MediaMetadata.Builder!
```

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

### setArtworkData

```
@CanIgnoreReturnValue
fun setArtworkData(
    artworkData: ByteArray<Byte>?,
    @MediaMetadata.PictureType artworkDataType: @MediaMetadata.PictureType Int?
): MediaMetadata.Builder!
```

Sets the artwork data as a compressed byte array with an associated `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata.PictureType`.

### setArtworkUri

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

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

### setAuthor

```
@CanIgnoreReturnValue
@UnstableApi
fun setAuthor(author: CharSequence?): MediaMetadata.Builder!
```

Sets the author.

### setCategories

```
@CanIgnoreReturnValue
@UnstableApi
fun setCategories(categories: (Mutable)List<String!>!): MediaMetadata.Builder!
```

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

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

### setDiscSubtitle

```
@UnstableApi
@CanIgnoreReturnValue
fun setDiscSubtitle(discSubtitle: CharSequence?): MediaMetadata.Builder!
```

Sets the disc subtitle.

### setDisplayTitle

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

Sets the display title.

### setDurationMs

```
@CanIgnoreReturnValue
fun setDurationMs(durationMs: Long?): MediaMetadata.Builder!
```

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/kotlin/androidx/media3/common/Player#getDuration()` instead.

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

### setExtras

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

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

### setFolderType

```
@CanIgnoreReturnValue
fun [setFolderType](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata.Builder#setFolderType(java.lang.Integer))(
    @MediaMetadata.FolderType folderType: @MediaMetadata.FolderType Int?
): MediaMetadata.Builder!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/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/kotlin/androidx/media3/common/MediaMetadata.Builder#setMediaType(java.lang.Integer)` to indicate the type of the folder.

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

### setGenre

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

Sets the genre.

### setIsBrowsable

```
@CanIgnoreReturnValue
fun setIsBrowsable(isBrowsable: Boolean?): MediaMetadata.Builder!
```

Sets whether the media is a browsable folder.

### setIsPlayable

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

Sets whether the media is playable.

### setMediaType

```
@CanIgnoreReturnValue
fun setMediaType(
    @MediaMetadata.MediaType mediaType: @MediaMetadata.MediaType Int?
): MediaMetadata.Builder!
```

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

### setOverallRating

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

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

### setPlaylistId

```
@CanIgnoreReturnValue
@UnstableApi
fun setPlaylistId(playlistId: String?): MediaMetadata.Builder!
```

Sets the playlist ID.

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

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

### setSupportedCommands

```
@CanIgnoreReturnValue
@UnstableApi
fun setSupportedCommands(supportedCommands: (Mutable)List<String!>!): MediaMetadata.Builder!
```

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

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

### setWriter

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

Sets the writer.

### setYear

```
@CanIgnoreReturnValue
@UnstableApi
fun [setYear](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata.Builder#setYear(java.lang.Integer))(year: Int?): MediaMetadata.Builder!
```

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