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 ExoPlayer
build()
Builds anExoPlayer
using the provided values or their defaults.BandwidthMeter
getBandwidthMeter()
Returns the bandwidth meter used by the player.Clock
getClock()
Returns the clock used by the player.LoadControl
getLoadControl()
Returns theLoadControl
that will be used by the player.Looper
getLooper()
MediaSource.Factory
getMediaSourceFactory()
Returns theMediaSource.Factory
that will be used by the player, or null if noMediaSource.Factory
has been set yet and no default is available.Renderer[]
getRenderers()
Returns theRenderers
that have been set withsetRenderers(com.google.android.exoplayer2.Renderer...)
or null if noRenderers
have been explicitly set.RenderersFactory
getRenderersFactory()
Returns theRenderersFactory
that has been set withsetRenderersFactory(com.google.android.exoplayer2.RenderersFactory)
or null if no factory has been explicitly set.long
getSeekBackIncrementMs()
Returns the seek back increment used by the player.long
getSeekForwardIncrementMs()
Returns the seek forward increment used by the player.DefaultTrackSelector
getTrackSelector()
Returns the track selector used by the player.boolean
getUseLazyPreparation()
Returns whether the player will use lazy preparation.TestExoPlayerBuilder
setBandwidthMeter(BandwidthMeter bandwidthMeter)
Sets theBandwidthMeter
.TestExoPlayerBuilder
setClock(Clock clock)
Sets theClock
to be used by the player.TestExoPlayerBuilder
setDeviceVolumeControlEnabled(boolean deviceVolumeControlEnabled)
Sets the variable controlling player's ability to get/set device volume.TestExoPlayerBuilder
setLoadControl(LoadControl loadControl)
Sets aLoadControl
to be used by the player.TestExoPlayerBuilder
setLooper(Looper looper)
Sets theLooper
to be used by the player.TestExoPlayerBuilder
setMediaSourceFactory(MediaSource.Factory mediaSourceFactory)
Sets theMediaSource.Factory
to be used by the player.TestExoPlayerBuilder
setRenderers(Renderer... renderers)
Sets theRenderer
s.TestExoPlayerBuilder
setRenderersFactory(RenderersFactory renderersFactory)
Sets theRenderersFactory
.TestExoPlayerBuilder
setSeekBackIncrementMs(long seekBackIncrementMs)
Sets the seek back increment to be used by the player.TestExoPlayerBuilder
setSeekForwardIncrementMs(long seekForwardIncrementMs)
Sets the seek forward increment to be used by the player.TestExoPlayerBuilder
setTrackSelector(DefaultTrackSelector trackSelector)
Sets aDefaultTrackSelector
.TestExoPlayerBuilder
setUseLazyPreparation(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 aDefaultTrackSelector
in its initial configuration.- Parameters:
trackSelector
- TheDefaultTrackSelector
to 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 aLoadControl
to be used by the player. The default value is aDefaultLoadControl
.- Parameters:
loadControl
- TheLoadControl
to be used by the player.- Returns:
- This builder.
-
getLoadControl
public LoadControl getLoadControl()
Returns theLoadControl
that will be used by the player.
-
setBandwidthMeter
@CanIgnoreReturnValue public TestExoPlayerBuilder setBandwidthMeter(BandwidthMeter bandwidthMeter)
Sets theBandwidthMeter
. The default value is aDefaultBandwidthMeter
in its default configuration.- Parameters:
bandwidthMeter
- TheBandwidthMeter
to 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 theRenderer
s. If not set, the player will use aFakeVideoRenderer
and aFakeAudioRenderer
. Setting the renderers is not allowed after a call tosetRenderersFactory(RenderersFactory)
.- Parameters:
renderers
- A list ofRenderer
s to be used by the player.- Returns:
- This builder.
-
getRenderers
@Nullable public Renderer[] getRenderers()
Returns theRenderers
that have been set withsetRenderers(com.google.android.exoplayer2.Renderer...)
or null if noRenderers
have been explicitly set. Note that these renderers may not be the ones used by the built player, for example if aRenderer factory
has 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
- ARenderersFactory
to be used by the player.- Returns:
- This builder.
-
getRenderersFactory
@Nullable public RenderersFactory getRenderersFactory()
Returns theRenderersFactory
that 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
- AClock
to 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 theLooper
to be used by the player.- Parameters:
looper
- TheLooper
to be used by the player.- Returns:
- This builder.
-
getLooper
@Nullable public Looper getLooper()
-
getMediaSourceFactory
@Nullable public MediaSource.Factory getMediaSourceFactory()
Returns theMediaSource.Factory
that will be used by the player, or null if noMediaSource.Factory
has been set yet and no default is available.
-
setMediaSourceFactory
@CanIgnoreReturnValue public TestExoPlayerBuilder setMediaSourceFactory(MediaSource.Factory mediaSourceFactory)
Sets theMediaSource.Factory
to be used by the player.- Parameters:
mediaSourceFactory
- TheMediaSource.Factory
to 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.
-
-