# NextButtonState

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/NextButtonState.kt+class:androidx.media3.ui.compose.state.NextButtonState)

<br />

```
@UnstableApi
class NextButtonState
```

<br />

*** ** * ** ***

State that holds all interactions to correctly deal with a UI component representing a seek-to-next 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/NextButtonState#NextButtonState(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/NextButtonState#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/NextButtonState#onClick()()` Handles the interaction with the NextButton by seeking to the next MediaItem, if available, or to later position in the current MediaItem, if live. |

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

## Public constructors

### NextButtonState

```
NextButtonState(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 NextButton by seeking to the next MediaItem, if available, or to later position in the current MediaItem, if live.

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

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

## Public properties

### isEnabled

```
val isEnabled: Boolean
```

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