startAudioCapture method
@detail api
@author dixing
@brief Starts internal audio capturing. The default is off.
Internal capture refers to audio capture using the built-in capture module of the SDK.
After this API is called, the local user will receive rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error}.
If this API is called by a visible user, the other users in the room will receive rtcEngine:onUserStartAudioCapture:info:{@link #ByteRTCEngineDelegate#rtcEngine:onUserStartAudioCapture:info}.
@return
- 0: Success.
- < 0 : Fail. See ByteRTCReturnStatus{@link #ByteRTCReturnStatus} for more details
@note
- Calling this API without obtaining permission to use the microphone of the current device will trigger rtcEngine:onWarning:{@link #ByteRTCEngineDelegate#rtcEngine:onWarning}.
- Call stopAudioCapture{@link #ByteRTCEngine#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 #ByteRTCRoom#publishStreamAudio}, other than stopAudioCapture{@link #ByteRTCEngine#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.
- Once you create the engine instance, you can start internal audio capture regardless of the audio publishing state. The audio stream will start publishing only after the audio capture starts.
- To switch from custom to internal audio capture, stop publishing before disabling the custom audio capture module by calling setAudioSourceType:{@link #ByteRTCEngine#setAudioSourceType} and then call this API to enable the internal audio capture.
Implementation
FutureOr<int> startAudioCapture() async {
return await nativeCall('startAudioCapture', []);
}