# MediaItem.AdsConfiguration

# MediaItem.AdsConfiguration

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/MediaItem.java+class:androidx.media3.common.MediaItem.AdsConfiguration)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/common/MediaItem.AdsConfiguration "View this page in Java")

<br />

```
class MediaItem.AdsConfiguration
```

<br />

*** ** * ** ***

Configuration for playing back linear ads with a media item.

## Summary

|                                                                                                                                         ### Nested types                                                                                                                                         |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[MediaItem.AdsConfiguration.Builder](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration.Builder) Builder for[AdsConfiguration](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration)instances. |

|                                                               ### Public functions                                                                |
|---------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [MediaItem.AdsConfiguration.Builder](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration.Builder)`!` | [buildUpon](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#buildUpon())`()` Returns a[Builder](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration.Builder)initialized with the values of this instance.                                                                                                                                                  |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                               | [equals](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#equals(java.lang.Object))`(obj: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)`                                                                                                                                                                                                                               |
| `java-static `[MediaItem.AdsConfiguration](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration)`!`   | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [fromBundle](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#fromBundle(android.os.Bundle))`(bundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`!)` Restores a`AdsConfiguration`from a[Bundle](https://developer.android.com/reference/android/os/Bundle.html). |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                       | [hashCode](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#hashCode())`()`                                                                                                                                                                                                                                                                                                                              |
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html)`!`                                                                       | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [toBundle](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#toBundle())`()` Returns a[Bundle](https://developer.android.com/reference/android/os/Bundle.html)representing the information stored in this object.                                                                                |

|                             ### Public properties                              |
|--------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Uri](https://developer.android.com/reference/android/net/Uri.html)`!`         | [adTagUri](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#adTagUri()) The ad tag URI to load.                                                                                                                                                                                                                                                                                                                                                                            |
| [Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?` | [adsId](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#adsId()) An opaque identifier for ad playback state associated with this item, or`null`if the combination of the[media ID](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.Builder#setMediaId(java.lang.String))and[ad tag URI](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#adTagUri())should be used as the ads identifier. |

## Public functions

### buildUpon

```
fun buildUpon(): MediaItem.AdsConfiguration.Builder!
```

Returns a[Builder](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration.Builder)initialized with the values of this instance.  

### equals

```
fun equals(obj: Any?): Boolean
```  

### fromBundle

```
@UnstableApi
java-static fun fromBundle(bundle: Bundle!): MediaItem.AdsConfiguration!
```

Restores a`AdsConfiguration`from a[Bundle](https://developer.android.com/reference/android/os/Bundle.html).  

### hashCode

```
fun hashCode(): Int
```  

### toBundle

```
@UnstableApi
fun toBundle(): Bundle!
```

Returns a[Bundle](https://developer.android.com/reference/android/os/Bundle.html)representing the information stored in this object.

It omits the[adsId](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#adsId())field. The[adsId](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#adsId())of an instance restored from such a bundle by[fromBundle](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#fromBundle(android.os.Bundle))will be`null`.  

## Public properties

### adTagUri

```
val adTagUri: Uri!
```

The ad tag URI to load.  

### adsId

```
val adsId: Any?
```

An opaque identifier for ad playback state associated with this item, or`null`if the combination of the[media ID](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.Builder#setMediaId(java.lang.String))and[ad tag URI](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.AdsConfiguration#adTagUri())should be used as the ads identifier.

Media items in the playlist that have the same ads identifier and ads loader share the same ad playback state. To resume ad playback when recreating the playlist on returning from the background, pass the same ads identifiers to the player.