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 forSilenceMediaSources.
-
-
Constructor Summary
Constructors Constructor Description Factory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SilenceMediaSourcecreateMediaSource()Creates a newSilenceMediaSource.SilenceMediaSource.FactorysetDurationUs(long durationUs)Sets the duration of the silent audio.SilenceMediaSource.FactorysetTag(Object tag)Sets a tag for the media source which will be published in theTimelineof the source asWindow#mediaItem.localConfiguration.tag.
-
-
-
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 theTimelineof the source asWindow#mediaItem.localConfiguration.tag.- Parameters:
tag- A tag for the media source.- Returns:
- This factory, for convenience.
-
createMediaSource
public SilenceMediaSource createMediaSource()
Creates a newSilenceMediaSource.- Throws:
IllegalStateException- if the duration is a non-positive value.
-
-