TestExoPlayerBuilder
@UnstableApi
public class TestExoPlayerBuilder
A builder of ExoPlayer instances for testing.
Summary
Public fields |
|
|---|---|
BandwidthMeter |
|
Clock |
|
LoadControl |
|
@MonotonicNonNull Looper |
|
@Nullable MediaSource.Factory |
|
@Nullable Renderer[] |
|
@Nullable RenderersFactory |
|
long |
|
long |
|
DefaultTrackSelector |
|
boolean |
Public constructors |
|---|
TestExoPlayerBuilder(Context context) |
Public methods |
|
|---|---|
ExoPlayer |
build()Builds an |
BandwidthMeter |
Returns the bandwidth meter used by the player. |
Clock |
getClock()Returns the clock used by the player. |
LoadControl |
Returns the |
@Nullable Looper |
Returns the |
long |
Returns the max seek to previous position used by the player. |
@Nullable MediaSource.Factory |
Returns the |
@Nullable Renderer[] |
Returns the |
@Nullable RenderersFactory |
Returns the |
long |
Returns the seek back increment used by the player. |
long |
Returns the seek forward increment used by the player. |
DefaultTrackSelector |
Returns the track selector used by the player. |
boolean |
Returns whether the player will use lazy preparation. |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the variable controlling player's ability to get/set device volume. |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSee |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets a |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the max seek to previous position, in milliseconds, to be used by the player. |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the preload configuration. |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the seek back increment to be used by the player. |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the seek forward increment to be used by the player. |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSee |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSee |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets the |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSee |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets a |
TestExoPlayerBuilder |
@CanIgnoreReturnValueSets whether to use lazy preparation. |
Public fields
Public constructors
Public methods
getBandwidthMeter
public BandwidthMeter getBandwidthMeter()
Returns the bandwidth meter used by the player.
getLoadControl
public LoadControl getLoadControl()
Returns the LoadControl that will be used by the player.
getLooper
public @Nullable 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.
getMaxSeekToPreviousPosition
public long getMaxSeekToPreviousPosition()
Returns the max seek to previous position used by the player.
getMediaSourceFactory
public @Nullable 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.
getRenderers
public @Nullable Renderer[] getRenderers()
Returns the Renderers that have been set with setRenderers 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.
getRenderersFactory
public @Nullable RenderersFactory getRenderersFactory()
Returns the RenderersFactory that has been set with setRenderersFactory or null if no factory has been explicitly set.
getSeekBackIncrementMs
public long getSeekBackIncrementMs()
Returns the seek back increment used by the player.
getSeekForwardIncrementMs
public long getSeekForwardIncrementMs()
Returns the seek forward increment used by the player.
getTrackSelector
public DefaultTrackSelector getTrackSelector()
Returns the track selector used by the player.
getUseLazyPreparation
public boolean getUseLazyPreparation()
Returns whether the player will use lazy preparation.
setBandwidthMeter
@CanIgnoreReturnValue
public TestExoPlayerBuilder setBandwidthMeter(BandwidthMeter bandwidthMeter)
Sets the BandwidthMeter. The default value is a DefaultBandwidthMeter in its default configuration.
| Parameters | |
|---|---|
BandwidthMeter bandwidthMeter |
The |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setClock
@CanIgnoreReturnValue
public TestExoPlayerBuilder setClock(Clock clock)
Sets the Clock to be used by the player. The default value is an auto-advancing FakeClock.
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setDeviceVolumeControlEnabled
@CanIgnoreReturnValue
public TestExoPlayerBuilder setDeviceVolumeControlEnabled(boolean deviceVolumeControlEnabled)
Sets the variable controlling player's ability to get/set device volume.
| Parameters | |
|---|---|
boolean deviceVolumeControlEnabled |
Whether the player can get/set device volume. |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setDynamicSchedulingEnabled
@CanIgnoreReturnValue
public TestExoPlayerBuilder setDynamicSchedulingEnabled(boolean dynamicSchedulingEnabled)
See experimentalSetDynamicSchedulingEnabled for details.
| Parameters | |
|---|---|
boolean dynamicSchedulingEnabled |
Whether the player should enable dynamically schedule its playback loop for when |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setLoadControl
@CanIgnoreReturnValue
public TestExoPlayerBuilder setLoadControl(LoadControl loadControl)
Sets a LoadControl to be used by the player. The default value is a DefaultLoadControl.
| Parameters | |
|---|---|
LoadControl loadControl |
The |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setLooper
@CanIgnoreReturnValue
public TestExoPlayerBuilder setLooper(Looper looper)
Sets the Looper to be used for all calls to the player and for calling listeners.
| Parameters | |
|---|---|
Looper looper |
The |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setMaxSeekToPreviousPositionMs
@CanIgnoreReturnValue
public TestExoPlayerBuilder setMaxSeekToPreviousPositionMs(long maxSeekToPreviousPositionMs)
Sets the max seek to previous position, in milliseconds, to be used by the player.
| Parameters | |
|---|---|
long maxSeekToPreviousPositionMs |
The max seek to previous position to be used by the player. |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setMediaSourceFactory
@CanIgnoreReturnValue
public TestExoPlayerBuilder setMediaSourceFactory(MediaSource.Factory mediaSourceFactory)
Sets the MediaSource.Factory to be used by the player.
| Parameters | |
|---|---|
MediaSource.Factory mediaSourceFactory |
The |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setPreloadConfiguration
@CanIgnoreReturnValue
public TestExoPlayerBuilder setPreloadConfiguration(
ExoPlayer.PreloadConfiguration preloadConfiguration
)
Sets the preload configuration.
| See also | |
|---|---|
setPreloadConfiguration |
setRenderers
@CanIgnoreReturnValue
public TestExoPlayerBuilder setRenderers(Renderer[] 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.
| Parameters | |
|---|---|
Renderer[] renderers |
A list of |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setRenderersFactory
@CanIgnoreReturnValue
public TestExoPlayerBuilder setRenderersFactory(RenderersFactory renderersFactory)
Sets the RenderersFactory. The default factory creates all renderers set by setRenderers. Setting the renderer factory is not allowed after a call to setRenderers.
| Parameters | |
|---|---|
RenderersFactory renderersFactory |
A |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setSeekBackIncrementMs
@CanIgnoreReturnValue
public TestExoPlayerBuilder setSeekBackIncrementMs(long seekBackIncrementMs)
Sets the seek back increment to be used by the player.
| Parameters | |
|---|---|
long seekBackIncrementMs |
The seek back increment to be used by the player. |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setSeekForwardIncrementMs
@CanIgnoreReturnValue
public TestExoPlayerBuilder setSeekForwardIncrementMs(long seekForwardIncrementMs)
Sets the seek forward increment to be used by the player.
| Parameters | |
|---|---|
long seekForwardIncrementMs |
The seek forward increment to be used by the player. |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setStuckPlayingDetectionTimeoutMs
@CanIgnoreReturnValue
public TestExoPlayerBuilder setStuckPlayingDetectionTimeoutMs(int stuckPlayingDetectionTimeoutMs)
See setStuckPlayingDetectionTimeoutMs for details.
| Parameters | |
|---|---|
int stuckPlayingDetectionTimeoutMs |
The timeout after which the player is assumed stuck playing, in milliseconds. |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setStuckSuppressedDetectionTimeoutMs
@CanIgnoreReturnValue
public TestExoPlayerBuilder setStuckSuppressedDetectionTimeoutMs(
int stuckSuppressedDetectionTimeoutMs
)
See setStuckSuppressedDetectionTimeoutMs for details.
| Parameters | |
|---|---|
int stuckSuppressedDetectionTimeoutMs |
The timeout after which the player is assumed stuck in a suppressed state, in milliseconds. |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setSuitableOutputChecker
@CanIgnoreReturnValue
@RequiresApi(value = 35)
public TestExoPlayerBuilder setSuitableOutputChecker(SuitableOutputChecker suitableOutputChecker)
Sets the SuitableOutputChecker to check the suitability of the selected outputs for playback.
If this method is not called, the library uses a default implementation based on framework APIs.
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setSuppressPlaybackOnUnsuitableOutput
@CanIgnoreReturnValue
public TestExoPlayerBuilder setSuppressPlaybackOnUnsuitableOutput(
boolean suppressPlaybackOnUnsuitableOutput
)
See setSuppressPlaybackOnUnsuitableOutput for details.
| Parameters | |
|---|---|
boolean suppressPlaybackOnUnsuitableOutput |
Whether the player should suppress the playback when it is attempted on an unsuitable output. |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setTrackSelector
@CanIgnoreReturnValue
public TestExoPlayerBuilder setTrackSelector(DefaultTrackSelector trackSelector)
Sets a DefaultTrackSelector. The default value is a DefaultTrackSelector in its initial configuration.
| Parameters | |
|---|---|
DefaultTrackSelector trackSelector |
The |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |
setUseLazyPreparation
@CanIgnoreReturnValue
public TestExoPlayerBuilder setUseLazyPreparation(boolean useLazyPreparation)
Sets whether to use lazy preparation.
| Parameters | |
|---|---|
boolean useLazyPreparation |
Whether to use lazy preparation. |
| Returns | |
|---|---|
TestExoPlayerBuilder |
This builder. |