enableLocalAudio method
Enables/Disables the local audio capture.
The audio function is enabled by default. This method disables/re-enables the local audio function, that is, to stop or restart local audio capture and processing.
This method does not affect receiving or playing the remote audio streams, and enableLocalAudio(false) is applicable to scenarios where the user wants to receive remote audio streams without sending any audio stream to other users in the channel.
The SDK triggers the RtcEngineEventHandler.microphoneEnabled callback once the local audio function is disabled or re-enabled.
Note
- This method is different from the RtcEngine.muteLocalAudioStream method:
- RtcEngine.enableLocalAudio: Disables/Re-enables the local audio capture and processing. If you disable or re-enable local audio recording using the RtcEngine.enableLocalAudio method, the local user may hear a pause in the remote audio playback.
- RtcEngine.muteLocalAudioStream: Stops/Continues sending the local audio streams.
Parameter enabled
Sets whether to disable/re-enable the local audio function:
true
: (Default) Re-enable the local audio function, that is, to start local audio capture and processing.false
: Disable the local audio function, that is, to stop local audio capture and processing.
Implementation
@override
Future<void> enableLocalAudio(bool enabled) {
return _invokeMethod('enableLocalAudio', {'enabled': enabled});
}