# Action.WaitForPlaybackState

# Action.WaitForPlaybackState

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.WaitForPlaybackState)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/test/utils/Action.WaitForPlaybackState "View this page in Java")

<br />

```
class Action.WaitForPlaybackState : Action
```

<br />

|---|---|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)                                                                                    |||
| ↳ | [androidx.media3.test.utils.Action](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Action)                                              ||
|   | ↳ | [androidx.media3.test.utils.Action.WaitForPlaybackState](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Action.WaitForPlaybackState) |

*** ** * ** ***

Waits for a specified playback state, returning either immediately or after a call to[onPlaybackStateChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)).

## Summary

|                                                                                                                                                                                                                                                                               ### Public constructors                                                                                                                                                                                                                                                                                |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [WaitForPlaybackState](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Action.WaitForPlaybackState#WaitForPlaybackState(java.lang.String,int))`(` ` tag: @`[Size](https://developer.android.com/reference/kotlin/androidx/annotation/Size)`(max = 23) `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!,` ` @`[Player.State](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.State)` targetPlaybackState: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` |

|                            ### Protected functions                            |
|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [doActionImpl](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Action.WaitForPlaybackState#doActionImpl(androidx.media3.exoplayer.ExoPlayer,androidx.media3.exoplayer.trackselection.DefaultTrackSelector,android.view.Surface))`(` ` player: `[ExoPlayer](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ExoPlayer)`!,` ` trackSelector: `[DefaultTrackSelector](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/DefaultTrackSelector)`!,` ` surface: `[Surface](https://developer.android.com/reference/android/view/Surface.html)`?` `)` Called by[doActionAndScheduleNextImpl](https://developer.android.com/reference/kotlin/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

### WaitForPlaybackState

```
WaitForPlaybackState(
    tag: @Size(max = 23) String!,
    @Player.State targetPlaybackState: Int
)
```  

|                                                                                                Parameters                                                                                                |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------|
| `tag: @`[Size](https://developer.android.com/reference/kotlin/androidx/annotation/Size)`(max = 23) `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`                 | A tag to use for logging.       |
| `@`[Player.State](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.State)` targetPlaybackState: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The playback state to wait for. |

## Protected functions

### doActionImpl

```
protected fun doActionImpl(
    player: ExoPlayer!,
    trackSelector: DefaultTrackSelector!,
    surface: Surface?
): Unit
```

Called by[doActionAndScheduleNextImpl](https://developer.android.com/reference/kotlin/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                                                                        |
|----------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| `player: `[ExoPlayer](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ExoPlayer)`!`                                             | The player to which the action should be applied.                          |
| `trackSelector: `[DefaultTrackSelector](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/DefaultTrackSelector)`!` | The track selector to which the action should be applied.                  |
| `surface: `[Surface](https://developer.android.com/reference/android/view/Surface.html)`?`                                                               | The surface to use when applying actions, or`null`if no surface is needed. |