@UnstableApi
class PlaybackState


A general-purpose, read-only state holder that observes and exposes the core playback states of a Player reactively for Compose UIs.

This state is decoupled from any specific UI component and is ideal for driving overlays, shimmers, or custom control layouts.

Summary

Public constructors

Public functions

suspend Nothing?

Subscribes to updates from Player.Events and listens to:

Public properties

Boolean

Whether the player is actively playing.

Boolean

Whether the player should play when ready.

Int

The raw @Player.State of the player.

Int

The reason why playback is suppressed even if playWhenReady is true, or Player.PLAYBACK_SUPPRESSION_REASON_NONE if playback is not suppressed.

PlaybackException?

The last error that caused playback to fail, or null if there is no error.

Public constructors

PlaybackState

PlaybackState(player: Player?)

Public functions

observe

suspend fun observe(): Nothing?

Subscribes to updates from Player.Events and listens to:

Public properties

isPlaying

val isPlaying: Boolean

Whether the player is actively playing.

playWhenReady

val playWhenReady: Boolean

Whether the player should play when ready.

playbackState

val playbackState: Int

The raw @Player.State of the player.

playbackSuppressionReason

val playbackSuppressionReason: Int

The reason why playback is suppressed even if playWhenReady is true, or Player.PLAYBACK_SUPPRESSION_REASON_NONE if playback is not suppressed.

playerError

val playerError: PlaybackException?

The last error that caused playback to fail, or null if there is no error.