TestTransformerBuilder


@UnstableApi
class TestTransformerBuilder


A builder of Transformer instances for testing with Robolectric.

Transcoding video is unsupported in Robolectric tests. In order for a Transformer test instance to succeed with video input, make sure to configure the export in such a way that video samples are transmuxed (for example by not adding any video effects).

Images are unsupported in Robolectric tests.

Summary

Public constructors

Creates a new instance.

Public functions

TestTransformerBuilder!

Adds a Transformer.Listener.

Transformer!

Builds a Transformer instance for testing with Robolectric.

TestTransformerBuilder!

Sets whether to use an MP4 edit list for trimming.

TestTransformerBuilder!

Sets whether to enable the trim optimization.

TestTransformerBuilder!

Sets the AssetLoader.Factory to use.

TestTransformerBuilder!

Sets the audio MIME type of the output.

TestTransformerBuilder!

Sets whether to enable fallback.

TestTransformerBuilder!

Sets whether Transformer should be forced to fail.

TestTransformerBuilder!

Sets the Looper that must be used for all calls to the transformer and that is used to call listeners on.

TestTransformerBuilder!

Sets the maximum delay allowed between output samples.

TestTransformerBuilder!

Sets the Muxer.Factory to use.

Public constructors

TestTransformerBuilder

TestTransformerBuilder(context: Context!)

Creates a new instance.

Public functions

addListener

@CanIgnoreReturnValue
fun addListener(listener: Transformer.Listener!): TestTransformerBuilder!

Adds a Transformer.Listener.

Parameters
listener: Transformer.Listener!

A @link Transformer.Listener}.

Returns
TestTransformerBuilder!

This builder.

See also
addListener

build

fun build(): Transformer!

Builds a Transformer instance for testing with Robolectric.

experimentalSetMp4EditListTrimEnabled

@CanIgnoreReturnValue
fun experimentalSetMp4EditListTrimEnabled(enabled: Boolean): TestTransformerBuilder!

Sets whether to use an MP4 edit list for trimming.

Parameters
enabled: Boolean

Whether to enable the trim optimization.

Returns
TestTransformerBuilder!

This builder.

experimentalSetTrimOptimizationEnabled

@CanIgnoreReturnValue
fun experimentalSetTrimOptimizationEnabled(
    trimOptimizationEnabled: Boolean
): TestTransformerBuilder!

Sets whether to enable the trim optimization.

Parameters
trimOptimizationEnabled: Boolean

Whether to enable the trim optimization.

Returns
TestTransformerBuilder!

This builder.

setAssetLoaderFactory

@CanIgnoreReturnValue
fun setAssetLoaderFactory(assetLoaderFactory: AssetLoader.Factory!): TestTransformerBuilder!

Sets the AssetLoader.Factory to use.

Parameters
assetLoaderFactory: AssetLoader.Factory!

The AssetLoader.Factory to use.

Returns
TestTransformerBuilder!

This builder.

setAudioMimeType

@CanIgnoreReturnValue
fun setAudioMimeType(audioMimeType: String!): TestTransformerBuilder!

Sets the audio MIME type of the output.

Parameters
audioMimeType: String!

The audio MIME type of the output.

Returns
TestTransformerBuilder!

This builder.

See also
setAudioMimeType

setFallbackEnabled

@CanIgnoreReturnValue
fun setFallbackEnabled(fallbackEnabled: Boolean): TestTransformerBuilder!

Sets whether to enable fallback.

The default value is false.

Parameters
fallbackEnabled: Boolean

Whether to enable fallback.

Returns
TestTransformerBuilder!

This builder.

setForceTransformerToFail

@CanIgnoreReturnValue
fun setForceTransformerToFail(forceTransformerToFail: Boolean): TestTransformerBuilder!

Sets whether Transformer should be forced to fail.

If set, transformer's onError callback will be called when transformer fails.

The default value is false.

Parameters
forceTransformerToFail: Boolean

Whether Transformer should be forced to fail.

Returns
TestTransformerBuilder!

This builder.

setLooper

@CanIgnoreReturnValue
fun setLooper(looper: Looper!): TestTransformerBuilder!

Sets the Looper that must be used for all calls to the transformer and that is used to call listeners on.

Parameters
looper: Looper!

The Looper to use.

Returns
TestTransformerBuilder!

This builder.

See also
setLooper

setMaxDelayBetweenMuxerSamplesMs

@CanIgnoreReturnValue
fun setMaxDelayBetweenMuxerSamplesMs(maxDelayBetweenMuxerSamplesMs: Long): TestTransformerBuilder!

Sets the maximum delay allowed between output samples.

Parameters
maxDelayBetweenMuxerSamplesMs: Long

The maximum delay allowed between output samples, in milliseconds.

Returns
TestTransformerBuilder!

This builder.

setMuxerFactory

@CanIgnoreReturnValue
fun setMuxerFactory(muxerFactory: Muxer.Factory!): TestTransformerBuilder!

Sets the Muxer.Factory to use.

Parameters
muxerFactory: Muxer.Factory!

The Muxer.Factory to use.

Returns
TestTransformerBuilder!

This builder.

See also
setMuxerFactory