TrackSelectionParametersState

@UnstableApi
class TrackSelectionParametersState


A state holder that exposes the current Tracks and TrackSelectionParameters of a Player as Compose state.

This state is suitable for advanced use cases where direct access to the player's track information and parameters is needed, without any additional UI abstraction.

Summary

Public constructors

Public functions

suspend Nothing?

Subscribes to updates from Player.Events and listens to Player.EVENT_TRACKS_CHANGED, Player.EVENT_TRACK_SELECTION_PARAMETERS_CHANGED, and Player.EVENT_AVAILABLE_COMMANDS_CHANGED to update the state properties.

Unit

Applies new track selection parameters to the player.

Public properties

Boolean

Whether Player.COMMAND_SET_TRACK_SELECTION_PARAMETERS is available on the player.

TrackSelectionParameters

The current TrackSelectionParameters acting on the player.

Tracks

The current Tracks available in the player.

Public constructors

TrackSelectionParametersState

TrackSelectionParametersState(player: Player?)

Public functions

observe

suspend fun observe(): Nothing?

Subscribes to updates from Player.Events and listens to Player.EVENT_TRACKS_CHANGED, Player.EVENT_TRACK_SELECTION_PARAMETERS_CHANGED, and Player.EVENT_AVAILABLE_COMMANDS_CHANGED to update the state properties.

This is a suspending function that runs indefinitely until cancelled.

updateTrackSelectionParameters

fun updateTrackSelectionParameters(params: TrackSelectionParameters): Unit

Applies new track selection parameters to the player.

Parameters
params: TrackSelectionParameters

The new TrackSelectionParameters to apply.

Public properties

canSetTrackSelectionParameters

val canSetTrackSelectionParameters: Boolean

Whether Player.COMMAND_SET_TRACK_SELECTION_PARAMETERS is available on the player.

trackSelectionParameters

val trackSelectionParameters: TrackSelectionParameters

The current TrackSelectionParameters acting on the player.

tracks

val tracks: Tracks

The current Tracks available in the player.