Package com.google.android.exoplayer2.source

## Class SilenceMediaSource.Factory

- java.lang.Object
- - com.google.android.exoplayer2.source.SilenceMediaSource.Factory

- Enclosing class:
    SilenceMediaSource

      public static final class SilenceMediaSource.Factory
      extends Object

  Factory for `SilenceMediaSources`.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Factory()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SilenceMediaSource` | `createMediaSource()` | Creates a new `SilenceMediaSource`.
    `SilenceMediaSource.Factory` | `setDurationUs​(long durationUs)` | Sets the duration of the silent audio.
    `SilenceMediaSource.Factory` | `setTag​(Object tag)` | Sets a tag for the media source which will be published in the `Timeline` of the source as `Window#mediaItem.localConfiguration.tag`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Factory

          public Factory()

  - ### Method Detail

    - #### setDurationUs

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

      Sets the duration of the silent audio. The value needs to be a positive value.
      Parameters:
        `durationUs` - The duration of silent audio to output, in microseconds.
      Returns:
        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 `Timeline` of the source as `Window#mediaItem.localConfiguration.tag`.
      Parameters:
        `tag` - A tag for the media source.
      Returns:
        This factory, for convenience.

    - #### createMediaSource

          public SilenceMediaSource createMediaSource()

      Creates a new `SilenceMediaSource`.
      Throws:
        `IllegalStateException` - if the duration is a non-positive value.