startAudioCapture method
@detail api
@author dixing
@brief Start internal audio capture. The default is off.
Internal audio capture refers to: capturing audio using the built-in module.
The local client will be informed via onAudioDeviceStateChanged{@link #IRTCEngineEventHandler#onAudioDeviceStateChanged} after starting audio capture by calling this API.
The remote clients in the room will be informed of the state change via onUserStartAudioCapture{@link #IRTCEngineEventHandler#onUserStartAudioCapture} after the visible user starts audio capture by calling this API.
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details
@note
- To enable a microphone without the user's permission will trigger onWarning{@link #IRTCEngineEventHandler#onWarning}.
- Call stopAudioCapture{@link #RTCEngine#stopAudioCapture} to stop the internal audio capture. Otherwise, the internal audio capture will sustain until you destroy the engine instance.
- To mute and unmute microphones, we recommend using publishStreamAudio{@link #RTCRoom#publishStreamAudio}, other than stopAudioCapture{@link #RTCEngine#stopAudioCapture} and this API. Because starting and stopping capture devices often need some time waiting for the response of the device, that may lead to a short silence during the communication.
- To switch from custom to internal audio capture, stop publishing before disabling the custom audio capture module and then call this API to enable the internal audio capture.
Implementation
Future<int?> startAudioCapture() async {
$a() => ($instance as $p_a.RTCEngine).startAudioCapture();
$i() => ($instance as $p_i.ByteRTCEngine).startAudioCapture();
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}