setRemoteVoicePosition abstract method

Future<void> setRemoteVoicePosition({
  1. required int uid,
  2. required double pan,
  3. required double gain,
})

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

This method sets the 2D position and volume of a remote user, so that the local user can easily hear and identify the remote user's position. 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 this method to work, enable stereo panning for remote users by calling the enableSoundPositionIndication method before joining a channel. 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: 0.0: (Default) The remote voice comes from the front. -1.0: The remote voice comes from the left. 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.

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> setRemoteVoicePosition(
    {required int uid, required double pan, required double gain});