startLocalAudio method

Future<void> startLocalAudio(
  1. int quality

Enables local microphone capture and publishes the audio stream to the current room with the ability to set the sound quality.

This function will start mic capturing and transfer audio data to other users in the room. The SDK doesn't enable local audio capturing and upstreaming by default, and you need to call this function to enable it; otherwise, other users in the room cannot hear you.

The higher the sound quality of the anchor, the better the sound effect to the audience, but the higher the required bandwidth, so there may be lags if the bandwidth is limited.


  • TRTCCloudDef.TRTC_AUDIO_QUALITY_SPEECH, Smooth: sample rate: 16 kHz; mono channel; audio bitrate: 16 Kbps. This is suitable for audio call scenarios, such as online meeting and audio call.
  • TRTCCloudDef.TRTC_AUDIO_QUALITY_DEFAULT, Default: sample rate: 48 kHz; mono channel; audio bitrate: 50 Kbps. This is the default sound quality of the SDK and recommended if there are no special requirements.
  • TRTCCloudDef.TRTC_AUDIO_QUALITY_MUSIC, HD: sample rate: 48 kHz; dual channel + full band; audio bitrate: 128 Kbps. This is suitable for scenarios where Hi-Fi music transfer is required, such as karaoke and music live streaming.


Future<void> startLocalAudio(int quality) {
  return _cloudChannel!.invokeMethod('startLocalAudio', {"quality": quality});