# PlaybackParameters

# PlaybackParameters

Artifact:[androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3)  
[View Source](https://cs.android.com/search?q=file:androidx/media3/common/PlaybackParameters.java+class:androidx.media3.common.PlaybackParameters)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/common/PlaybackParameters "View this page in Java")

<br />

```
class PlaybackParameters
```

<br />

*** ** * ** ***

Parameters that apply to playback, including speed setting.

## Summary

|                                                       ### Constants                                                       |
|---------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[PlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters)`!` | [DEFAULT](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#DEFAULT()) The default playback parameters: real-time playback with no silence skipping. |

|                                                                                                                                                                                                                                                                                                                             ### Public constructors                                                                                                                                                                                                                                                                                                                             |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#PlaybackParameters(float))`(speed: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Creates new playback parameters that set the playback speed.                                                                                                                                                                                                                                               |
| [PlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#PlaybackParameters(float,float))`(` ` speed: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`,` ` pitch: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) `)` Creates new playback parameters that set the playback speed/pitch. |

|                                                      ### Public functions                                                       |
|---------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                             | [equals](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#equals(java.lang.Object))`(obj: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)`                                                                                                                                                                                                                                                                               |
| `java-static `[PlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters)`!` | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [fromBundle](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#fromBundle(android.os.Bundle))`(bundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`!)` Restores a`PlaybackParameters`from a[Bundle](https://developer.android.com/reference/android/os/Bundle.html).                                               |
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                                                   | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [getMediaTimeUsForPlayoutTimeMs](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#getMediaTimeUsForPlayoutTimeMs(long))`(timeMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Returns the media time in microseconds that will elapse in`timeMs`milliseconds of wallclock time.                            |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                     | [hashCode](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#hashCode())`()`                                                                                                                                                                                                                                                                                                                                                                              |
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html)`!`                                                     | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [toBundle](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#toBundle())`()`                                                                                                                                                                                                                                                                     |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`                                            | [toString](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#toString())`()`                                                                                                                                                                                                                                                                                                                                                                              |
| [PlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters)`!`               | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [withPitch](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#withPitch(float))`(pitch: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Returns a copy with the given pitch. |
| [PlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters)`!`               | [withSpeed](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#withSpeed(float))`(speed: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Returns a copy with the given speed.                                                                                                          |

|                              ### Public properties                              |
|---------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [pitch](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#pitch()) The factor by which pitch will be shifted.    |
| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [speed](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters#speed()) The factor by which playback will be sped up. |

## Constants

### DEFAULT

```
const val DEFAULT: PlaybackParameters!
```

The default playback parameters: real-time playback with no silence skipping.  

## Public constructors

### PlaybackParameters

```
PlaybackParameters(speed: @FloatRange(from = 0, fromInclusive = false) Float)
```

Creates new playback parameters that set the playback speed. The pitch of audio will not be adjusted, so the effect is to time-stretch the audio.  

|                                                                                                        Parameters                                                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
| `speed: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The factor by which playback will be sped up. Must be greater than zero. |

### PlaybackParameters

```
PlaybackParameters(
    speed: @FloatRange(from = 0, fromInclusive = false) Float,
    pitch: @FloatRange(from = 0, fromInclusive = false) Float
)
```

Creates new playback parameters that set the playback speed/pitch.  

|                                                                                                        Parameters                                                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `speed: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The factor by which playback will be sped up. Must be greater than zero.                                                                                                                                                                  |
| `pitch: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The factor by which the pitch of audio will be adjusted. Must be greater than zero. Useful values are`1`(to time-stretch audio) and the same value as passed in as the`speed`(to resample audio, which is useful for slow-motion videos). |

## Public functions

### equals

```
fun equals(obj: Any?): Boolean
```  

### fromBundle

```
@UnstableApi
java-static fun fromBundle(bundle: Bundle!): PlaybackParameters!
```

Restores a`PlaybackParameters`from a[Bundle](https://developer.android.com/reference/android/os/Bundle.html).  

### getMediaTimeUsForPlayoutTimeMs

```
@UnstableApi
fun getMediaTimeUsForPlayoutTimeMs(timeMs: Long): Long
```

Returns the media time in microseconds that will elapse in`timeMs`milliseconds of wallclock time.  

|                                       Parameters                                        |
|-----------------------------------------------------------------------------------------|-------------------------------------|
| `timeMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The time to scale, in milliseconds. |

|                                    Returns                                    |
|-------------------------------------------------------------------------------|-----------------------------------|
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The scaled time, in microseconds. |

### hashCode

```
fun hashCode(): Int
```  

### toBundle

```
@UnstableApi
fun toBundle(): Bundle!
```  

### toString

```
fun toString(): String!
```  

### withPitch

```
@UnstableApi
fun withPitch(pitch: @FloatRange(from = 0, fromInclusive = false) Float): PlaybackParameters!
```

Returns a copy with the given pitch.  

|                                                                                                        Parameters                                                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------|
| `pitch: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The new pitch. Must be greater than zero. |

|                                                      Returns                                                      |
|-------------------------------------------------------------------------------------------------------------------|---------------------------------|
| [PlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters)`!` | The copied playback parameters. |

### withSpeed

```
fun withSpeed(speed: @FloatRange(from = 0, fromInclusive = false) Float): PlaybackParameters!
```

Returns a copy with the given speed.  

|                                                                                                        Parameters                                                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------|
| `speed: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The new speed. Must be greater than zero. |

|                                                      Returns                                                      |
|-------------------------------------------------------------------------------------------------------------------|---------------------------------|
| [PlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters)`!` | The copied playback parameters. |

## Public properties

### pitch

```
val pitch: Float
```

The factor by which pitch will be shifted.  

### speed

```
val speed: Float
```

The factor by which playback will be sped up.