# SilenceMediaSource.Factory

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

*** ** * ** ***


```
public final class SilenceMediaSource.Factory
```

<br />

*** ** * ** ***

Factory for `https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource.Factory#Factory()()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource.Factory#createMediaSource()()` Creates a new `https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource.Factory` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource.Factory#setDurationUs(long)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long durationUs)` Sets the duration of the silent audio. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource.Factory` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource.Factory#setTag(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html tag)` Sets a tag for the media source which will be published in the `https://developer.android.com/reference/androidx/media3/common/Timeline` of the source as `https://developer.android.com/reference/androidx/media3/common/MediaItem.LocalConfiguration#tag()`. |

## Public constructors

### Factory

```
public Factory()
```

## Public methods

### createMediaSource

```
public SilenceMediaSource createMediaSource()
```

Creates a new `https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if the duration is a non-positive value. |

### setDurationUs

```
@CanIgnoreReturnValue
public SilenceMediaSource.Factory setDurationUs(@IntRange(from = 1) long durationUs)
```

Sets the duration of the silent audio. The value needs to be a positive value.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long durationUs` | The duration of silent audio to output, in microseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource.Factory` | This factory, for convenience. |

### setTag

```
@CanIgnoreReturnValue
public SilenceMediaSource.Factory setTag(@Nullable Object tag)
```

Sets a tag for the media source which will be published in the `https://developer.android.com/reference/androidx/media3/common/Timeline` of the source as `https://developer.android.com/reference/androidx/media3/common/MediaItem.LocalConfiguration#tag()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html tag` | A tag for the media source. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/SilenceMediaSource.Factory` | This factory, for convenience. |