Class TestExoPlayerBuilder
- java.lang.Object
-
- com.google.android.exoplayer2.testutil.TestExoPlayerBuilder
-
-
Constructor Summary
Constructors Constructor Description TestExoPlayerBuilder(Context context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExoPlayerbuild()Builds anExoPlayerusing the provided values or their defaults.BandwidthMetergetBandwidthMeter()Returns the bandwidth meter used by the player.ClockgetClock()Returns the clock used by the player.LoadControlgetLoadControl()Returns theLoadControlthat will be used by the player.LoopergetLooper()MediaSource.FactorygetMediaSourceFactory()Returns theMediaSource.Factorythat will be used by the player, or null if noMediaSource.Factoryhas been set yet and no default is available.Renderer[]getRenderers()Returns theRenderersthat have been set withsetRenderers(com.google.android.exoplayer2.Renderer...)or null if noRenderershave been explicitly set.RenderersFactorygetRenderersFactory()Returns theRenderersFactorythat has been set withsetRenderersFactory(com.google.android.exoplayer2.RenderersFactory)or null if no factory has been explicitly set.longgetSeekBackIncrementMs()Returns the seek back increment used by the player.longgetSeekForwardIncrementMs()Returns the seek forward increment used by the player.DefaultTrackSelectorgetTrackSelector()Returns the track selector used by the player.booleangetUseLazyPreparation()Returns whether the player will use lazy preparation.TestExoPlayerBuildersetBandwidthMeter(BandwidthMeter bandwidthMeter)Sets theBandwidthMeter.TestExoPlayerBuildersetClock(Clock clock)Sets theClockto be used by the player.TestExoPlayerBuildersetDeviceVolumeControlEnabled(boolean deviceVolumeControlEnabled)Sets the variable controlling player's ability to get/set device volume.TestExoPlayerBuildersetLoadControl(LoadControl loadControl)Sets aLoadControlto be used by the player.TestExoPlayerBuildersetLooper(Looper looper)Sets theLooperto be used by the player.TestExoPlayerBuildersetMediaSourceFactory(MediaSource.Factory mediaSourceFactory)Sets theMediaSource.Factoryto be used by the player.TestExoPlayerBuildersetRenderers(Renderer... renderers)Sets theRenderers.TestExoPlayerBuildersetRenderersFactory(RenderersFactory renderersFactory)Sets theRenderersFactory.TestExoPlayerBuildersetSeekBackIncrementMs(long seekBackIncrementMs)Sets the seek back increment to be used by the player.TestExoPlayerBuildersetSeekForwardIncrementMs(long seekForwardIncrementMs)Sets the seek forward increment to be used by the player.TestExoPlayerBuildersetTrackSelector(DefaultTrackSelector trackSelector)Sets aDefaultTrackSelector.TestExoPlayerBuildersetUseLazyPreparation(boolean useLazyPreparation)Sets whether to use lazy preparation.
-
-
-
Constructor Detail
-
TestExoPlayerBuilder
public TestExoPlayerBuilder(Context context)
-
-
Method Detail
-
setUseLazyPreparation
@CanIgnoreReturnValue public TestExoPlayerBuilder setUseLazyPreparation(boolean useLazyPreparation)
Sets whether to use lazy preparation.- Parameters:
useLazyPreparation- Whether to use lazy preparation.- Returns:
- This builder.
-
getUseLazyPreparation
public boolean getUseLazyPreparation()
Returns whether the player will use lazy preparation.
-
setTrackSelector
@CanIgnoreReturnValue public TestExoPlayerBuilder setTrackSelector(DefaultTrackSelector trackSelector)
Sets aDefaultTrackSelector. The default value is aDefaultTrackSelectorin its initial configuration.- Parameters:
trackSelector- TheDefaultTrackSelectorto be used by the player.- Returns:
- This builder.
-
getTrackSelector
public DefaultTrackSelector getTrackSelector()
Returns the track selector used by the player.
-
setLoadControl
@CanIgnoreReturnValue public TestExoPlayerBuilder setLoadControl(LoadControl loadControl)
Sets aLoadControlto be used by the player. The default value is aDefaultLoadControl.- Parameters:
loadControl- TheLoadControlto be used by the player.- Returns:
- This builder.
-
getLoadControl
public LoadControl getLoadControl()
Returns theLoadControlthat will be used by the player.
-
setBandwidthMeter
@CanIgnoreReturnValue public TestExoPlayerBuilder setBandwidthMeter(BandwidthMeter bandwidthMeter)
Sets theBandwidthMeter. The default value is aDefaultBandwidthMeterin its default configuration.- Parameters:
bandwidthMeter- TheBandwidthMeterto be used by the player.- Returns:
- This builder.
-
getBandwidthMeter
public BandwidthMeter getBandwidthMeter()
Returns the bandwidth meter used by the player.
-
setRenderers
@CanIgnoreReturnValue public TestExoPlayerBuilder setRenderers(Renderer... renderers)
Sets theRenderers. If not set, the player will use aFakeVideoRendererand aFakeAudioRenderer. Setting the renderers is not allowed after a call tosetRenderersFactory(RenderersFactory).- Parameters:
renderers- A list ofRenderers to be used by the player.- Returns:
- This builder.
-
getRenderers
@Nullable public Renderer[] getRenderers()
Returns theRenderersthat have been set withsetRenderers(com.google.android.exoplayer2.Renderer...)or null if noRenderershave been explicitly set. Note that these renderers may not be the ones used by the built player, for example if aRenderer factoryhas been set.
-
setRenderersFactory
@CanIgnoreReturnValue public TestExoPlayerBuilder setRenderersFactory(RenderersFactory renderersFactory)
Sets theRenderersFactory. The default factory creates all renderers set bysetRenderers(Renderer...). Setting the renderer factory is not allowed after a call tosetRenderers(Renderer...).- Parameters:
renderersFactory- ARenderersFactoryto be used by the player.- Returns:
- This builder.
-
getRenderersFactory
@Nullable public RenderersFactory getRenderersFactory()
Returns theRenderersFactorythat has been set withsetRenderersFactory(com.google.android.exoplayer2.RenderersFactory)or null if no factory has been explicitly set.
-
setClock
@CanIgnoreReturnValue public TestExoPlayerBuilder setClock(Clock clock)
- Parameters:
clock- AClockto be used by the player.- Returns:
- This builder.
-
getClock
public Clock getClock()
Returns the clock used by the player.
-
setLooper
@CanIgnoreReturnValue public TestExoPlayerBuilder setLooper(Looper looper)
Sets theLooperto be used by the player.- Parameters:
looper- TheLooperto be used by the player.- Returns:
- This builder.
-
getLooper
@Nullable public Looper getLooper()
-
getMediaSourceFactory
@Nullable public MediaSource.Factory getMediaSourceFactory()
Returns theMediaSource.Factorythat will be used by the player, or null if noMediaSource.Factoryhas been set yet and no default is available.
-
setMediaSourceFactory
@CanIgnoreReturnValue public TestExoPlayerBuilder setMediaSourceFactory(MediaSource.Factory mediaSourceFactory)
Sets theMediaSource.Factoryto be used by the player.- Parameters:
mediaSourceFactory- TheMediaSource.Factoryto be used by the player.- Returns:
- This builder.
-
setSeekBackIncrementMs
@CanIgnoreReturnValue public TestExoPlayerBuilder setSeekBackIncrementMs(long seekBackIncrementMs)
Sets the seek back increment to be used by the player.- Parameters:
seekBackIncrementMs- The seek back increment to be used by the player.- Returns:
- This builder.
-
getSeekBackIncrementMs
public long getSeekBackIncrementMs()
Returns the seek back increment used by the player.
-
setSeekForwardIncrementMs
@CanIgnoreReturnValue public TestExoPlayerBuilder setSeekForwardIncrementMs(long seekForwardIncrementMs)
Sets the seek forward increment to be used by the player.- Parameters:
seekForwardIncrementMs- The seek forward increment to be used by the player.- Returns:
- This builder.
-
setDeviceVolumeControlEnabled
@CanIgnoreReturnValue public TestExoPlayerBuilder setDeviceVolumeControlEnabled(boolean deviceVolumeControlEnabled)
Sets the variable controlling player's ability to get/set device volume.- Parameters:
deviceVolumeControlEnabled- Whether the player can get/set device volume.- Returns:
- This builder.
-
getSeekForwardIncrementMs
public long getSeekForwardIncrementMs()
Returns the seek forward increment used by the player.
-
-