rememberScrubState

Remembers the scrub protocol for player.

Return

State keyed to player, the same instance across recompositions.

Parameters

player

The player the gesture drives.


fun rememberScrubState(onSeek: (Duration) -> Unit, onBegin: () -> Unit = {}, onEnd: () -> Unit = {}): ScrubState(source)

Remembers the scrub protocol for a transport the host drives itself.

For a host seeking something other than a VideoPlayer, such as a preview it renders on its own clock. onBegin and onEnd are where a host relaxes and restores its own seek accuracy, and a host with nothing to relax leaves them out.

val scrub = rememberScrubState(onSeek = { player.seekTo(it) })

Return

State that is the same instance across recompositions, calling whichever callbacks the last composition passed.

Parameters

onSeek

Called with the position the gesture is over, on every delta.

onBegin

Called once as the gesture starts.

onEnd

Called once as the gesture ends, after the last onSeek.