# AudioSink.InitializationException

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

*** ** * ** ***


```
public final class AudioSink.InitializationException extends Exception
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [kotlin.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) |||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception.html) ||
|   |   | ↳ | [androidx.media3.exoplayer.audio.AudioSink.InitializationException](https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.InitializationException) |

*** ** * ** ***

Thrown when a failure occurs initializing the sink.

## Summary

| ### Public fields |
|---|---|
| `final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.InitializationException#audioTrackState()` The underlying `https://developer.android.com/reference/android/media/AudioTrack.html`'s state. |
| `final https://developer.android.com/reference/androidx/media3/common/Format` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.InitializationException#format()` The input `https://developer.android.com/reference/androidx/media3/common/Format` of the sink when the error occurs. |
| `final boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.InitializationException#isRecoverable()` If the exception can be recovered by recreating the sink. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.InitializationException#InitializationException(java.lang.String,int,androidx.media3.common.Format,boolean,java.lang.Throwable)( https://developer.android.com/reference/java/lang/String.html message, int audioTrackState, https://developer.android.com/reference/androidx/media3/common/Format format, boolean isRecoverable, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause )` Creates a new instance. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.InitializationException#InitializationException(int,int,int,int,int,androidx.media3.common.Format,boolean,java.lang.Exception)( int audioTrackState, int sampleRate, int channelConfig, int encoding, int bufferSize, https://developer.android.com/reference/androidx/media3/common/Format format, boolean isRecoverable, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Exception.html audioTrackException )` Creates a new instance. |

### Inherited methods

From [java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) `synchronized final void` `https://developer.android.com/reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable.html exception)` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#fillInStackTrace()()` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#getCause()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#getLocalizedMessage()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#getMessage()()` `StackTraceElement[]` `https://developer.android.com/reference/java/lang/Throwable.html#getStackTrace()()` `synchronized final Throwable[]` `https://developer.android.com/reference/java/lang/Throwable.html#getSuppressed()()` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#initCause(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable.html cause)` `void` `https://developer.android.com/reference/java/lang/Throwable.html#printStackTrace()()` `void` `https://developer.android.com/reference/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement[])(StackTraceElement[] stackTrace)` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#toString()()`

## Public fields

### audioTrackState

```
public final int audioTrackState
```

The underlying `https://developer.android.com/reference/android/media/AudioTrack.html`'s state.

### format

```
public final Format format
```

The input `https://developer.android.com/reference/androidx/media3/common/Format` of the sink when the error occurs.

### isRecoverable

```
public final boolean isRecoverable
```

If the exception can be recovered by recreating the sink.

## Public constructors

### InitializationException

```
public InitializationException(
    String message,
    int audioTrackState,
    Format format,
    boolean isRecoverable,
    @Nullable Throwable cause
)
```

Creates a new instance.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html message` | The detail message for this exception. |
| `int audioTrackState` | The underlying `https://developer.android.com/reference/android/media/AudioTrack.html`'s state. |
| `https://developer.android.com/reference/androidx/media3/common/Format format` | The input format of the sink when the error occurs. |
| `boolean isRecoverable` | Whether the exception can be recovered by recreating the sink. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause` | The `https://developer.android.com/reference/java/lang/Throwable.html` of this exception. |

### InitializationException

```
public InitializationException(
    int audioTrackState,
    int sampleRate,
    int channelConfig,
    int encoding,
    int bufferSize,
    Format format,
    boolean isRecoverable,
    @Nullable Exception audioTrackException
)
```

Creates a new instance.

| Parameters |
|---|---|
| `int audioTrackState` | The underlying `https://developer.android.com/reference/android/media/AudioTrack.html`'s state. |
| `int sampleRate` | The requested sample rate in Hz. |
| `int channelConfig` | The requested channel configuration. |
| `int encoding` | The requested encoding. |
| `int bufferSize` | The requested buffer size in bytes. |
| `https://developer.android.com/reference/androidx/media3/common/Format format` | The input format of the sink when the error occurs. |
| `boolean isRecoverable` | Whether the exception can be recovered by recreating the sink. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Exception.html audioTrackException` | Exception thrown during the creation of the `https://developer.android.com/reference/android/media/AudioTrack.html`. |