setRemoteVoicePositionEx abstract method
- required int uid,
- required double pan,
- required double gain,
- required RtcConnection connection,
Sets the 2D position of a remote user's voice, i.e., horizontal position.
Sets the spatial position and volume of a remote user's voice to help local users identify direction by sound. By calling this method, you can set the position where the remote user's voice appears. The difference between the left and right audio channels creates a sense of direction, allowing users to determine the real-time position of the remote user. In online multiplayer games, such as battle royale games, this method enhances the sense of direction of game characters and simulates real-world scenarios. For the best listening experience, it is recommended that users wear wired headphones. This method must be called after joining a channel.
uidThe ID of the remote user.panSets the spatial position of the remote user's voice. The range is-1.0, 1.0: -1.0: Voice appears on the left. (Default) 0.0: Voice appears in the center. 1.0: Voice appears on the right.gainSets the volume of the remote user's voice. The range is0.0, 100.0, and the default value is 100.0, representing the original volume of the user. The smaller the value, the lower the volume.connectionConnection 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. See Error Codes for details and resolution suggestions.
Implementation
Future<void> setRemoteVoicePositionEx(
{required int uid,
required double pan,
required double gain,
required RtcConnection connection});