# AudioOutputProvider

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/AudioOutputProvider.java+class:androidx.media3.exoplayer.audio.AudioOutputProvider)

*** ** * ** ***


```
public interface AudioOutputProvider
```

<br />

Known direct subclasses [AudioTrackAudioOutputProvider](https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioTrackAudioOutputProvider), [ForwardingAudioOutputProvider](https://developer.android.com/reference/androidx/media3/exoplayer/audio/ForwardingAudioOutputProvider)

|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioTrackAudioOutputProvider` | A default implementation of `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/ForwardingAudioOutputProvider` | A forwarding base class that delegates all calls to the provided `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider`. |

*** ** * ** ***

A provider for `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutput` instances and for querying their support.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.ConfigurationException extends https://developer.android.com/reference/java/lang/Exception.html` Thrown when a failure occurs configuring the output. |
| `public final class https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatConfig` Configuration for an audio format and its output preferences. |
| `public final class https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatConfig.Builder` Builder for `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatConfig` instances. |
| `public final class https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatSupport` Level of support for an audio format by the provider. |
| `public final class https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatSupport.Builder` A builder to create `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatSupport` instances. |
| `public final class https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.InitializationException extends https://developer.android.com/reference/java/lang/Exception.html` Thrown when a failure occurs initializing the output. |
| `public interface https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.Listener` Listener for `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider` events. |
| `public final class https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.OutputConfig` Configuration for an `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutput`. |
| `public final class https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.OutputConfig.Builder` Builder for `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.OutputConfig` instances. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.SupportLevel` The level of support the provider has for a format. |

| ### Constants |
|---|---|
| `default static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider#FORMAT_SUPPORTED_DIRECTLY() = 2` The provider supports the format directly, without the need for internal transcoding. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider#FORMAT_SUPPORTED_WITH_TRANSCODING() = 1` The provider supports the format, but needs to transcode it internally to do so. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider#FORMAT_UNSUPPORTED() = 0` The provider does not support the format. |

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider#addListener(androidx.media3.exoplayer.audio.AudioOutputProvider.Listener)(https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.Listener listener)` Adds a `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.Listener`. |
| `abstract https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutput` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider#getAudioOutput(androidx.media3.exoplayer.audio.AudioOutputProvider.OutputConfig)(https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.OutputConfig config)` Returns an `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutput` for the given config. |
| `abstract https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatSupport` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider#getFormatSupport(androidx.media3.exoplayer.audio.AudioOutputProvider.FormatConfig)(https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatConfig formatConfig)` Returns the `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatSupport` that this provider has for a given `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatConfig`. |
| `abstract https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.OutputConfig` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider#getOutputConfig(androidx.media3.exoplayer.audio.AudioOutputProvider.FormatConfig)(https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatConfig formatConfig)` Returns the `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.OutputConfig` for the given format. |
| `default boolean` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider#hasPendingReleases()()` Returns whether there are any pending asynchronous releases of audio outputs. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider#release()()` Releases resources held by the provider. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider#removeListener(androidx.media3.exoplayer.audio.AudioOutputProvider.Listener)(https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.Listener listener)` Removes a `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.Listener`. |
| `default void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider#setClock(androidx.media3.common.util.Clock)(https://developer.android.com/reference/androidx/media3/common/util/Clock clock)` Sets the `https://developer.android.com/reference/androidx/media3/common/util/Clock` to use in the provider. |

## Constants

### FORMAT_SUPPORTED_DIRECTLY

```
default static final int FORMAT_SUPPORTED_DIRECTLY = 2
```

The provider supports the format directly, without the need for internal transcoding.

### FORMAT_SUPPORTED_WITH_TRANSCODING

```
default static final int FORMAT_SUPPORTED_WITH_TRANSCODING = 1
```

The provider supports the format, but needs to transcode it internally to do so. Internal transcoding may result in lower quality and higher CPU load in some cases.

### FORMAT_UNSUPPORTED

```
default static final int FORMAT_UNSUPPORTED = 0
```

The provider does not support the format.

## Public methods

### addListener

```
abstract void addListener(AudioOutputProvider.Listener listener)
```

Adds a `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.Listener`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.Listener listener` | The listener to add. |

### getAudioOutput

```
abstract AudioOutput getAudioOutput(AudioOutputProvider.OutputConfig config)
```

Returns an `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutput` for the given config.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.OutputConfig config` | The `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.OutputConfig`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutput` | The `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutput`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.InitializationException` |   |

### getFormatSupport

```
abstract AudioOutputProvider.FormatSupport getFormatSupport(AudioOutputProvider.FormatConfig formatConfig)
```

Returns the `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatSupport` that this provider has for a given `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatConfig`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatConfig formatConfig` | The `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatConfig`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatSupport` | The `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatSupport` for this config. |

### getOutputConfig

```
abstract AudioOutputProvider.OutputConfig getOutputConfig(AudioOutputProvider.FormatConfig formatConfig)
```

Returns the `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.OutputConfig` for the given format.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatConfig formatConfig` | The `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.FormatConfig`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.OutputConfig` | The `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.OutputConfig` for this format. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.ConfigurationException` |   |

### hasPendingReleases

```
@UnstableApi
default boolean hasPendingReleases()
```

Returns whether there are any pending asynchronous releases of audio outputs.

Implementations that release resources synchronously should return false.

### release

```
abstract void release()
```

Releases resources held by the provider.

### removeListener

```
abstract void removeListener(AudioOutputProvider.Listener listener)
```

Removes a `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.Listener`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider.Listener listener` | The listener to remove. |

### setClock

```
@UnstableApi
default void setClock(Clock clock)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/util/Clock` to use in the provider.