MediaProjectionSource

class MediaProjectionSource(context: Context, mediaProjection: MediaProjection) : VideoSource

Captures display video using an authorized MediaProjection.

Attach this source with MediaMixer.attachVideo. Closing the source stops the supplied projection and releases its virtual display.

Constructors

Link copied to clipboard
constructor(context: Context, mediaProjection: MediaProjection)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The orientation of the video image.

Link copied to clipboard

Whether captured-content resize callbacks update the image orientation; defaults to true.

Link copied to clipboard
open override var surface: Surface?

The surface used as the output destination for video frames.

Link copied to clipboard
open val videoCropRect: Rect?

Valid pixels in the underlying hardware buffer, with exclusive right/bottom coordinates. Supply this when a producer crops from a nonzero origin: ImageReader can report only the cropped dimensions and lose that origin. Null uses the reader's reported crop.

Link copied to clipboard
open override var videoSize: Size

The resolution of the video frames produced by this source.

Functions

Link copied to clipboard
open suspend override fun close(): Result<Unit>

Closes the source and returns the result of releasing its capture resources.

Link copied to clipboard
open suspend override fun open(mixer: MediaMixer): Result<Unit>

Opens the source for the given mixer and returns the result of initialization.

Link copied to clipboard

Registers a listener for projection state changes.

Link copied to clipboard

Unregisters a projection state listener.