PlaybackEventEffect

Collects player's events for as long as this stays in composition.

The only correct way to observe events from Compose. VideoPlayer.events replays nothing, so an event emitted while nothing is collecting is gone for good, and a hand-rolled LaunchedEffect races whatever command produced it.

A new onEvent on recomposition is swapped in without restarting the subscription, so an event cannot slip through the gap.

Parameters

player

The player to observe.

onEvent

Receives each event, on the collecting coroutine.