connectOutput

fun <P : ImageProcessor> P.connectOutput(textureView: TextureView, outputOptions: Set<ImageProcessor.Output.Option> = Collections.emptySet()): Closeable

Allows to connect TextureView as output to ImageProcessor.

fun <P : ImageProcessor> P.connectOutput(file: File, width: Int, height: Int, captureAudio: Boolean = false): Closeable

Records ImageProcessor output into the provided file. Video recording is implemented using both Android and Snap specific media frameworks. It is expected that the requested width and height dimensions are supported by the device, see android.media.MediaCodecInfo for information how to query for device media capabilities. If the dimensions are not supported then the implementation will attempt to find the best match based on device capabilities and, as a result, the final video dimensions might not match the ones provided originally.

Recording starts after calling this method, as soon as the underlying media recorder becomes available. To stop video recording, call Closeable.close on the returned Closeable.

It is expected that this method and the Closeable.close will be called on a background thread as the media recorder operations may block for significant amount of time.

Parameters

captureAudio

when True, implementation will attempt to use android.media.AudioRecord to capture device microphone audio together with video. If caller has no android.Manifest.permission.RECORD_AUDIO permission granted the recording will fail resulting in no video file being produced.