Skip to main content
LocalMicTrack is created by RTCEngine.getLocalMicTrack(...). Microphone capture is decoupled from joining a channel and publishing audio: the app must explicitly call startCapture(...) to open the shared microphone, then publish through RTCEngine or RTCChannel.publishLocalAudio(...). The same LocalMicTrack can be published to multiple channels. Unpublishing from one channel doesn’t stop capture; stopCapture() closes the shared data source and affects every channel still using the track.

startCapture(listener)

Opens microphone capture. Repeated calls with the same parameters are idempotent. After it succeeds, you can read the volume, receive local PCM callbacks, or publish to a channel.

stopCapture()

Closes shared microphone capture. Calling it when capture hasn’t started is idempotent.

getVolume()

Returns the real-time microphone volume in dBFS, roughly in the range [-60, 0]; returns the implementation’s silence value when not capturing.

switchMicDevice(deviceId)

Switches the microphone input device. deviceId comes from getMicDevices() and is valid only while the device stays connected; switching during capture rebuilds the recording pipeline.

getMicDevices()

Returns the capabilities of the microphone input devices currently available on the system. For fields, see Types. getMicDevices() and switchMicDevice(...) on the Engine are convenience entry points to the same shared capture module.

Local PCM callback

Registering the frame listener alone doesn’t open the microphone. For full parameters, see RTCLocalAudioFrameEvent.