setAudioSource method

Future<int> setAudioSource(
  1. ZegoAudioSourceType source,
  2. {ZegoAudioSourceMixConfig? config,
  3. ZegoPublishChannel? channel}
)

Set audio capture source with audio mix config.

Available since: 3.1.0 Description: Set audio capture source for switching between different audio capture sources. Use cases: Typically used in educational scenarios that require switching between different audio capture sources. When to call: After the engine is created createEngine. Restrictions: Calling in publishing or preview is invalid when using the web platform. Caution: 1. Main push channel ZegoPublishChannel.Main does not support using ZegoAudioSourceType.MediaPlayer and ZegoAudioSourceType.MainPublishChannel audio source type. 2. When using ZegoAudioSourceType.MediaPlayer and ZegoAudioSourceType.MainPublishChannel audio source type in aux publish channel ZegoPublishChannel.Aux, must ensure that physical device works on main publish channel ZegoPublishChannel.Main. 3. Preemptive audio sources are not allowed to be used on multiple channels at the same time, such as ZegoAudioSourceType.Microphone. 4. When using ZegoAudioSourceType.MediaPlayer audio source type, please ensure that the ZegoMediaPlayer instance is created successfully.

  • source Audio capture source.
  • config Audio capture source mix config. This parameter applies only to the Main push channel ZegoPublishChannel. main. This parameter is invalid when channel is not the main push channel.
  • channel Publish stream channel.

Implementation

Future<int> setAudioSource(ZegoAudioSourceType source,
    {ZegoAudioSourceMixConfig? config, ZegoPublishChannel? channel}) async {
  return await ZegoExpressImpl.instance
      .setAudioSource(source, config: config, channel: channel);
}