AudioRecordSource

Captures PCM audio using AudioRecord.

Grant RECORD_AUDIO permission and configure capture settings before attaching this source with MediaMixer.attachAudio. The default format is 16-bit mono PCM at 44,100 Hz.

Constructors

Link copied to clipboard
constructor(context: Context)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The lazily created recorder, or null if audio recording permission has not been granted.

Link copied to clipboard

The Android audio capture source; defaults to MediaRecorder.AudioSource.CAMCORDER.

Link copied to clipboard

The input channel mask, such as AudioFormat.CHANNEL_IN_MONO.

Link copied to clipboard
open override var isMuted: Boolean

Whether captured audio is replaced with silence.

Link copied to clipboard

The capture buffer size, in bytes; computed on first access unless explicitly assigned.

Link copied to clipboard

The capture sample rate, in hertz.

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
open override fun read(track: Int): MediaBuffer

Reads audio for the given track.