rememberFilmstripFrames

fun rememberFilmstripFrames(renderer: FrameRenderer, composition: EditComposition, positions: List<Duration>, heightPx: Int?, maxBytes: Long = FilmstripFramesDefaults.MaxBytes, overscan: Int = FilmstripFramesDefaults.Overscan, exportSpec: ExportSpec = ExportSpec()): FilmstripFrames(source)

Remembers the frames of a timeline strip over composition, and closes them when this leaves composition.

Fetching is driven by FilmstripFrames.onVisibleRange, so a strip that never reports its window never decodes anything. Requests are served one at a time, since extraction running alongside a preview contends with it for the device's decoders.

The cache is dropped whenever anything that would change a rendered frame changes: an edit that moves the pixels, or a different heightPx. An edit that changes nothing a frame is rendered from, such as a clip's gain, keeps every frame already held. A different set of positions keeps the frames whose position survives and closes the rest, so a strip being zoomed only asks for the positions it gained.

Return

State keyed to renderer, the same instance across recompositions.

Parameters

renderer

What renders the frames, usually the Filmstrip itself.

composition

The edit to render from.

positions

Where in the composition each strip item sits.

heightPx

The height to render at, in pixels. Null renders at the composition's own output height, and a height of zero or less renders nothing.

maxBytes

How many bytes of decoded frames to hold.

overscan

How many items either side of the visible ones to keep ready.

exportSpec

The export these frames stand in for, which renders them at the HDR grade that export resolves to.