VideoPlayer

A player over an EditComposition.

Implemented by filmstrip, never by a consumer. State, events and the playhead come in a coroutine form and a listener form, so a caller without coroutines loses nothing.

Properties

Link copied to clipboard

Edge facts, delivered losslessly to keeping-up collectors, with no replay.

Link copied to clipboard
abstract val features: PlayerFeatures

What this backend can do on this device.

Link copied to clipboard
abstract val nativePlayer: Any?

The platform player underneath, or null when no backend is attached.

Link copied to clipboard

What the preview is actually delivering, including its parity and per-property fidelity.

Link copied to clipboard

Reads rendered preview frames back, post-effects and pre-encode.

Link copied to clipboard
abstract val state: StateFlow<PlayerState>

Serialised, in-order, internally consistent snapshots. Never torn across axes.

Functions

Link copied to clipboard

Observes events without coroutines.

Link copied to clipboard

Observes the playhead without coroutines, at most once per tick.

Link copied to clipboard

Observes state without coroutines.

Link copied to clipboard
abstract fun beginScrub()

Enters scrubbing mode, where seek accuracy may relax to keep up with a moving finger.

Link copied to clipboard
abstract override fun close()

Releases every resource. Idempotent, and nothing may be called afterwards.

Link copied to clipboard
abstract fun currentPosition(): Duration

Reads the playhead.

Link copied to clipboard
abstract fun endScrub()

Leaves scrubbing mode and settles on an exact frame.

Link copied to clipboard
abstract fun pause()

Pauses playback, holding the current position.

Link copied to clipboard
abstract fun play()

Starts playback, or resumes it.

Link copied to clipboard
abstract fun positionFlow(tick: Duration): Flow<Duration>

Observes the playhead as a cold flow.

Link copied to clipboard
abstract fun seekTo(position: Duration, accuracy: SeekAccuracy = SeekAccuracy.Exact)

Seeks to position.

Link copied to clipboard

The callback form of setComposition, for callers without coroutines.

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

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

Link copied to clipboard
abstract fun setExportSpec(spec: ExportSpec)

Sets the export this preview stands in for, so it renders at the HDR grade spec resolves to.

Link copied to clipboard
abstract fun setLoopRange(range: TimeRange?)

Loops within range, or plays straight through when null.

Link copied to clipboard
abstract fun setPlaybackRange(range: TimeRange?)

Restricts playback to range, or to the whole composition when null.

Link copied to clipboard

Sets how hard the preview may work.

Link copied to clipboard
abstract fun setVolume(volume: Float)

Sets monitor volume in 0f..1f.

Link copied to clipboard
abstract fun stepFrames(frames: Int = 1)

Steps by whole frames, forwards for a positive count and backwards for a negative one.