setRemoteVoicePositionEx abstract method

Future<void> setRemoteVoicePositionEx({
  1. required int uid,
  2. required double pan,
  3. required double gain,
  4. required RtcConnection connection,
})

Sets the 2D position (the position on the horizontal plane) of the remote user's voice.

This method sets the voice position and volume of a remote user. When the local user calls this method to set the voice position of a remote user, the voice difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a sense of space. This method applies to massive multiplayer online games, such as Battle Royale games. For the best voice positioning, Agora recommends using a wired headset. Call this method after joining a channel.

  • uid The user ID of the remote user.
  • pan The voice position of the remote user. The value ranges from -1.0 to 1.0: -1.0: The remote voice comes from the left. 0.0: (Default) The remote voice comes from the front. 1.0: The remote voice comes from the right.
  • gain The volume of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original volume of the remote user). The smaller the value, the lower the volume.
  • connection The connection information. See RtcConnection.

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly.

Implementation

Future<void> setRemoteVoicePositionEx(
    {required int uid,
    required double pan,
    required double gain,
    required RtcConnection connection});