startLocalAudio abstract method
- TRTCAudioQuality quality
Enable local audio capturing and publishing
The SDK does not enable the mic by default. When a user wants to publish the local audio, the user needs to call this API to enable mic capturing and encode and publish the audio to the current room.
After local audio capturing and publishing is enabled, other users in the room will receive the TRTCCloudListener.onUserAudioAvailable notification indicating that the user's audio is available.
Parameters:
- quality(TRTCAudioQuality):
- Sound quality:
- TRTCAudioQuality.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.
- TRTCAudioQuality.defaultMode : 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.
- TRTCAudioQuality.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 online karaoke and music live streaming.
- Sound quality:
Note: This API will check the mic permission. If the current application does not have permission to use the mic, the SDK will automatically ask the user to grant the mic permission.
Implementation
void startLocalAudio(TRTCAudioQuality quality);