startAudioShare method

Future<void> startAudioShare({
  1. HMSActionResultListener? hmsActionResultListener,
  2. HMSAudioMixingMode audioMixingMode = HMSAudioMixingMode.TALK_AND_MUSIC,
})

Method to start audio share of other apps. (Android Only)

Parameter:

audioMixingMode - the modes of type HMSAudioMixingMode in which the user wants to stream.

hmsActionResultListener - hmsActionResultListener is a callback instance on which HMSActionResultListener.onSuccess and HMSActionResultListener.onException will be called.

Refer audio share guide here

Implementation

Future<void> startAudioShare(
    {HMSActionResultListener? hmsActionResultListener,
    HMSAudioMixingMode audioMixingMode =
        HMSAudioMixingMode.TALK_AND_MUSIC}) async {
  if (!Platform.isAndroid) {
    return;
  }
  var result = await PlatformService.invokeMethod(
      PlatformMethod.startAudioShare,
      arguments: {"audio_mixing_mode": audioMixingMode.name});
  if (hmsActionResultListener != null) {
    if (result == null) {
      hmsActionResultListener.onSuccess(
          methodType: HMSActionResultListenerMethod.startAudioShare);
    } else {
      hmsActionResultListener.onException(
          methodType: HMSActionResultListenerMethod.startAudioShare,
          hmsException: HMSException.fromMap(result["error"]));
    }
  }
}