startLocalAudioMixer
Starts local audio mixing.
virtual int startLocalAudioMixer(const LocalAudioMixerConfiguration& config) = 0;
- Since
- v4.5.0
This method supports merging multiple audio streams into one audio stream locally. For example, merging the audio streams captured from the local microphone, and that from the media player, the sound card, and the remote users into one audio stream, and then publish the merged audio stream to the channel.
- If you want to mix the locally captured audio streams, you can set publishMixedAudioTrack in ChannelMediaOptions to
true, and then publish the mixed audio stream to the channel. - If you want to mix the remote audio stream, ensure that the remote audio stream has been published in the channel and you have subcribed to the audio stream that you need to mix.
Applicable scenarios
You can enable this function in the following scenarios:
- By utilizing the local video mixing feature, the associated audio streams of the mixed video streams can be simultaneously captured and published.
- In live streaming scenarios, users can receive audio streams within the channel, mix multiple audio streams locally, and then forward the mixed audio stream to other channels.
- In online classes, teachers can mix the audio from interactions with students locally and then forward the mixed audio stream to other channels.
Call timing
You can call this method either before or after joining a channel.
Restrictions
To ensure audio quality, it is recommended that the number of audio streams to be mixed does not exceed 10.
Parameters
- config
- The configurations for mixing the lcoal audio. See LocalAudioMixerConfiguration.
Returns
- 0: Success.
- < 0: Failure.
- -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.