enableAudioReceive method

Future<int?> enableAudioReceive(
  1. string userId,
  2. bool enable
)

@detail api @author luomingkang @brief Whether to receive the audio stream of a specific user. Call this insterface will not affect the state of the speaker or other audio output devices. @param userId User ID, a non-empty string with a maximum length of 128 bytes. The supported character set range is: 1. 26 capital letters A ~ Z 2. 26 lowercase letters a ~ z 3. 10 numbers 0 ~ 9 4. Underscore "_", at sign "@", minus sign "-" @param enable - true:Receive the user's audio stream. - false:Default setting. Do not receive the user's audio stream. The speaker will not be muted and can still be used for other audio outputs. @return - 0: Success. - -2: Failure. The provided userId is an empty string.

Implementation

Future<int?> enableAudioReceive(string userId, bool enable) async {
  $a() => ($instance as $p_a.IGameRoom).enableAudioReceive(userId, enable);
  $i() =>
      ($instance as $p_i.ByteRTCGameRoom).enableAudioReceive(userId, enable);

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