setComposition

abstract suspend fun setComposition(composition: EditComposition, startAt: Duration? = null, playWhenReady: Boolean = false): SetCompositionResult(source)

Loads a composition, or replaces the current one, suspending until it is presentable.

Cheap to call repeatedly with a changed value. An equal composition does nothing, a change confined to effect parameters updates the live pipeline and redraws, and only a structural change rebuilds: clips added, removed, reordered, or a trim that changes duration. Debounce structural edits so a drag-reorder issues one rebuild rather than thirty.

Return

whether the composition loaded, failed, or was superseded by a later call.

Parameters

composition

The composition to present, the same value that goes to export.

startAt

Where to start, or null to hold the current position.

playWhenReady

Whether playback should start once the composition is presentable. False leaves a playing preview playing, and only pause stops one.


The callback form of setComposition, for callers without coroutines.

Return

a handle that cancels the request.

Parameters

request

What to load, and how.

callback

Receives the outcome exactly once.