ExoPlayerTestRunner.Builder


class ExoPlayerTestRunner.Builder


Builder to set-up an ExoPlayerTestRunner. Default fake implementations will be used for unset test properties.

Summary

Public constructors

Builder(context: Context!)

Public functions

ExoPlayerTestRunner!

Builds an ExoPlayerTestRunner using the provided values or their defaults.

ExoPlayerTestRunner.Builder!
@CanIgnoreReturnValue
initialSeek(mediaItemIndex: Int, positionMs: Long)

Seeks before setting the media sources and preparing the player.

ExoPlayerTestRunner.Builder!

Sets an ActionSchedule to be run by the test runner.

ExoPlayerTestRunner.Builder!

Sets an AnalyticsListener to be registered.

ExoPlayerTestRunner.Builder!
ExoPlayerTestRunner.Builder!
ExoPlayerTestRunner.Builder!

Sets the number of times the test runner is expected to reach the STATE_ENDED or STATE_IDLE.

ExoPlayerTestRunner.Builder!
ExoPlayerTestRunner.Builder!

Sets a manifest to be used by a FakeMediaSource in the test runner.

ExoPlayerTestRunner.Builder!

Sets the MediaSources to be used by the test runner.

ExoPlayerTestRunner.Builder!

Sets whether to enable pausing at the end of media items.

ExoPlayerTestRunner.Builder!

Sets an Player.Listener to be registered to listen to player events.

ExoPlayerTestRunner.Builder!
ExoPlayerTestRunner.Builder!
ExoPlayerTestRunner.Builder!

Sets a list of Formats to be used by a FakeMediaSource to create media periods.

ExoPlayerTestRunner.Builder!

Sets a Timeline to be used by a FakeMediaSource in the test runner.

ExoPlayerTestRunner.Builder!
ExoPlayerTestRunner.Builder!
ExoPlayerTestRunner.Builder!

Sets the video Surface.

ExoPlayerTestRunner.Builder!

Skips calling setMediaSources before preparing.

Public constructors

Builder

Builder(context: Context!)

Public functions

build

fun build(): ExoPlayerTestRunner!

Builds an ExoPlayerTestRunner using the provided values or their defaults.

initialSeek

@CanIgnoreReturnValue
fun initialSeek(mediaItemIndex: Int, positionMs: Long): ExoPlayerTestRunner.Builder!

Seeks before setting the media sources and preparing the player.

Parameters
mediaItemIndex: Int

The media item index to seek to.

positionMs: Long

The position in milliseconds to seek to.

Returns
ExoPlayerTestRunner.Builder!

This builder.

setActionSchedule

@CanIgnoreReturnValue
fun setActionSchedule(actionSchedule: ActionSchedule!): ExoPlayerTestRunner.Builder!

Sets an ActionSchedule to be run by the test runner. The first action will be executed immediately before prepare.

Parameters
actionSchedule: ActionSchedule!

An ActionSchedule to be used by the test runner.

Returns
ExoPlayerTestRunner.Builder!

This builder.

setAnalyticsListener

@CanIgnoreReturnValue
fun setAnalyticsListener(analyticsListener: AnalyticsListener!): ExoPlayerTestRunner.Builder!

Sets an AnalyticsListener to be registered.

Parameters
analyticsListener: AnalyticsListener!

An AnalyticsListener to be registered.

Returns
ExoPlayerTestRunner.Builder!

This builder.

setBandwidthMeter

@CanIgnoreReturnValue
fun setBandwidthMeter(bandwidthMeter: BandwidthMeter!): ExoPlayerTestRunner.Builder!
Returns
ExoPlayerTestRunner.Builder!

This builder.

setClock

@CanIgnoreReturnValue
fun setClock(clock: Clock!): ExoPlayerTestRunner.Builder!
Returns
ExoPlayerTestRunner.Builder!

This builder.

See also
setClock

setExpectedPlayerEndedCount

@CanIgnoreReturnValue
fun setExpectedPlayerEndedCount(expectedPlayerEndedCount: Int): ExoPlayerTestRunner.Builder!

Sets the number of times the test runner is expected to reach the STATE_ENDED or STATE_IDLE. The default is 1. This affects how long blockUntilEnded waits.

Parameters
expectedPlayerEndedCount: Int

The number of times the player is expected to reach the ended or idle state.

Returns
ExoPlayerTestRunner.Builder!

This builder.

setLoadControl

@CanIgnoreReturnValue
fun setLoadControl(loadControl: LoadControl!): ExoPlayerTestRunner.Builder!
Returns
ExoPlayerTestRunner.Builder!

This builder.

See also
setLoadControl

setManifest

@CanIgnoreReturnValue
fun setManifest(manifest: Any!): ExoPlayerTestRunner.Builder!

Sets a manifest to be used by a FakeMediaSource in the test runner. The default value is null. Setting the manifest is not allowed after a call to setMediaSources or skipSettingMediaSources.

Parameters
manifest: Any!

A manifest to be used by a FakeMediaSource in the test runner.

Returns
ExoPlayerTestRunner.Builder!

This builder.

setMediaSources

@CanIgnoreReturnValue
fun setMediaSources(mediaSources: Array<MediaSource!>!): ExoPlayerTestRunner.Builder!

Sets the MediaSources to be used by the test runner. The default value is a with the timeline and manifest provided by setTimeline and setManifest. Setting media sources is not allowed after calls to skipSettingMediaSources, setTimeline and/or setManifest.

Parameters
mediaSources: Array<MediaSource!>!

The MediaSources to be used by the test runner.

Returns
ExoPlayerTestRunner.Builder!

This builder.

setPauseAtEndOfMediaItems

@CanIgnoreReturnValue
fun setPauseAtEndOfMediaItems(pauseAtEndOfMediaItems: Boolean): ExoPlayerTestRunner.Builder!

Sets whether to enable pausing at the end of media items.

Parameters
pauseAtEndOfMediaItems: Boolean

Whether to pause at the end of media items.

Returns
ExoPlayerTestRunner.Builder!

This builder.

setPlayerListener

@CanIgnoreReturnValue
fun setPlayerListener(playerListener: Player.Listener!): ExoPlayerTestRunner.Builder!

Sets an Player.Listener to be registered to listen to player events.

Parameters
playerListener: Player.Listener!

A Player.Listener to be registered by the test runner to listen to player events.

Returns
ExoPlayerTestRunner.Builder!

This builder.

setRenderers

@CanIgnoreReturnValue
fun setRenderers(renderers: Array<Renderer!>!): ExoPlayerTestRunner.Builder!
Returns
ExoPlayerTestRunner.Builder!

This builder.

See also
setRenderers

setRenderersFactory

@CanIgnoreReturnValue
fun setRenderersFactory(renderersFactory: RenderersFactory!): ExoPlayerTestRunner.Builder!
Returns
ExoPlayerTestRunner.Builder!

This builder.

setSupportedFormats

@CanIgnoreReturnValue
fun setSupportedFormats(supportedFormats: Array<Format!>!): ExoPlayerTestRunner.Builder!

Sets a list of Formats to be used by a FakeMediaSource to create media periods. The default value is a single VIDEO_FORMAT. Note that this parameter doesn't have any influence if a media source with setMediaSources is set.

Parameters
supportedFormats: Array<Format!>!

A list of supported Formats.

Returns
ExoPlayerTestRunner.Builder!

This builder.

setTimeline

@CanIgnoreReturnValue
fun setTimeline(timeline: Timeline!): ExoPlayerTestRunner.Builder!

Sets a Timeline to be used by a FakeMediaSource in the test runner. The default value is a seekable, non-dynamic FakeTimeline with a duration of DEFAULT_WINDOW_DURATION_US. Setting the timeline is not allowed after a call to setMediaSources or skipSettingMediaSources.

Parameters
timeline: Timeline!

A Timeline to be used by a FakeMediaSource in the test runner.

Returns
ExoPlayerTestRunner.Builder!

This builder.

setUseLazyPreparation

@CanIgnoreReturnValue
fun setUseLazyPreparation(useLazyPreparation: Boolean): ExoPlayerTestRunner.Builder!
Returns
ExoPlayerTestRunner.Builder!

This builder.

setVideoSurface

@CanIgnoreReturnValue
fun setVideoSurface(surface: Surface!): ExoPlayerTestRunner.Builder!

Sets the video Surface. The default value is null.

Parameters
surface: Surface!

The Surface to be used by the player.

Returns
ExoPlayerTestRunner.Builder!

This builder.

skipSettingMediaSources

@CanIgnoreReturnValue
fun skipSettingMediaSources(): ExoPlayerTestRunner.Builder!

Skips calling setMediaSources before preparing. Calling this method is not allowed after calls to setMediaSources, setTimeline and/or setManifest.

Returns
ExoPlayerTestRunner.Builder!

This builder.