AgoraLocalSpatialAudioKit
This class calculates user positions through the SDK to implement the spatial audio effect.
This class inherits from AgoraBaseSpatialAudioKit. Before calling other APIs in this class, you need to call the sharedLocalSpatialAudioWithConfig method to initialize this class.
clearRemotePositions
Removes the spatial positions of all remote users.
- (int) clearRemotePositions;
Details
After successfully calling this method, the local user no longer hears any remote users.
After leaving the channel, to avoid wasting resources, you can also call this method to delete the spatial positions of all remote users.
Returns
- 0: Success.
- < 0: Failure.
sharedLocalSpatialAudioWithConfig
Initializes AgoraLocalSpatialAudioKit.
+ (instancetype _Nonnull)sharedLocalSpatialAudioWithConfig:(AgoraLocalSpatialAudioConfig* _Nonnull)config;
Details
- Before calling other methods of the AgoraLocalSpatialAudioKit class, you need to call this method to initialize AgoraLocalSpatialAudioKit.
- The SDK supports creating only one AgoraLocalSpatialAudioKit instance for an app.
Parameters
- config
- The configuration of AgoraLocalSpatialAudioKit. See AgoraLocalSpatialAudioConfig.
Returns
- 0: Success.
- < 0: Failure.
destroy
Destroys AgoraLocalSpatialAudioKit.
+ (void)destroy;
Details
This method releases all resources under AgoraLocalSpatialAudioKit. When the user does not need to use the spatial audio effect, you can call this method to release resources for other operations.
removeRemotePosition
Removes the spatial position of the specified remote user.
- (int) removeRemotePosition:(NSUInteger)uid;
Details
After successfully calling this method, the local user no longer hears the specified remote user.
After leaving the channel, to avoid wasting resources, you can also call this method to delete the spatial position of the specified remote user.
Parameters
- uid
- The user ID. This parameter must be the same as the user ID passed in when the user joined the channel.
Returns
- 0: Success.
- < 0: Failure.
updateRemotePosition
Updates the spatial position of the specified remote user.
- (int)updateRemotePosition:(NSUInteger)uid positionInfo:(AgoraRemoteVoicePositionInfo* _Nonnull)posInfo;
Details
After successfully calling this method, the SDK calculates the spatial audio parameters based on the relative position of the local and remote user.
Parameters
- uid
- The user ID. This parameter must be the same as the user ID passed in when the user joined the channel.
- posInfo
- The spatial position of the remote user. See AgoraRemoteVoicePositionInfo.
Returns
- 0: Success.
- < 0: Failure.
AgoraLocalSpatialAudioConfig
The configuration of AgoraLocalSpatialAudioKit.
__attribute__((visibility("default"))) @interface AgoraLocalSpatialAudioConfig : NSObject @property(assign, nonatomic) AgoraRtcEngineKit* _Nullable rtcEngine; @end
Properties
- rtcEngine
- AgoraRtcEngineKit.