setRemoteVoicePosition abstract method
Sets the 2D position of a remote user's voice on the horizontal plane.
Sets the 2D position and volume of a remote user's voice to help the local user determine the direction of the sound. By calling this API to set the position of the remote user's voice, the difference between the left and right audio channels creates a sense of direction, allowing you to determine the real-time position of the remote user. In multiplayer online games, such as battle royale games, this method can effectively enhance the spatial awareness of game characters and simulate real-world scenarios. You must call enableSoundPositionIndication to enable remote voice stereo before joining the channel. For the best audio experience, it is recommended to use wired headphones when using this method. This method must be called after joining the channel.
uidThe ID of the remote user.panSets the 2D position of the remote user's voice. The range is-1.0, 1.0: (Default) 0.0: Voice appears in front. -1.0: Voice appears on the left. 1.0: Voice appears on the right.gainSets the volume of the remote user's voice. The range is0.0, 100.0, with a default value of 100.0, representing the original volume of the user. The smaller the value, the lower the volume.
Returns When the method call succeeds, there is no return value; when it fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly. See Error Codes for details and resolution suggestions.
Implementation
Future<void> setRemoteVoicePosition(
{required int uid, required double pan, required double gain});