createMicrophoneAudioTrack

suspend fun createMicrophoneAudioTrack(encoderConfig: CustomMicrophoneTrackConfig? = null, microphoneId: String? = null, noiseConfig: NoiseConfig? = null): CustomStreamTrack

Creates a microphone track and opens the input. Pass it to createRoom as customMicrophoneTrack or to Room.unmuteMic(track); nothing is sent until it is published, and CustomStreamTrack.stop closes the microphone. There is no level API.

Failures throw a VideoSDKException and are never reported on onError: 3071 for an unknown microphoneId, 3022 when the device has no audio input, 3018 when RECORD_AUDIO is not granted.

Suspends until the input is open and throws 3024 when it will not open or record. The work runs on a background thread, so it is safe to call from the main thread. A later failure ends the track, reaching CustomStreamTrack.onEnded.

The factory never asks for RECORD_AUDIO and never waits for it: request it first with checkPermissions.

Return

the track; a failure throws instead.

Parameters

encoderConfig

the audio profile; null means CustomMicrophoneTrackConfig.SPEECH_STANDARD.

microphoneId

a getMics device id, selected when the microphone opens and again at publish; null keeps the current microphone.

noiseConfig

noise suppression, echo cancellation, AGC and high-pass overrides. Passing one at all means its values decide: a flag you leave out takes NoiseConfig's own default, and only an explicit null keeps the profile's value.

Throws

if initialize has not been called.