setRemoteVoicePosition method

  1. @override
Future<void> setRemoteVoicePosition(
  1. int uid,
  2. double pan,
  3. double gain
)

Sets the sound position of a remote user.

When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.

Note

  • For this method to work, enable stereo panning for remote users by calling the RtcEngine.enableSoundPositionIndication method before joining a channel.
  • This method requires hardware support. For the best sound positioning, we recommend using a stereo headset.

Parameter uid The ID of the remote user.

Parameter pan The sound position of the remote user. The value ranges from -1.0 to 1.0:

  • 0.0: The remote sound comes from the front.
  • -1.0: The remote sound comes from the left.
  • 1.0: The remote sound comes from the right.

Parameter gain Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain.

Implementation

@override
Future<void> setRemoteVoicePosition(int uid, double pan, double gain) {
  return _invokeMethod(
      'setRemoteVoicePosition', {'uid': uid, 'pan': pan, 'gain': gain});
}