setAnsMode method

Future<int?> setAnsMode(
  1. AnsMode ansMode
)

@valid since 3.52 @detail api @author liuchuang @brief Set the Active Noise Cancellation(ANC) mode during audio and video communications. @param ansMode ANC modes. See AnsMode{@link #AnsMode}. @return - 0: Success. - < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details @note - You can call this API before or after entering a room. When you repeatedly call it, only the last call takes effect.
- The noise reduction algorithm includes both traditional noise reduction and AI noise reduction. Traditional noise reduction is primarily aimed at suppressing steady noises, such as the hum of air conditioners and the whir of fans. AI noise reduction, on the other hand, is mainly designed to suppress non-stationary noises, like the tapping of keyboards and the clattering of tables and chairs.
- The AI noise reduction can only be enabled through this interface when the following ChannelProfile{@link #ChannelProfile} scenarios are engaged:
- Gaming voice mode: CHANNEL_PROFILE_GAME(2) - High-fidelity gaming mode: CHANNEL_PROFILE_GAME_HD(8) - Cloud gaming mode: CHANNEL_PROFILE_CLOUD_GAME(3) - 1 vs 1 audio/video call: CHANNEL_PROFILE_CHAT(5) - Multi-client synchronized audio/video playback: CHANNEL_PROFILE_LW_TOGETHER(7) - Personal devices in cloud meetings: CHANNEL_PROFIEL_MEETING - Classroom interaction mode: CHANNEL_PROFILE_MEETING_ROOM(17) - Meeting room terminals in cloud meetings: CHANNEL_PROFILE_CLASSROOM(18)

Implementation

Future<int?> setAnsMode(AnsMode ansMode) async {
  $a() => ($instance as $p_a.RTCEngine)
      .setAnsMode(t_AnsMode.code_to_android(ansMode));
  $i() => ($instance as $p_i.ByteRTCEngine)
      .setAnsMode(t_AnsMode.code_to_ios(ansMode));

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}