SurfaceTextureCaptureSource

SurfaceTextureCaptureSource provides a Surface which can be passed to system sources like the camera. Upon start call, the source will listen to the surface and emit any new images as VideoFrame objects to any downstream VideoSink interfaces. This class is mostly intended for composition within VideoSource implementations which will pass the created Surface to a system source, then call addVideoSink to receive the frames before transforming and passing downstream.

Inheritors

Properties

Link copied to clipboard

Content hint for downstream processing

Link copied to clipboard
abstract var minFps: Int

Setting this to a positive value will lead the source to resend previously captured frames as necessary to approximately maintain the set value.

Link copied to clipboard
abstract val surface: Surface

Surface from which any buffers submitted to will be emitted as a VideoFrame. User must call start to start listening, and stop will likewise stop listening.

Functions

Link copied to clipboard

Add a capture source observer to receive callbacks from the source on lifecycle events which can be used to trigger UI. This observer is entirely optional.

Link copied to clipboard
abstract fun addVideoSink(sink: VideoSink)

Add a video sink which will immediately begin to receive new frames.

Link copied to clipboard
abstract fun release()

Deallocate any state or resources held by this object. Not possible to reuse after call. Surface will have been released.

Link copied to clipboard

Remove a capture source observer

Link copied to clipboard
abstract fun removeVideoSink(sink: VideoSink)

Remove a video sink which will no longer receive new frames on return

Link copied to clipboard
abstract fun setMaxResolution(maxResolution: VideoResolution)

Set max resolution for video capture source DefaultCameraCaptureSource and DefaultScreenCaptureSource call this function to set max resolution for camera and screen capture

Link copied to clipboard
abstract fun start()

Start capturing on this source and emitting video frames

Link copied to clipboard
abstract fun stop()

Stop capturing on this source and cease emitting video frames