ScrubbingModeParameters.Builder


public final class ScrubbingModeParameters.Builder


Builder for ScrubbingModeParameters instances.

This builder defines some defaults that may change in future releases of the library, and new properties may be added that default to enabled.

Summary

Public constructors

Creates an instance.

Public methods

ScrubbingModeParameters

Returns the built ScrubbingModeParameters.

ScrubbingModeParameters.Builder

Sets which track types should be disabled in scrubbing mode.

ScrubbingModeParameters.Builder
@CanIgnoreReturnValue
setFractionalSeekTolerance(
    @Nullable @FloatRange(from = 0, to = 1) Double toleranceBefore,
    @Nullable @FloatRange(from = 0, to = 1) Double toleranceAfter
)

Sets the fraction of the media duration to use for toleranceBeforeUs and toleranceAfterUs when scrubbing.

ScrubbingModeParameters.Builder
@CanIgnoreReturnValue
setIsMediaCodecFlushEnabled(boolean isMediaCodecFlushEnabled)

Sets whether the decoder is flushed in scrubbing mode.

ScrubbingModeParameters.Builder
@CanIgnoreReturnValue
setShouldEnableDynamicScheduling(
    boolean shouldEnableDynamicScheduling
)

Sets whether ExoPlayer's dynamic scheduling should be enabled in scrubbing mode.

ScrubbingModeParameters.Builder
@CanIgnoreReturnValue
setShouldIncreaseCodecOperatingRate(
    boolean shouldIncreaseCodecOperatingRate
)

Sets whether the codec operating rate should be increased in scrubbing mode.

ScrubbingModeParameters.Builder
@CanIgnoreReturnValue
setUseDecodeOnlyFlag(boolean useDecodeOnlyFlag)

Sets whether to use BUFFER_FLAG_DECODE_ONLY in scrubbing mode.

Public constructors

Builder

public Builder()

Creates an instance.

Public methods

build

public ScrubbingModeParameters build()

Returns the built ScrubbingModeParameters.

setDisabledTrackTypes

@CanIgnoreReturnValue
public ScrubbingModeParameters.Builder setDisabledTrackTypes(Set<@C.TrackType Integer> disabledTrackTypes)

Sets which track types should be disabled in scrubbing mode.

Defaults to TRACK_TYPE_AUDIO and TRACK_TYPE_METADATA (this may change in a future release).

See disabledTrackTypes.

Parameters
Set<@C.TrackType Integer> disabledTrackTypes

The track types to disable in scrubbing mode.

Returns
ScrubbingModeParameters.Builder

This builder for convenience.

setFractionalSeekTolerance

@CanIgnoreReturnValue
public ScrubbingModeParameters.Builder setFractionalSeekTolerance(
    @Nullable @FloatRange(from = 0, to = 1) Double toleranceBefore,
    @Nullable @FloatRange(from = 0, to = 1) Double toleranceAfter
)

Sets the fraction of the media duration to use for toleranceBeforeUs and toleranceAfterUs when scrubbing.

Pass null for both values to use the player-level seek parameters when scrubbing.

Defaults to {code null} for both values, so all seeks are exact (this may change in a future release).

See fractionalSeekToleranceBefore and fractionalSeekToleranceAfter.

Parameters
@Nullable @FloatRange(from = 0, to = 1) Double toleranceBefore

The fraction of the media duration to use for toleranceBeforeUs, or null to use the player-level seek parameters.

@Nullable @FloatRange(from = 0, to = 1) Double toleranceAfter

The fraction of the media duration to use for toleranceAfterUs, or null to use the player-level seek parameters.

Returns
ScrubbingModeParameters.Builder

This builder for convenience.

setIsMediaCodecFlushEnabled

@CanIgnoreReturnValue
public ScrubbingModeParameters.Builder setIsMediaCodecFlushEnabled(boolean isMediaCodecFlushEnabled)

Sets whether the decoder is flushed in scrubbing mode.

Setting this to false will disable flushing the decoder when a new seek starts decoding from a key-frame.

Defaults to false (this may change in a future release).

Parameters
boolean isMediaCodecFlushEnabled

Whether to enable flushing of decoder in scrubbing mode.

Returns
ScrubbingModeParameters.Builder

This builder for convenience.

setShouldEnableDynamicScheduling

@CanIgnoreReturnValue
public ScrubbingModeParameters.Builder setShouldEnableDynamicScheduling(
    boolean shouldEnableDynamicScheduling
)

Sets whether ExoPlayer's dynamic scheduling should be enabled in scrubbing mode.

When used with MediaCodec in async mode, this can result in available output buffers being handled more quickly when seeking.

If dynamic scheduling is enabled for all playback in ExoPlayer.Builder (which may become the default in a future release), this method is a no-op (i.e. you cannot disable dynamic scheduling when scrubbing using this method).

Defaults to true (this may change in a future release).

Parameters
boolean shouldEnableDynamicScheduling

Whether dynamic scheduling should be enabled in scrubbing mode.

Returns
ScrubbingModeParameters.Builder

This builder for convenience.

setShouldIncreaseCodecOperatingRate

@CanIgnoreReturnValue
public ScrubbingModeParameters.Builder setShouldIncreaseCodecOperatingRate(
    boolean shouldIncreaseCodecOperatingRate
)

Sets whether the codec operating rate should be increased in scrubbing mode.

Defaults to true (this may change in a future release).

See shouldIncreaseCodecOperatingRate.

Parameters
boolean shouldIncreaseCodecOperatingRate

whether the codec operating rate should be increased in scrubbing mode.

Returns
ScrubbingModeParameters.Builder

This builder for convenience.

setUseDecodeOnlyFlag

@CanIgnoreReturnValue
public ScrubbingModeParameters.Builder setUseDecodeOnlyFlag(boolean useDecodeOnlyFlag)

Sets whether to use BUFFER_FLAG_DECODE_ONLY in scrubbing mode.

When playback is using MediaCodec on API 34+, this flag can speed up seeking by signalling that the decoded output of buffers between the previous keyframe and the target frame is not needed by the player.

If the decode-only flag is enabled (which may become the default in a future release), this method is a no-op (i.e. you cannot disable usage of the decode-only flag when scrubbing using this method).

Defaults to true (this may change in a future release).