MediaSurfaceBinder

class MediaSurfaceBinder(logger: Logger = defaultLogger)

A bindable handle for a MediaSurface. A view binds the surface it hosts via bind (and detaches it via unbind); the MediaManager — obtained from a MediaPlayer.surfaceBinder — observes the bound surface and renders video onto it. The view drives binding directly, so no host lifecycle awareness is involved.

Parameters

logger

the Logger used to warn when bind replaces an already-bound surface. Defaults to defaultLogger.

Constructors

Link copied to clipboard
constructor(logger: Logger = defaultLogger)

Functions

Link copied to clipboard
fun bind(surface: MediaSurface)

Binds surface so the video component renders onto it. Only one surface can be bound at a time; binding while another surface is still bound replaces it and logs a warning, as it usually means a second view bound to the same binder without the first one unbinding.

Link copied to clipboard
fun unbind()

Detaches the currently bound MediaSurface, if any.