# Action.SetAudioAttributes

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

*** ** * ** ***


```
public final class Action.SetAudioAttributes extends Action
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.media3.test.utils.Action](https://developer.android.com/reference/androidx/media3/test/utils/Action) ||
|   | ↳ | [androidx.media3.test.utils.Action.SetAudioAttributes](https://developer.android.com/reference/androidx/media3/test/utils/Action.SetAudioAttributes) |

*** ** * ** ***

Calls `https://developer.android.com/reference/androidx/media3/common/Player#setAudioAttributes(androidx.media3.common.AudioAttributes,boolean)`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/Action.SetAudioAttributes#SetAudioAttributes(java.lang.String,androidx.media3.common.AudioAttributes,boolean)( https://developer.android.com/reference/java/lang/String.html tag, https://developer.android.com/reference/androidx/media3/common/AudioAttributes audioAttributes, boolean handleAudioFocus )` |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/Action.SetAudioAttributes#doActionImpl(androidx.media3.exoplayer.ExoPlayer,androidx.media3.exoplayer.trackselection.DefaultTrackSelector,android.view.Surface)( https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer player, https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/DefaultTrackSelector trackSelector, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Surface.html surface )` Called by `https://developer.android.com/reference/androidx/media3/test/utils/Action#doActionAndScheduleNextImpl(androidx.media3.exoplayer.ExoPlayer,androidx.media3.exoplayer.trackselection.DefaultTrackSelector,android.view.Surface,androidx.media3.common.util.HandlerWrapper,androidx.media3.test.utils.ActionSchedule.ActionNode)` to perform the action. |

## Public constructors

### SetAudioAttributes

```
public SetAudioAttributes(
    String tag,
    AudioAttributes audioAttributes,
    boolean handleAudioFocus
)
```

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html tag` | A tag to use for logging. |
| `https://developer.android.com/reference/androidx/media3/common/AudioAttributes audioAttributes` | The attributes to use for audio playback. |
| `boolean handleAudioFocus` | True if the player should handle audio focus, false otherwise. |

## Protected methods

### doActionImpl

```
protected void doActionImpl(
    ExoPlayer player,
    DefaultTrackSelector trackSelector,
    @Nullable Surface surface
)
```

Called by `https://developer.android.com/reference/androidx/media3/test/utils/Action#doActionAndScheduleNextImpl(androidx.media3.exoplayer.ExoPlayer,androidx.media3.exoplayer.trackselection.DefaultTrackSelector,android.view.Surface,androidx.media3.common.util.HandlerWrapper,androidx.media3.test.utils.ActionSchedule.ActionNode)` to perform the action.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer player` | The player to which the action should be applied. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/DefaultTrackSelector trackSelector` | The track selector to which the action should be applied. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Surface.html surface` | The surface to use when applying actions, or `null` if no surface is needed. |