docs/doc/reference/com/google/android/exoplayer2/testutil/TestExoPlayerBuilder.html
Package com.google.android.exoplayer2.testutil
public classTestExoPlayerBuilderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")
A builder of ExoPlayer instances for testing.
Constructors | Constructor | Description |
| --- | --- |
| TestExoPlayerBuilder(Context context) | |
All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| ExoPlayer | build() |
Builds an ExoPlayer 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 the LoadControl that will be used by the player.
|
| Looper | getLooper() |
Returns the Looper that will be used by the player, or null if no Looper has been set yet and no default is available.
|
| MediaSource.Factory | getMediaSourceFactory() |
Returns the MediaSource.Factory that will be used by the player, or null if no MediaSource.Factory has been set yet and no default is available.
|
| Renderer[] | getRenderers() |
Returns the Renderers that have been set with setRenderers(com.google.android.exoplayer2.Renderer...) or null if no Renderers have been explicitly set.
|
| RenderersFactory | getRenderersFactory() |
Returns the RenderersFactory that has been set with setRenderersFactory(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 the BandwidthMeter.
|
| TestExoPlayerBuilder | setClock(Clock clock) |
Sets the Clock 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 a LoadControl to be used by the player.
|
| TestExoPlayerBuilder | setLooper(Looper looper) |
Sets the Looper to be used by the player.
|
| TestExoPlayerBuilder | setMediaSourceFactory(MediaSource.Factory mediaSourceFactory) |
Sets the MediaSource.Factory to be used by the player.
|
| TestExoPlayerBuilder | setRenderers(Renderer... renderers) |
Sets the Renderers.
|
| TestExoPlayerBuilder | setRenderersFactory(RenderersFactory renderersFactory) |
Sets the RenderersFactory.
|
| 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 a DefaultTrackSelector.
|
| TestExoPlayerBuilder | setUseLazyPreparation(boolean useLazyPreparation) |
Sets whether to use lazy preparation.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public TestExoPlayerBuilder([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context)
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")setUseLazyPreparation(boolean useLazyPreparation)
Sets whether to use lazy preparation.
Parameters:useLazyPreparation - Whether to use lazy preparation.Returns:This builder.
-
public boolean getUseLazyPreparation()
Returns whether the player will use lazy preparation.
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")setTrackSelector([DefaultTrackSelector](../trackselection/DefaultTrackSelector.html "class in com.google.android.exoplayer2.trackselection")trackSelector)
Sets a DefaultTrackSelector. The default value is a DefaultTrackSelector in its initial configuration.
Parameters:trackSelector - The DefaultTrackSelector to be used by the player.Returns:This builder.
-
public[DefaultTrackSelector](../trackselection/DefaultTrackSelector.html "class in com.google.android.exoplayer2.trackselection")getTrackSelector()
Returns the track selector used by the player.
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")setLoadControl([LoadControl](../LoadControl.html "interface in com.google.android.exoplayer2")loadControl)
Sets a LoadControl to be used by the player. The default value is a DefaultLoadControl.
Parameters:loadControl - The LoadControl to be used by the player.Returns:This builder.
-
public[LoadControl](../LoadControl.html "interface in com.google.android.exoplayer2")getLoadControl()
Returns the LoadControl that will be used by the player.
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")setBandwidthMeter([BandwidthMeter](../upstream/BandwidthMeter.html "interface in com.google.android.exoplayer2.upstream")bandwidthMeter)
Sets the BandwidthMeter. The default value is a DefaultBandwidthMeter in its default configuration.
Parameters:bandwidthMeter - The BandwidthMeter to be used by the player.Returns:This builder.
-
public[BandwidthMeter](../upstream/BandwidthMeter.html "interface in com.google.android.exoplayer2.upstream")getBandwidthMeter()
Returns the bandwidth meter used by the player.
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")setRenderers([Renderer](../Renderer.html "interface in com.google.android.exoplayer2")... renderers)
Sets the Renderers. If not set, the player will use a FakeVideoRenderer and a FakeAudioRenderer. Setting the renderers is not allowed after a call to setRenderersFactory(RenderersFactory).
Parameters:renderers - A list of Renderers to be used by the player.Returns:This builder.
-
@Nullable
public[Renderer](../Renderer.html "interface in com.google.android.exoplayer2")[] getRenderers()
Returns the Renderers that have been set with setRenderers(com.google.android.exoplayer2.Renderer...) or null if no Renderers have been explicitly set. Note that these renderers may not be the ones used by the built player, for example if a Renderer factory has been set.
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")setRenderersFactory([RenderersFactory](../RenderersFactory.html "interface in com.google.android.exoplayer2")renderersFactory)
Sets the RenderersFactory. The default factory creates all renderers set by setRenderers(Renderer...). Setting the renderer factory is not allowed after a call to setRenderers(Renderer...).
Parameters:renderersFactory - A RenderersFactory to be used by the player.Returns:This builder.
-
@Nullable
public[RenderersFactory](../RenderersFactory.html "interface in com.google.android.exoplayer2")getRenderersFactory()
Returns the RenderersFactory that has been set with setRenderersFactory(com.google.android.exoplayer2.RenderersFactory) or null if no factory has been explicitly set.
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")setClock([Clock](../util/Clock.html "interface in com.google.android.exoplayer2.util")clock)
Sets the Clock to be used by the player. The default value is an auto-advancing FakeClock.
Parameters:clock - A Clock to be used by the player.Returns:This builder.
-
public[Clock](../util/Clock.html "interface in com.google.android.exoplayer2.util")getClock()
Returns the clock used by the player.
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")setLooper([Looper](https://developer.android.com/reference/android/os/Looper.html "class or interface in android.os")looper)
Sets the Looper to be used by the player.
Parameters:looper - The Looper to be used by the player.Returns:This builder.
-
@Nullable
public[Looper](https://developer.android.com/reference/android/os/Looper.html "class or interface in android.os")getLooper()
Returns the Looper that will be used by the player, or null if no Looper has been set yet and no default is available.
-
@Nullable
public[MediaSource.Factory](../source/MediaSource.Factory.html "interface in com.google.android.exoplayer2.source")getMediaSourceFactory()
Returns the MediaSource.Factory that will be used by the player, or null if no MediaSource.Factory has been set yet and no default is available.
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")setMediaSourceFactory([MediaSource.Factory](../source/MediaSource.Factory.html "interface in com.google.android.exoplayer2.source")mediaSourceFactory)
Sets the MediaSource.Factory to be used by the player.
Parameters:mediaSourceFactory - The MediaSource.Factory to be used by the player.Returns:This builder.
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")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.
-
public long getSeekBackIncrementMs()
Returns the seek back increment used by the player.
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")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.
-
@CanIgnoreReturnValue
public[TestExoPlayerBuilder](TestExoPlayerBuilder.html "class in com.google.android.exoplayer2.testutil")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.
-
public long getSeekForwardIncrementMs()
Returns the seek forward increment used by the player.
-
public[ExoPlayer](../ExoPlayer.html "interface in com.google.android.exoplayer2")build()
Builds an ExoPlayer using the provided values or their defaults.