PlayerEngine

A playback engine.

The extension point behind VideoPlayer. Implement it to plug in an engine, from Kotlin or from Swift, and register it with a PlayerEngineFactory. Consumers use VideoPlayer, which is the facade built on top of this.

Properties

Link copied to clipboard
abstract val features: PlayerFeatures

What this engine can do, as it finds it on this device.

Link copied to clipboard
abstract val id: String

A stable identifier for diagnostics, such as filmstrip.exoplayer.

Link copied to clipboard
abstract val nativePlayer: Any?

The platform player object, for a surface to attach itself to. Null when there is none.

Link copied to clipboard

Reads rendered frames back out of the preview pipeline. Required, not optional.

Functions

Link copied to clipboard
abstract fun addListener(listener: EngineListener): Cancellable

Registers a listener for state, events, position and preview info.

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 fun dispose()

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

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 seekTo(position: Duration, accuracy: SeekAccuracy = SeekAccuracy.Exact)

Seeks to position.

Link copied to clipboard

Loads a composition, or replaces the current one.

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.