PlaybackParams2.Builder

public static final class PlaybackParams2.Builder
extends Object

java.lang.Object
   ↳ androidx.media2.PlaybackParams2.Builder


The builder class that makes it easy to chain setters to create a PlaybackParams2 object.

Summary

Public constructors

PlaybackParams2.Builder()

Public methods

PlaybackParams2 build()

Takes the values of the Builder object and creates a PlaybackParams2 object.

PlaybackParams2.Builder setAudioFallbackMode(int audioFallbackMode)

Sets the audio fallback mode.

PlaybackParams2.Builder setPitch(float pitch)

Sets the pitch factor.

PlaybackParams2.Builder setSpeed(float speed)

Sets the speed factor.

Inherited methods

Public constructors

PlaybackParams2.Builder

public PlaybackParams2.Builder ()

Public methods

build

public PlaybackParams2 build ()

Takes the values of the Builder object and creates a PlaybackParams2 object.

Returns
PlaybackParams2 PlaybackParams2 object with values from the Builder.

setAudioFallbackMode

public PlaybackParams2.Builder setAudioFallbackMode (int audioFallbackMode)

Sets the audio fallback mode.

Parameters
audioFallbackMode int

Returns
PlaybackParams2.Builder this Builder instance.

setPitch

public PlaybackParams2.Builder setPitch (float pitch)

Sets the pitch factor.

Parameters
pitch float

Returns
PlaybackParams2.Builder this Builder instance.

Throws
IllegalArgumentException if the pitch is negative.

setSpeed

public PlaybackParams2.Builder setSpeed (float speed)

Sets the speed factor.

Parameters
speed float

Returns
PlaybackParams2.Builder this Builder instance.