# SimpleBasePlayer.MediaItemData.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/SimpleBasePlayer.java+class:androidx.media3.common.SimpleBasePlayer.MediaItemData.Builder)

*** ** * ** ***


```
public final class SimpleBasePlayer.MediaItemData.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData` objects.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#Builder(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html uid)` Creates the builder. |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData` | `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#build()()` Builds the `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData`. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setDefaultPositionUs(long)(long defaultPositionUs)` Sets the default position relative to the start of the media item at which to begin playback, in microseconds. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setDurationUs(long)(long durationUs)` Sets the duration of the media item, in microseconds. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setElapsedRealtimeEpochOffsetMs(long)(long elapsedRealtimeEpochOffsetMs)` Sets the offset between `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` and the time since the Unix epoch according to the clock of the media origin server. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setIsDynamic(boolean)(boolean isDynamic)` Sets whether this media item may change over time, for example a moving live window. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setIsPlaceholder(boolean)(boolean isPlaceholder)` Sets whether this media item contains placeholder information because the real information has yet to be loaded. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setIsSeekable(boolean)(boolean isSeekable)` Sets whether it's possible to seek within this media item. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setLiveConfiguration(androidx.media3.common.MediaItem.LiveConfiguration)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/MediaItem.LiveConfiguration liveConfiguration )` Sets the active `https://developer.android.com/reference/androidx/media3/common/MediaItem.LiveConfiguration`, or null if the media item is not live. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setManifest(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest)` Sets the manifest of the media item. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setMediaItem(androidx.media3.common.MediaItem)(https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem)` Sets the `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setMediaMetadata(androidx.media3.common.MediaMetadata)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/MediaMetadata mediaMetadata)` Sets the `https://developer.android.com/reference/androidx/media3/common/MediaMetadata`. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setPeriods(java.util.List<androidx.media3.common.SimpleBasePlayer.PeriodData>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.PeriodData> periods)` Sets the list of `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.PeriodData` in this media item. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setPositionInFirstPeriodUs(long)(long positionInFirstPeriodUs)` Sets the position of the start of this media item relative to the start of the first period belonging to it, in microseconds. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setPresentationStartTimeMs(long)(long presentationStartTimeMs)` Sets the start time of the presentation. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setTracks(androidx.media3.common.Tracks)(https://developer.android.com/reference/androidx/media3/common/Tracks tracks)` Sets the `https://developer.android.com/reference/androidx/media3/common/Tracks` of this media item. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setUid(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html uid)` Sets the unique identifier of this media item within a playlist. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setWindowStartTimeMs(long)(long windowStartTimeMs)` Sets the start time of the window. |

## Public constructors

### Builder

```
public Builder(Object uid)
```

Creates the builder.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/Object.html uid` | The unique identifier of the media item within a playlist. This value will be set as `https://developer.android.com/reference/androidx/media3/common/Timeline.Window#uid()` for this item. |

## Public methods

### build

```
public SimpleBasePlayer.MediaItemData build()
```

Builds the `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData`.

### setDefaultPositionUs

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setDefaultPositionUs(long defaultPositionUs)
```

Sets the default position relative to the start of the media item at which to begin playback, in microseconds.

The default position must be less or equal to the `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setDurationUs(long)`, if set.

| Parameters |
|---|---|
| `long defaultPositionUs` | The default position relative to the start of the media item at which to begin playback, in microseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setDurationUs

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setDurationUs(long durationUs)
```

Sets the duration of the media item, in microseconds.

If both this duration and all `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setPeriods(java.util.List<androidx.media3.common.SimpleBasePlayer.PeriodData>)` durations are set, the sum of this duration and the `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setPositionInFirstPeriodUs(long)` must match the total duration of all periods.

| Parameters |
|---|---|
| `long durationUs` | The duration of the media item, in microseconds, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if unknown. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setElapsedRealtimeEpochOffsetMs

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setElapsedRealtimeEpochOffsetMs(long elapsedRealtimeEpochOffsetMs)
```

Sets the offset between `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` and the time since the Unix epoch according to the clock of the media origin server.

This value can only be set to anything other than `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if the stream is `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setLiveConfiguration(androidx.media3.common.MediaItem.LiveConfiguration)`.

| Parameters |
|---|---|
| `long elapsedRealtimeEpochOffsetMs` | The offset between `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` and the time since the Unix epoch according to the clock of the media origin server, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if unknown or not applicable. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setIsDynamic

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setIsDynamic(boolean isDynamic)
```

Sets whether this media item may change over time, for example a moving live window.

| Parameters |
|---|---|
| `boolean isDynamic` | Whether this media item may change over time, for example a moving live window. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setIsPlaceholder

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setIsPlaceholder(boolean isPlaceholder)
```

Sets whether this media item contains placeholder information because the real information has yet to be loaded.

| Parameters |
|---|---|
| `boolean isPlaceholder` | Whether this media item contains placeholder information because the real information has yet to be loaded. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setIsSeekable

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setIsSeekable(boolean isSeekable)
```

Sets whether it's possible to seek within this media item.

| Parameters |
|---|---|
| `boolean isSeekable` | Whether it's possible to seek within this media item. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setLiveConfiguration

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setLiveConfiguration(
    @Nullable MediaItem.LiveConfiguration liveConfiguration
)
```

Sets the active `https://developer.android.com/reference/androidx/media3/common/MediaItem.LiveConfiguration`, or null if the media item is not live.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/MediaItem.LiveConfiguration liveConfiguration` | The active `https://developer.android.com/reference/androidx/media3/common/MediaItem.LiveConfiguration`, or null if the media item is not live. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setManifest

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setManifest(@Nullable Object manifest)
```

Sets the manifest of the media item.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest` | The manifest of the media item, or null if not applicable. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setMediaItem

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setMediaItem(MediaItem mediaItem)
```

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem` | The `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setMediaMetadata

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setMediaMetadata(@Nullable MediaMetadata mediaMetadata)
```

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

This data includes static data from the `https://developer.android.com/reference/androidx/media3/common/MediaItem#mediaMetadata()` and the media's `https://developer.android.com/reference/androidx/media3/common/Format#metadata()`, as well any dynamic metadata that has been parsed from the media. If null, the metadata is assumed to be the simple combination of the `https://developer.android.com/reference/androidx/media3/common/MediaItem#mediaMetadata()` metadata and the metadata of the selected `https://developer.android.com/reference/androidx/media3/common/Format#metadata()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/MediaMetadata mediaMetadata` | The `https://developer.android.com/reference/androidx/media3/common/MediaMetadata`, or null to assume that the metadata is the simple combination of the `https://developer.android.com/reference/androidx/media3/common/MediaItem#mediaMetadata()` metadata and the metadata of the selected `https://developer.android.com/reference/androidx/media3/common/Format#metadata()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setPeriods

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setPeriods(List<SimpleBasePlayer.PeriodData> periods)
```

Sets the list of `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.PeriodData` in this media item.

All periods must have unique `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.PeriodData.Builder#setUid(java.lang.Object)` and only the last period is allowed to have an unset `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.PeriodData.Builder#setDurationUs(long)`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.PeriodData> periods` | The list of `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.PeriodData` in this media item, or an empty list to assume a single period without ads and the same duration as the media item. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setPositionInFirstPeriodUs

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setPositionInFirstPeriodUs(long positionInFirstPeriodUs)
```

Sets the position of the start of this media item relative to the start of the first period belonging to it, in microseconds.

| Parameters |
|---|---|
| `long positionInFirstPeriodUs` | The position of the start of this media item relative to the start of the first period belonging to it, in microseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setPresentationStartTimeMs

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setPresentationStartTimeMs(long presentationStartTimeMs)
```

Sets the start time of the presentation.

| Parameters |
|---|---|
| `long presentationStartTimeMs` | The start time of the presentation, in milliseconds since the Unix epoch, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if unknown or not applicable. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setTracks

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setTracks(Tracks tracks)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/Tracks` of this media item.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Tracks tracks` | The `https://developer.android.com/reference/androidx/media3/common/Tracks` of this media item. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setUid

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setUid(Object uid)
```

Sets the unique identifier of this media item within a playlist.

This value will be set as `https://developer.android.com/reference/androidx/media3/common/Timeline.Window#uid()` for this item.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/Object.html uid` | The unique identifier of this media item within a playlist. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |

### setWindowStartTimeMs

```
@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setWindowStartTimeMs(long windowStartTimeMs)
```

Sets the start time of the window.

This value should be greater than or equal to the `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder#setPresentationStartTimeMs(long)`, if set.

| Parameters |
|---|---|
| `long windowStartTimeMs` | The start time of the window, in milliseconds since the Unix epoch, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if unknown or not applicable. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.MediaItemData.Builder` | This builder. |