# PreviousButtonState

Artifact: [androidx.media3:media3-ui-compose](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/ui/compose/state/PreviousButtonState.kt+class:androidx.media3.ui.compose.state.PreviousButtonState)

<br />

```
@UnstableApi
class PreviousButtonState
```

<br />

*** ** * ** ***

State that holds all interactions to correctly deal with a UI component representing a seek-to-previous button.

This button has no internal state to maintain, it can only be enabled or disabled.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/PreviousButtonState#PreviousButtonState(androidx.media3.common.Player)(player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player?)` |

| ### Public functions |
|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/PreviousButtonState#observe()()` Subscribes to updates from `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Events` and listens to `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#EVENT_AVAILABLE_COMMANDS_CHANGED()` in order to determine whether the button should be enabled, i.e. respond to user input. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/PreviousButtonState#onClick()()` Handles the interaction with the PreviousButton by seeking to a later position in the current or next MediaItem (if available). |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/PreviousButtonState#isEnabled()` true if `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/PreviousButtonState#player()` is not `null` and `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS()` is available. |

## Public constructors

### PreviousButtonState

```
PreviousButtonState(player: Player?)
```

## Public functions

### observe

```
suspend fun observe(): Unit
```

Subscribes to updates from `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Events` and listens to `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#EVENT_AVAILABLE_COMMANDS_CHANGED()` in order to determine whether the button should be enabled, i.e. respond to user input.

### onClick

```
fun onClick(): Unit
```

Handles the interaction with the PreviousButton by seeking to a later position in the current or next MediaItem (if available).

This method does nothing if `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS()` is not available.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#seekToPrevious()` |   |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS()` |   |

## Public properties

### isEnabled

```
val isEnabled: Boolean
```

true if `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/PreviousButtonState#player()` is not `null` and `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS()` is available.