Package com.google.android.exoplayer2

## Class PlaybackParameters

- java.lang.Object
- - com.google.android.exoplayer2.PlaybackParameters

- All Implemented Interfaces:
    `Bundleable`

      public final class PlaybackParameters
      extends Object
      implements Bundleable

  Parameters that apply to playback, including speed setting.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Bundleable

      `Bundleable.Creator<T extends Bundleable>`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static Bundleable.Creator<PlaybackParameters>` | `CREATOR` | Object that can restore `PlaybackParameters` from a `Bundle`.
    `static PlaybackParameters` | `DEFAULT` | The default playback parameters: real-time playback with no silence skipping.
    `float` | `pitch` | The factor by which pitch will be shifted.
    `float` | `speed` | The factor by which playback will be sped up.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PlaybackParameters​(float speed)` | Creates new playback parameters that set the playback speed.
    `PlaybackParameters​(float speed, float pitch)` | Creates new playback parameters that set the playback speed/pitch.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object obj)` |
    `long` | `getMediaTimeUsForPlayoutTimeMs​(long timeMs)` | Returns the media time in microseconds that will elapse in `timeMs` milliseconds of wallclock time.
    `int` | `hashCode()` |
    `Bundle` | `toBundle()` | Returns a `Bundle` representing the information stored in this object.
    `String` | `toString()` |
    `PlaybackParameters` | `withSpeed​(float speed)` | Returns a copy with the given speed.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT

          public static final PlaybackParameters DEFAULT

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

    - #### speed

          public final float speed

      The factor by which playback will be sped up.

    - #### pitch

          public final float pitch

      The factor by which pitch will be shifted.

    - #### CREATOR

          public static final Bundleable.Creator<PlaybackParameters> CREATOR

      Object that can restore `PlaybackParameters` from a `Bundle`.

  - ### Constructor Detail

    - #### PlaybackParameters

          public PlaybackParameters​(float speed)

      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` - The factor by which playback will be sped up. Must be greater than zero.

    - #### PlaybackParameters

          public PlaybackParameters​(@FloatRange(from=0.0,fromInclusive=false)
                                    float speed,
                                    @FloatRange(from=0.0,fromInclusive=false)
                                    float pitch)

      Creates new playback parameters that set the playback speed/pitch.
      Parameters:
        `speed` - The factor by which playback will be sped up. Must be greater than zero.
        `pitch` - 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).

  - ### Method Detail

    - #### getMediaTimeUsForPlayoutTimeMs

          public long getMediaTimeUsForPlayoutTimeMs​(long timeMs)

      Returns the media time in microseconds that will elapse in `timeMs` milliseconds of wallclock time.
      Parameters:
        `timeMs` - The time to scale, in milliseconds.
      Returns:
        The scaled time, in microseconds.

    - #### withSpeed

          @CheckResult
          public PlaybackParameters withSpeed​(@FloatRange(from=0.0,fromInclusive=false)
                                              float speed)

      Returns a copy with the given speed.
      Parameters:
        `speed` - The new speed. Must be greater than zero.
      Returns:
        The copied playback parameters.

    - #### equals

          public boolean equals​(@Nullable
                                Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toBundle

          public Bundle toBundle()

      Description copied from interface: `Bundleable`
      Returns a `Bundle` representing the information stored in this object.
      Specified by:
        `toBundle` in interface `Bundleable`