Package com.google.android.exoplayer2.audio

## Class AudioAttributes

- java.lang.Object
- - com.google.android.exoplayer2.audio.AudioAttributes

- All Implemented Interfaces:
    `Bundleable`

      public final class AudioAttributes
      extends Object
      implements Bundleable

  Attributes for audio playback, which configure the underlying platform `AudioTrack`.

  To set the audio attributes, create an instance using the `AudioAttributes.Builder` and either pass it to the player or send a message of type `Renderer#MSG_SET_AUDIO_ATTRIBUTES` to the audio renderers.

  This class is based on `AudioAttributes`, but can be used on all supported API versions.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `AudioAttributes.Builder` | Builder for `AudioAttributes`.

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

      `Bundleable.Creator<T extends Bundleable>`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `int` | `allowedCapturePolicy` |
    `int` | `contentType` |
    `static Bundleable.Creator<AudioAttributes>` | `CREATOR` | Object that can restore `AudioAttributes` from a `Bundle`.
    `static AudioAttributes` | `DEFAULT` |
    `int` | `flags` |
    `int` | `usage` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object obj)` |
    `AudioAttributes` | `getAudioAttributesV21()` | Returns a `AudioAttributes` from this instance.
    `int` | `hashCode()` |
    `Bundle` | `toBundle()` | Returns a `Bundle` representing the information stored in this object.

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

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

- - ### Field Detail

    - #### DEFAULT

          public static final AudioAttributes DEFAULT

    - #### contentType

          @AudioContentType
          public final int contentType

    - #### flags

          @AudioFlags
          public final int flags

    - #### usage

          @AudioUsage
          public final int usage

    - #### allowedCapturePolicy

          @AudioAllowedCapturePolicy
          public final int allowedCapturePolicy

    - #### CREATOR

          public static final Bundleable.Creator<AudioAttributes> CREATOR

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

  - ### Method Detail

    - #### getAudioAttributesV21

          @RequiresApi(21)
          public AudioAttributes getAudioAttributesV21()

      Returns a `AudioAttributes` from this instance.

      Field `allowedCapturePolicy` is ignored for API levels prior to 29.

    - #### equals

          public boolean equals​(@Nullable
                                Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` 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`