Builder
class Builder
kotlin.Any | |
↳ | androidx.media2.player.PlaybackParams.Builder |
The builder class that makes it easy to chain setters to create a PlaybackParams
object.
Summary
Public constructors | |
---|---|
<init>() Default constructor |
|
<init>(@NonNull playbackParams: PlaybackParams) Constructs a new PlaybackParams builder using data from |
Public methods | |
---|---|
PlaybackParams |
build() Takes the values of the Builder object and creates a PlaybackParams object. |
PlaybackParams.Builder |
setAudioFallbackMode(audioFallbackMode: Int) Sets the audio fallback mode. |
PlaybackParams.Builder |
Sets the pitch factor. |
PlaybackParams.Builder |
Sets the speed factor. |
Public constructors
<init>
Builder()
Default constructor
<init>
Builder(@NonNull playbackParams: PlaybackParams)
Constructs a new PlaybackParams builder using data from playbackParams
.
Parameters | |
---|---|
playbackParams |
PlaybackParams: the non-null instance to initialize from. |
Public methods
build
@NonNull fun build(): PlaybackParams
Takes the values of the Builder object and creates a PlaybackParams object.
Return | |
---|---|
PlaybackParams |
PlaybackParams object with values from the Builder. |
setAudioFallbackMode
@NonNull fun setAudioFallbackMode(audioFallbackMode: Int): PlaybackParams.Builder
Sets the audio fallback mode.
Return | |
---|---|
PlaybackParams.Builder |
this Builder instance. |
setPitch
@NonNull fun setPitch(@FloatRange(0.0, 3.4028235E38, false) pitch: Float): PlaybackParams.Builder
Sets the pitch factor.
Return | |
---|---|
PlaybackParams.Builder |
this Builder instance. |
Exceptions | |
---|---|
IllegalArgumentException |
if the pitch is negative or zero. |
setSpeed
@NonNull fun setSpeed(@FloatRange(0.0, 3.4028235E38, false) speed: Float): PlaybackParams.Builder
Sets the speed factor.
Return | |
---|---|
PlaybackParams.Builder |
this Builder instance. |
Exceptions | |
---|---|
IllegalArgumentException |
if the speed is negative or zero. |