|
Agora RTC Objective-C API Reference
Refactor
|
Inherits <NSObject>.
Class Methods | |
| (instancetype _Nonnull) | + sharedEngineWithAppId:delegate: |
| (instancetype _Nonnull) | + sharedEngineWithConfig:delegate: |
| (void) | + destroy |
| (void) | + destroy: |
Properties | |
| id< AgoraRtcEngineDelegate > _Nullable | delegate |
Stream Fallback | |
| (int) | - setHighPriorityUserListEx:option:connection: |
| (int) | - setSubscribeAudioAllowlistEx:connection: |
| (int) | - setSubscribeVideoAllowlistEx:connection: |
| (NSInteger) | - takeSnapshotEx:uid:filePath: |
| (NSInteger) | - takeSnapshotExWithConfig:uid:config: |
| (int) | - sendAudioMetadataEx:metadata: |
| (int) | - enableContentInspectEx:config:connection: |
| (int) | - startRtmpStreamWithoutTranscodingEx:connection: |
| (int) | - startRtmpStreamWithTranscodingEx:transcoding:connection: |
| (int) | - updateRtmpTranscodingEx:connection: |
| (int) | - stopRtmpStreamEx:connection: |
| (int) | - startOrUpdateChannelMediaRelayEx:connection: |
| (int) | - stopChannelMediaRelayEx: |
| (int) | - pauseAllChannelMediaRelayEx: |
| (int) | - resumeAllChannelMediaRelayEx: |
| (int) | - startMediaRenderingTracingEx: |
| (int) | - setParametersEx:connection: |
| (NSString *_Nullable) | - getCallIdEx: |
| (void) | - addDelegateEx:connection: |
| (void) | - removeDelegateEx:connection: |
| (int) | - enableEncryptionEx:encryptionConfig:connection: |
Agora provides ensured quality of experience (QoE) for worldwide Internet-based voice and video communications through a virtual global network that is especially optimized for real-time web and mobile-to-mobile applications.
The AgoraRtcEngineKit class is the entry point of the Agora SDK that provides simple APIs for applications to easily start voice and video communication. Provides all methods that can be invoked by your application.
Agora provides ensured quality of experience (QoE) for worldwide Internet-based voice and video communications through a virtual global network that is especially optimized for real-time web and mobile-to-mobile applications.
AgoraRtcEngineKit is the basic interface class of Agora Native SDK. Creating an AgoraRtcEngineKit object and then calling the methods of this object enables the use of Agora Native SDK’s communication functionality.
| + (instancetype _Nonnull) sharedEngineWithAppId: | (NSString *_Nonnull) | appId | |
| delegate: | (id< AgoraRtcEngineDelegate > _Nullable) | delegate | |
Creates and initializes AgoraRtcEngineKit.
All called methods provided by the AgoraRtcEngineKit class are executed asynchronously. Agora recommends calling these methods in the same thread.
AgoraRtcEngineKit object.AgoraRtcEngineKit instance either by calling this method or by calling sharedEngineWithConfig:delegate:. The difference between sharedEngineWithConfig:delegate: and this method is that sharedEngineWithConfig:delegate: supports more configurations when creating the AgoraRtcEngineKit instance, for example, specifying the region for connection and setting the log files.AgoraRtcEngineKit instance for an app.| appId | The App ID issued by Agora for your project. Only users in apps with the same App ID can join the same channel and communicate with each other. An App ID can only be used to create one AgoraRtcEngineKit instance. To change your App ID, call destroy to destroy the current AgoraRtcEngineKit instance, and then create a new one. |
| delegate | The event handler for AgoraRtcEngineKit. See AgoraRtcEngineDelegate. |
AgoraRtcEngineKit object if the method call succeeds.AgoraRtcEngineKit object whose internal engine field is nil. You can get the error code via the delegate's rtcEngine:didOccurError: callback. | + (instancetype _Nonnull) sharedEngineWithConfig: | (AgoraRtcEngineConfig *_Nonnull) | config | |
| delegate: | (id< AgoraRtcEngineDelegate > _Nullable) | delegate | |
Creates and initializes AgoraRtcEngineKit.
You can create the AgoraRtcEngineKit instance either by calling this method or by calling sharedEngineWithAppId:delegate:. The difference between sharedEngineWithAppId:delegate: and this method is that this method supports more configurations when creating the AgoraRtcEngineKit instance, for example, specifying the region for connection and setting the log files. Call timing: Before calling other APIs, you must call this method to create the AgoraRtcEngineKit object.
AgoraRtcEngineKit instance for an app. All called methods provided by the AgoraRtcEngineKit class are executed asynchronously. Agora recommends calling these methods in the same thread.| config | Configurations for the AgoraRtcEngineKit instance. See AgoraRtcEngineConfig. |
| delegate | The event handler for AgoraRtcEngineKit. See AgoraRtcEngineDelegate. |
AgoraRtcEngineKit object if the method call succeeds.AgoraRtcEngineKit object whose internal engine field is nil. You can get the error code via the delegate's rtcEngine:didOccurError: callback. | - (int) preloadChannelByToken: | (NSString *_Nullable) | token | |
| channelId: | (NSString *_Nonnull) | channelId | |
| uid: | (NSUInteger) | uid | |
Preloads a channel with token, channelId, and uid.
When audience members need to switch between different channels frequently, calling the method can help shortening the time of joining a channel, thus reducing the time it takes for audience members to hear and see the host. If you join a preloaded channel, leave it and want to rejoin the same channel, you do not need to call this method unless the token for preloading the channel expires. Call timing: To improve the user experience of preloading channels, Agora recommends that before joining the channel, calling this method as early as possible once confirming the channel name and user information.
AgoraAudioScenarioChorus, otherwise, this method does not take effect.AgoraRtcEngineKit instance supports preloading 20 channels at most. When exceeding this limit, the latest 20 preloaded channels take effect. Failing to preload a channel does not mean that you can't join a channel, nor will it increase the time of joining a channel.| token | The token generated on your server for authentication. See .When the token for preloading channels expires, you can update the token based on the number of channels you preload.
|
| channelId | The channel name that you want to preload. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
|
| uid | The user ID. This parameter is used to identify the user in the channel for real-time audio and video interaction. You need to set and manage user IDs yourself, and ensure that each user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value range is 1 to 2^32-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user ID and rtcEngine:didJoinChannel:withUid:elapsed: returns it in the callback. Your application must record and maintain the returned user ID, because the SDK does not do so. |
AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method.| - (int) preloadChannelByTokenWithUserAccount: | (NSString *_Nullable) | token | |
| channelId: | (NSString *_Nonnull) | channelId | |
| userAccount: | (NSString *_Nonnull) | userAccount | |
Preloads a channel with token, channelId, and userAccount.
When audience members need to switch between different channels frequently, calling the method can help shortening the time of joining a channel, thus reducing the time it takes for audience members to hear and see the host. If you join a preloaded channel, leave it and want to rejoin the same channel, you do not need to call this method unless the token for preloading the channel expires. Call timing: To improve the user experience of preloading channels, Agora recommends that before joining the channel, calling this method as early as possible once confirming the channel name and user information.
AgoraAudioScenarioChorus, otherwise, this method does not take effect.AgoraRtcEngineKit instance supports preloading 20 channels at most. When exceeding this limit, the latest 20 preloaded channels take effect. Failing to preload a channel does not mean that you can't join a channel, nor will it increase the time of joining a channel.| token | The token generated on your server for authentication. See .When the token for preloading channels expires, you can update the token based on the number of channels you preload.
|
| channelId | The channel name that you want to preload. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
|
| userAccount | The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as nil. Supported characters are as follows(89 in total):
|
AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method.| - (int) updatePreloadChannelToken: | (NSString *_Nonnull) | token |
Updates the wildcard token for preloading channels.
You need to maintain the life cycle of the wildcard token by yourself. When the token expires, you need to generate a new wildcard token and then call this method to pass in the new token. Applicable scenarios: In scenarios involving multiple channels, such as switching between different channels, using a wildcard token means users do not need to apply for a new token every time joinning a new channel, which can save users time for switching channels and reduce the pressure on your token server.
| token | The new token. |
AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method. | - (int) joinChannelByToken: | (NSString *_Nullable) | token | |
| channelId: | (NSString *_Nonnull) | channelId | |
| info: | (NSString *_Nullable) | info | |
| uid: | (NSUInteger) | uid | |
| joinSuccess: | (void(^)(NSString *_Nonnull channel, NSUInteger uid, NSInteger elapsed)) | joinSuccessBlock | |
Joins a channel.
By default, the user subscribes to the audio and video streams of all the other users in the channel, giving rise to usage and billings. To stop subscribing to a specified stream or all remote streams, call the corresponding mute methods. Call timing: Call this method after sharedEngineWithConfig:delegate:. Related callbacks: A successful call of this method triggers the following callbacks:
rtcEngine:didJoinChannel:withUid:elapsed: and rtcEngine:connectionChangedToState:reason: callbacks.rtcEngine:didJoinedOfUid:elapsed: callback, if a user joining the channel in the COMMUNICATION profile, or a host joining a channel in the LIVE_BROADCASTING profile. When the connection between the local client and Agora's server is interrupted due to poor network conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins the channel, the SDK triggers the rtcEngine:didRejoinChannel:withUid:elapsed: callback on the local client.sharedEngineWithConfig:delegate: method; otherwise, you may fail to join the channel with the token.| token | The token generated on your server for authentication.Note:
|
| channelId | The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
|
| info | (Optional) Reserved for future use. |
| uid | The user ID. This parameter is used to identify the user in the channel for real-time audio and video interaction. You need to set and manage user IDs yourself, and ensure that each user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value range is 1 to 2^32-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user ID and rtcEngine:didJoinChannel:withUid:elapsed: returns it in the callback. Your application must record and maintain the returned user ID, because the SDK does not do so. |
| joinSuccessBlock | Occurs when a user joins a channel. joinSuccessBlock takes higher priority than rtcEngine:didJoinChannel:withUid:elapsed:. When both are implemented, rtcEngine:didJoinChannel:withUid:elapsed: does not take effect. Agora recommends setting joinSuccessBlock as nil to use rtcEngine:didJoinChannel:withUid:elapsed:. |
uid parameter is not set to an integer, or the value of a member in AgoraRtcChannelMediaOptions is invalid. You need to pass in a valid parameter and join the channel again.AgoraRtcEngineKit object. You need to reinitialize the AgoraRtcEngineKit object.AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method.AgoraRtcEngineKit object is wrong. The typical cause is that after calling startEchoTestWithConfig: to start a call loop test, you call this method to join the channel without calling stopEchoTest to stop the test. You need to call stopEchoTest before calling this method.rtcEngine:connectionChangedToState:reason: callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the AgoraConnectionStateDisconnected (1) state.channelId to rejoin the channel.uid to rejoin the channel. | - (int) joinChannelByToken: | (NSString *_Nullable) | token | |
| channelId: | (NSString *_Nonnull) | channelId | |
| uid: | (NSUInteger) | uid | |
| mediaOptions: | (AgoraRtcChannelMediaOptions *_Nonnull) | mediaOptions | |
| joinSuccess: | (void(^)(NSString *_Nonnull channel, NSUInteger uid, NSInteger elapsed)) | joinSuccessBlock | |
Joins a channel with media options.
Compared to joinChannelByToken:channelId:info:uid:joinSuccess:, this method has the options parameter which is used to set media options, such as whether to publish audio and video streams within a channel, or whether to automatically subscribe to the audio and video streams of all remote users when joining a channel. By default, the user subscribes to the audio and video streams of all the other users in the channel, giving rise to usage and billings. To stop subscribing to other streams, set the options parameter or call the corresponding mute methods. Call timing: Call this method after sharedEngineWithConfig:delegate:. Related callbacks: A successful call of this method triggers the following callbacks:
rtcEngine:didJoinChannel:withUid:elapsed: and rtcEngine:connectionChangedToState:reason: callbacks.rtcEngine:didJoinedOfUid:elapsed: callback, if a user joining the channel in the COMMUNICATION profile, or a host joining a channel in the LIVE_BROADCASTING profile. When the connection between the local client and Agora's server is interrupted due to poor network conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins the channel, the SDK triggers the rtcEngine:didRejoinChannel:withUid:elapsed: callback on the local client.sharedEngineWithConfig:delegate: method; otherwise, you may fail to join the channel with the token.| token | The token generated on your server for authentication.Note:
|
| channelId | The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
|
| uid | The user ID. This parameter is used to identify the user in the channel for real-time audio and video interaction. You need to set and manage user IDs yourself, and ensure that each user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value range is 1 to 2^32-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user ID and rtcEngine:didJoinChannel:withUid:elapsed: returns it in the callback. Your application must record and maintain the returned user ID, because the SDK does not do so. |
| mediaOptions | The channel media options. See AgoraRtcChannelMediaOptions. |
| joinSuccessBlock | Occurs when a user joins a channel. joinSuccessBlock takes higher priority than rtcEngine:didJoinChannel:withUid:elapsed:. When both are implemented, rtcEngine:didJoinChannel:withUid:elapsed: does not take effect. Agora recommends setting joinSuccessBlock as nil to use rtcEngine:didJoinChannel:withUid:elapsed:. |
uid parameter is not set to an integer, or the value of a member in AgoraRtcChannelMediaOptions is invalid. You need to pass in a valid parameter and join the channel again.AgoraRtcEngineKit object. You need to reinitialize the AgoraRtcEngineKit object.AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method.AgoraRtcEngineKit object is wrong. The typical cause is that after calling startEchoTestWithConfig: to start a call loop test, you call this method to join the channel without calling stopEchoTest to stop the test. You need to call stopEchoTest before calling this method.rtcEngine:connectionChangedToState:reason: callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the AgoraConnectionStateDisconnected (1) state.channelId to rejoin the channel.uid to rejoin the channel. | - (int) leaveChannel: | (void(^)(AgoraChannelStats *_Nonnull stat)) | leaveChannelBlock |
Leaves a channel.
After calling this method, the SDK terminates the audio and video interaction, leaves the current channel, and releases all resources related to the session. After joining the channel, you must call this method to end the call; otherwise, the next call cannot be started. Call timing: Call this method after joining a channel. Related callbacks: A successful call of this method triggers the following callbacks:
rtcEngine:didLeaveChannelWithStats: callback will be triggered.rtcEngine:didOfflineOfUid:reason: callback will be triggered after the remote host leaves the channel.destroy immediately after calling this method, the SDK does not trigger the rtcEngine:didLeaveChannelWithStats: callback.joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess: to join multiple channels, calling this method will leave all the channels you joined.| leaveChannelBlock | This callback indicates that a user leaves a channel, and provides the statistics of the call in AgoraChannelStats. |
| - (int) setChannelProfile: | (AgoraChannelProfile) | profile |
Sets the channel profile.
You can call this method to set the channel profile. The SDK adopts different optimization strategies for different channel profiles. For example, in a live streaming scenario, the SDK prioritizes video quality. After initializing the SDK, the default channel profile is the live streaming profile. Call timing: Call this method before joining a channel.
setDefaultAudioRouteToSpeakerphone:.| profile | The channel profile. See AgoraChannelProfile. |
| - (int) updateChannelWithMediaOptions: | (AgoraRtcChannelMediaOptions *_Nonnull) | mediaOptions |
Updates the channel media options after joining the channel.
| mediaOptions | The channel media options. See AgoraRtcChannelMediaOptions. |
AgoraRtcChannelMediaOptions is invalid. For example, the token or the user ID is invalid. You need to fill in a valid parameter.AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method.AgoraRtcEngineKit object is wrong. The possible reason is that the user is not in the channel. Agora recommends that you use the rtcEngine:connectionChangedToState:reason: callback to see whether the user is in the channel. If you receive the AgoraConnectionStateDisconnected (1) or AgoraConnectionStateFailed (5) state, the user is not in the channel. You need to call joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: to join a channel before calling this method. | - (int) setClientRole: | (AgoraClientRole) | role |
Sets the client role.
By default,the SDK sets the user role as audience. You can call this method to set the user role as host. The user role ( roles ) determines the users' permissions at the SDK level, including whether they can publish audio and video streams in a channel. Call timing: You can call this method either before or after joining a channel. If you call this method to set the user role as the host before joining the channel and set the local video property through the setupLocalVideo: method, the local video preview is automatically enabled when the user joins the channel. If you call this method to set the user role after joining a channel, the SDK will automatically call the muteLocalAudioStream: and muteLocalVideoStream: method to change the state for publishing audio and video streams. Related callbacks: If you call this method to switch the user role after joining the channel, the SDK triggers the following callbacks:
rtcEngine:didClientRoleChanged:newRole:newRoleOptions: on the local client.Note: Calling this method before joining a channel and set the role to AUDIENCE will trigger this callback as well.rtcEngine:didJoinedOfUid:elapsed: or rtcEngine:didOfflineOfUid:reason: on the remote client. If you call this method to set the user role after joining a channel but encounter a failure, the SDK trigger the rtcEngine:didClientRoleChangeFailed:currentRole: callback to report the reason for the failure and the current user role.BROADCASTER, the rtcEngine:didClientRoleChanged:newRole:newRoleOptions: callback will not be triggered on the local client. Calling this method before joining a channel and set the role to AUDIENCE will trigger this callback as well.| role | The user role. See AgoraClientRole. Note: If you set the user role as an audience member, you cannot publish audio and video streams in the channel. If you want to publish media streams in a channel during live streaming, ensure you set the user role as broadcaster. |
| - (int) setClientRole: | (AgoraClientRole) | role | |
| options: | (AgoraClientRoleOptions *_Nullable) | options | |
Sets the user role and the audience latency level in a live streaming scenario.
By default,the SDK sets the user role as audience. You can call this method to set the user role as host. The user role ( roles ) determines the users' permissions at the SDK level, including whether they can publish audio and video streams in a channel. The difference between this method and setClientRole: is that, this method supports setting the audienceLatencyLevel. audienceLatencyLevel needs to be used together with role to determine the level of service that users can enjoy within their permissions. For example, an audience member can choose to receive remote streams with low latency or ultra-low latency. Call timing: You can call this method either before or after joining a channel. If you call this method to set the user role as the host before joining the channel and set the local video property through the setupLocalVideo: method, the local video preview is automatically enabled when the user joins the channel. If you call this method to set the user role after joining a channel, the SDK will automatically call the muteLocalAudioStream: and muteLocalVideoStream: method to change the state for publishing audio and video streams. Related callbacks: If you call this method to switch the user role after joining the channel, the SDK triggers the following callbacks:
rtcEngine:didClientRoleChanged:newRole:newRoleOptions: on the local client.Note: Calling this method before joining a channel and set the role to AUDIENCE will trigger this callback as well.rtcEngine:didJoinedOfUid:elapsed: or rtcEngine:didOfflineOfUid:reason: on the remote client. If you call this method to set the user role after joining a channel but encounter a failure, the SDK trigger the rtcEngine:didClientRoleChangeFailed:currentRole: callback to report the reason for the failure and the current user role.role to BROADCASTER, the rtcEngine:didClientRoleChanged:newRole:newRoleOptions: callback will not be triggered on the local client. Calling this method before joining a channel and set the role to AUDIENCE will trigger this callback as well.| role | The user role. See AgoraClientRole. Note: If you set the user role as an audience member, you cannot publish audio and video streams in the channel. If you want to publish media streams in a channel during live streaming, ensure you set the user role as broadcaster. |
| options | The detailed options of a user, including the user level. See AgoraClientRoleOptions. |
| - (int) renewToken: | (NSString *_Nonnull) | token |
Renews the token.
This method is used to update the token. After successfully calling this method, the SDK will trigger the rtcEngine:renewTokenResult:code: callback. A token will expire after a certain period of time, at which point the SDK will be unable to establish a connection with the server. Call timing: In any of the following cases, Agora recommends that you generate a new token on your server and then call this method to renew your token:
rtcEngine:tokenPrivilegeWillExpire: callback reporting the token is about to expire.rtcEngineRequestToken: callback reporting the token has expired.rtcEngine:connectionChangedToState:reason: callback reporting AgoraConnectionChangedReasonTokenExpired (9).| token | The new token. |
AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method.| - (AgoraConnectionState) getConnectionState |
Gets the current connection state of the SDK.
Call timing: This method can be called either before or after joining the channel.
AgoraConnectionState. | - (int) startOrUpdateChannelMediaRelay: | (AgoraChannelMediaRelayConfiguration *_Nonnull) | config |
Starts relaying media streams across channels or updates channels for media relay.
The first successful call to this method starts relaying media streams from the source channel to the destination channels. To relay the media stream to other channels, or exit one of the current media relays, you can call this method again to update the destination channels. This feature supports relaying media streams to a maximum of six destination channels. After a successful method call, the SDK triggers the rtcEngine:channelMediaRelayStateDidChange:error: callback, and this callback returns the state of the media stream relay. Common states are as follows:
rtcEngine:channelMediaRelayStateDidChange:error: callback returns AgoraChannelMediaRelayStateRunning (2) and AgoraChannelMediaRelayErrorNone (0), it means that the SDK starts relaying media streams from the source channel to the destination channel.rtcEngine:channelMediaRelayStateDidChange:error: callback returns AgoraChannelMediaRelayStateFailure (3), an exception occurs during the media stream relay.technical support.| config | The configuration of the media stream relay. See AgoraChannelMediaRelayConfiguration. |
| - (int) stopChannelMediaRelay |
Stops the media stream relay. Once the relay stops, the host quits all the target channels.
After a successful method call, the SDK triggers the rtcEngine:channelMediaRelayStateDidChange:error: callback. If the callback reports AgoraChannelMediaRelayStateIdle (0) and AgoraChannelMediaRelayErrorNone (0), the host successfully stops the relay.
rtcEngine:channelMediaRelayStateDidChange:error: callback with the AgoraChannelMediaRelayErrorServerNoResponse (2) or AgoraChannelMediaRelayErrorServerConnectionLost (8) status code. You can call the leaveChannel:leaveChannelBlock: method to leave the channel, and the media stream relay automatically stops.| - (int) pauseAllChannelMediaRelay |
Pauses the media stream relay to all target channels.
After the cross-channel media stream relay starts, you can call this method to pause relaying media streams to all target channels; after the pause, if you want to resume the relay, call resumeAllChannelMediaRelay.
startOrUpdateChannelMediaRelay:.| - (int) resumeAllChannelMediaRelay |
Resumes the media stream relay to all target channels.
After calling the pauseAllChannelMediaRelay method, you can call this method to resume relaying media streams to all destination channels.
pauseAllChannelMediaRelay.| - (int) startLocalVideoTranscoder: | (AgoraLocalTranscoderConfiguration *_Nonnull) | config |
Starts the local video mixing.
After calling this method, you can merge multiple video streams into one video stream locally. For example, you can merge the video streams captured by the camera, screen sharing, media player, remote video, video files, images, etc. into one video stream, and then publish the mixed video stream to the channel. Applicable scenarios: You can enable the local video mixing function in scenarios such as remote conferences, live streaming, and online education, which allows users to view and manage multiple videos more conveniently, and supports portrait-in-picture effect and other functions. The following is a typical use case for implementing the portrait-in-picture effect:1. Call enableVirtualBackground:backData:segData:, and set the custom background image to AgoraVirtualBackgroundNone, that is, separate the portrait and the background in the video captured by the camera.
startScreenCapture: (iOS)/startScreenCapture:config: (macOS) to start capturing the screen sharing video stream.startCameraCapture:config: or startScreenCapture: (iOS)/startScreenCapture:config: (macOS).publishTranscodedVideoTrack in AgoraRtcChannelMediaOptions to YES when calling joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: or updateChannelWithMediaOptions:. Related callbacks: When you fail to call this method, the SDK triggers the rtcEngine:didLocalVideoTranscoderErrorWithStream:errorCode: callback to report the reason.| config | Configuration of the local video mixing, see AgoraLocalTranscoderConfiguration.Attention:
|
| - (int) updateLocalTranscoderConfiguration: | (AgoraLocalTranscoderConfiguration *_Nonnull) | config |
Updates the local video mixing configuration.
After calling startLocalVideoTranscoder:, call this method if you want to update the local video mixing configuration.
startCameraCapture:config: or startScreenCapture: (iOS)/ startScreenCapture:config: (macOS).| config | Configuration of the local video mixing, see AgoraLocalTranscoderConfiguration. |
| - (int) stopLocalVideoTranscoder |
Stops the local video mixing.
After calling startLocalVideoTranscoder:, call this method if you want to stop the local video mixing.
| - (int) startLocalAudioMixer: | (AgoraLocalAudioMixerConfiguration *_Nonnull) | config |
Starts local audio mixing.
This method supports merging multiple audio streams into one audio stream locally. For example, merging the audio streams captured from the local microphone, and that from the media player, the sound card, and the remote users into one audio stream, and then publish the merged audio stream to the channel.
AgoraRtcChannelMediaOptions to YES, and then publish the mixed audio stream to the channel.| config | The configurations for mixing the lcoal audio. See AgoraLocalAudioMixerConfiguration. |
AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method. | - (int) updateLocalAudioMixerConfiguration: | (AgoraLocalAudioMixerConfiguration *_Nonnull) | config |
Updates the configurations for mixing audio streams locally.
After calling startLocalAudioMixer, call this method if you want to update the local audio mixing configuration. Call timing: Call this method after startLocalAudioMixer.
| config | The configurations for mixing the lcoal audio. See AgoraLocalAudioMixerConfiguration. |
AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method. | - (int) stopLocalAudioMixer |
Stops the local audio mixing.
After calling startLocalAudioMixer, call this method if you want to stop the local audio mixing. Call timing: Call this method after startLocalAudioMixer.
AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method. | - (int) startMediaRenderingTracing |
Enables tracing the video frame rendering process.
The SDK starts tracing the rendering status of the video frames in the channel from the moment this method is successfully called and reports information about the event through the rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo: callback. Applicable scenarios: Agora recommends that you use this method in conjunction with the UI settings (such as buttons and sliders) in your app to improve the user experience. For example, call this method when the user clicks the Join Channel button, and then get the time spent during the video frame rendering process through the rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo: callback, so as to optimize the indicators accordingly.
joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: to join the channel. You can call this method at an appropriate time according to the actual application scenario to set the starting position for tracking video rendering events.AgoraRtcEngineKit is initialized. | - (int) enableInstantMediaRendering |
Enables audio and video frame instant rendering.
After successfully calling this method, the SDK enables the instant frame rendering mode, which can speed up the first frame rendering after the user joins the channel. Applicable scenarios: Agora recommends that you enable this mode for the audience in a live streaming scenario. Call timing: Call this method before joining a channel.
destroy to destroy the AgoraRtcEngineKit object.AgoraRtcEngineKit is initialized. | + (void) destroy |
Releases the AgoraRtcEngineKit instance.
This method releases all resources used by the Agora SDK. Use this method for apps in which users occasionally make voice or video calls. When users do not make calls, you can free up resources for other operations. After a successful method call, you can no longer use any method or callback in the SDK anymore. If you want to use the real-time communication functions again, you must call sharedEngineWithConfig:delegate: to create a new AgoraRtcEngineKit instance.
destroy in any callback of the SDK. Otherwise, the SDK cannot release the resources until the callbacks return results, which may result in a deadlock. | + (void) destroy: | (void(^)(void)) | engineReleasedBlock |
Destroys the AgoraRtcEngineKit instance and releases related resources.
When you no longer need real-time communication, call this method to release the AgoraRtcEngineKit instance and its related resources, so that the released resources can be used for other operations. It is recommended for scenarios where users make voice or video interactions.
| engineReleasedBlock | When the AgoraRtcEngineKit instance is destroyed, the callback is triggered to configure the synchronous or asynchronous destruction:
|
| - (int) enableAudio |
Enables the audio module.
The audio module is enabled by default After calling disableAudio to disable the audio module, you can call this method to re-enable it. Call timing: This method can be called either before or after joining the channel. It is still valid after one leaves channel.
enableLocalAudio:: Whether to enable the microphone to create the local audio stream.muteLocalAudioStream:: Whether to publish the local audio stream.muteRemoteAudioStream:mute:: Whether to subscribe and play the remote audio stream.muteAllRemoteAudioStreams:: Whether to subscribe to and play all remote audio streams.enableLocalAudio:, muteRemoteAudioStream:mute:, and muteAllRemoteAudioStreams:. Proceed it with caution.| - (int) disableAudio |
Disables the audio module.
The audio module is enabled by default, and you can call this method to disable the audio module. Call timing: This method can be called either before or after joining the channel. It is still valid after one leaves channel.
enableLocalAudio:: Whether to enable the microphone to create the local audio stream.enableLoopbackRecording:deviceName:: Whether to enable loopback audio capturing.muteLocalAudioStream:: Whether to publish the local audio stream.muteRemoteAudioStream:mute:: Whether to subscribe and play the remote audio stream.muteAllRemoteAudioStreams:: Whether to subscribe to and play all remote audio streams.| - (int) enableLocalAudio: | (BOOL) | enabled |
Enables or disables the local audio capture.
The audio function is enabled by default when users joining a channel. This method disables or re-enables the local audio function to stop or restart local audio capturing. The difference between this method and muteLocalAudioStream: are as follows:
enableLocalAudio:: Disables or re-enables the local audio capturing and processing. If you disable or re-enable local audio capturing using the enableLocalAudio: method, the local user might hear a pause in the remote audio playback.muteLocalAudioStream:: Sends or stops sending the local audio streams without affecting the audio capture status. Applicable scenarios: This method does not affect receiving the remote audio streams. enableLocalAudio: (NO) is suitable for scenarios where the user wants to receive remote audio streams without sending locally captured audio. Call timing: You can call this method either before or after joining a channel. Calling it before joining a channel only sets the device state, and it takes effect immediately after you join the channel. Related callbacks: Once the local audio function is disabled or re-enabled, the SDK triggers the rtcEngine:localAudioStateChanged:reason: callback, which reports AgoraAudioLocalStateStopped (0) or AgoraAudioLocalStateRecording (1).| enabled | - YES: (Default) Re-enable the local audio function, that is, to start the local audio capturing device (for example, the microphone).
|
| - (int) setAudioProfile: | (AgoraAudioProfile) | profile |
Sets the audio profile.
If you need to set the audio scenario, you can either call setAudioScenario:, or sharedEngineWithConfig:delegate: and set the audioScenario in AgoraRtcEngineConfig. Applicable scenarios: This method is suitable for various audio scenarios. You can choose as needed. For example, in scenarios with high audio quality requirements such as music teaching, it is recommended to set profile to AgoraAudioProfileMusicHighQuality(4). Call timing: You can call this method either before or after joining a channel.
| profile | The audio profile, including the sampling rate, bitrate, encoding mode, and the number of channels. See AgoraAudioProfile. |
| - (int) setAudioScenario: | (AgoraAudioScenario) | scenario |
Sets the audio scenario.
Applicable scenarios: This method is suitable for various audio scenarios. You can choose as needed. For example, in scenarios such as music teaching that require high sound quality, it is recommended to set scenario to AgoraAudioScenarioGameStreaming(3). Call timing: You can call this method either before or after joining a channel.
AgoraAudioScenarioGameStreaming(3). In this scenario, the SDK will switch to media volume to avoid this issue.| scenario | The audio scenarios. Under different audio scenarios, the device uses different volume types. See AgoraAudioScenario. |
| - (int) enableAudioVolumeIndication: | (NSInteger) | interval | |
| smooth: | (NSInteger) | smooth | |
| reportVad: | (BOOL) | reportVad | |
Enables the reporting of users' volume indication.
This method enables the SDK to regularly report the volume information to the app of the local user who sends a stream and remote users (three users at most) whose instantaneous volumes are the highest. Call timing: This method can be called either before or after joining the channel. Related callbacks: The SDK triggers the rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume: callback according to the interval you set if this method is successfully called and there are users publishing streams in the channel.
| interval | Sets the time interval between two consecutive volume indications:
|
| smooth | The smoothing factor that sets the sensitivity of the audio volume indicator. The value ranges between 0 and 10. The recommended value is 3. The greater the value, the more sensitive the indicator. |
| reportVad | - YES: Enables the voice activity detection of the local user. Once it is enabled, the vad parameter of the rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume: callback reports the voice activity status of the local user.
|
| - (int) adjustUserPlaybackSignalVolume: | (NSUInteger) | uid | |
| volume: | (int) | volume | |
Adjusts the playback signal volume of a specified remote user.
You can call this method to adjust the playback volume of a specified remote user. To adjust the playback volume of different remote users, call the method as many times, once for each remote user. Call timing: Call this method after joining a channel.
| uid | The user ID of the remote user. |
| volume | The volume of the user. The value range is [0,400].
|
| - (int) startRecordingDeviceTest: | (int) | indicationInterval |
Starts the audio capturing device test.
This method tests whether the audio capturing device works properly. After calling this method, the SDK triggers the rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume: callback at the time interval set in this method, which reports uid = 0 and the volume information of the capturing device. The difference between this method and the startEchoTestWithConfig: method is that the former checks if the local audio capturing device is working properly, while the latter can check the audio and video devices and network conditions.
stopRecordingDeviceTest to stop the test before joining a channel.| indicationInterval | The interval (ms) for triggering the rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume: callback. This value should be set to greater than 10, otherwise, you will not receive the rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume: callback and the SDK returns the error code -2. Agora recommends that you set this value to 100. |
| - (int) stopRecordingDeviceTest |
Stops the audio capturing device test.
This method stops the audio capturing device test. You must call this method to stop the test after calling the startRecordingDeviceTest: method.
| - (int) startPlaybackDeviceTest: | (NSString *_Nonnull) | audioFileName |
Starts the audio playback device test.
This method tests whether the audio device for local playback works properly. Once a user starts the test, the SDK plays an audio file specified by the user. If the user can hear the audio, the playback device works properly. After calling this method, the SDK triggers the rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume: callback every 100 ms, reporting uid = 1 and the volume information of the playback device. The difference between this method and the startEchoTestWithConfig: method is that the former checks if the local audio playback device is working properly, while the latter can check the audio and video devices and network conditions.
stopPlaybackDeviceTest to stop the test before joining a channel.| audioFileName | The path of the audio file. The data format is string in UTF-8.
|
| - (int) stopPlaybackDeviceTest |
Stops the audio playback device test.
This method stops the audio playback device test. You must call this method to stop the test after calling the startPlaybackDeviceTest: method.
| - (int) registerExtensionWithVendor: | (NSString *_Nonnull) | provider | |
| extension: | (NSString *_Nonnull) | extension | |
| sourceType: | (AgoraMediaSourceType) | sourceType | |
Registers an extension.
For extensions external to the SDK (such as those from Extensions Marketplace and SDK Extensions), you need to load them before calling this method. Extensions internal to the SDK (those included in the full SDK package) are automatically loaded and registered after the initialization of AgoraRtcEngineKit. Call timing: - Agora recommends you call this method after the initialization of AgoraRtcEngineKit and before joining a channel.
enableVideo or enableLocalVideo:.| provider | The name of the extension provider. |
| extension | The name of the extension. |
| sourceType | Source type of the extension. See AgoraMediaSourceType. |
| - (int) enableExtensionWithVendor: | (NSString *_Nonnull) | provider | |
| extension: | (NSString *_Nonnull) | extension | |
| enabled: | (BOOL) | enabled | |
Enable/Disable an extension. By calling this function, you can dynamically enable/disable the extension without changing the pipeline. For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A.
NOTE: For compatibility reasons, if you haven't call registerExtensionWithVendor, enableExtension will automatically register the specified extension. We suggest you call registerExtensionWithVendor explicitly.
| provider | The name of the extension provider, e.g. agora.io. |
| extension | The name of the extension, e.g. agora.beauty. |
| enabled | Whether to enable the extension:
|
| - (int) enableExtensionWithVendor: | (NSString *_Nonnull) | provider | |
| extension: | (NSString *_Nonnull) | extension | |
| enabled: | (BOOL) | enabled | |
| sourceType: | (AgoraMediaSourceType) | sourceType | |
Enables or disables extensions.
Call timing: Agora recommends that you call this method after joining a channel. Related callbacks: When this method is successfully called within the channel, it triggers onExtensionStartedWithContext: or onExtensionStoppedWithContext:.
| provider | The name of the extension provider. |
| extension | The name of the extension. |
| enabled | Whether to enable the extension:
|
| type | Source type of the extension. See AgoraMediaSourceType. |
| - (int) enableExtensionWithVendor: | (NSString *_Nonnull) | provider | |
| extension: | (NSString *_Nonnull) | extension | |
| extensionInfo: | (AgoraExtensionInfo *_Nonnull) | extensionInfo | |
| enabled: | (BOOL) | enabled | |
Enable/Disable an extension. By calling this function, you can dynamically enable/disable the extension without changing the pipeline. For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A.
NOTE: For compatibility reasons, if you haven't call registerExtensionWithVendor, enableExtension will automatically register the specified extension. We suggest you call registerExtensionWithVendor explicitly.
| provider | The name of the extension provider, e.g. agora.io. |
| extension | The name of the extension, e.g. agora.beauty. |
| extensionInfo | The information for extension definition see AgoraExtensionInfo |
| enabled | Whether to enable the extension:
|
| - (int) setExtensionProviderPropertyWithVendor: | (NSString *_Nonnull) | provider | |
| key: | (NSString *_Nonnull) | key | |
| value: | (NSString *_Nonnull) | value | |
Sets the properties of the extension provider.
You can call this method to set the attributes of the extension provider and initialize the relevant parameters according to the type of the provider. Call timing: Call this method before enableExtensionWithVendor:extension:enabled:sourceType: and after registerExtensionWithVendor:extension:sourceType:.
| provider | The name of the extension provider. |
| key | The key of the extension. |
| value | The value of the extension key. |
| - (int) setExtensionPropertyWithVendor: | (NSString *_Nonnull) | provider | |
| extension: | (NSString *_Nonnull) | extension | |
| key: | (NSString *_Nonnull) | key | |
| value: | (NSString *_Nonnull) | value | |
Sets the properties of the extension.
After enabling the extension, you can call this method to set the properties of the extension. Call timing: Call this mehtod after calling enableExtensionWithVendor:extension:enabled:sourceType:. Related callbacks: After calling this method, it may trigger the onEventWithContext:key:value: callback, and the specific triggering logic is related to the extension itself.
| provider | The name of the extension provider. |
| extension | The name of the extension. |
| key | The key of the extension. |
| value | The value of the extension key. |
| - (int) setExtensionPropertyWithVendor: | (NSString *_Nonnull) | provider | |
| extension: | (NSString *_Nonnull) | extension | |
| key: | (NSString *_Nonnull) | key | |
| value: | (NSString *_Nonnull) | value | |
| sourceType: | (AgoraMediaSourceType) | sourceType | |
Sets the properties of an extension.
| provider | The name of the extension provider, e.g. agora.io. |
| extension | The name of the extension, e.g. agora.beauty. |
| key | The key of the extension. |
| value | The JSON formatted value of the extension key. |
| sourceType | The source type of the extension, e.g. AgoraMediaSourceTypePrimaryCamera. See AgoraMediaSourceType. |
| - (int) setExtensionPropertyWithVendor: | (NSString *_Nonnull) | provider | |
| extension: | (NSString *_Nonnull) | extension | |
| extensionInfo: | (AgoraExtensionInfo *_Nonnull) | extensionInfo | |
| key: | (NSString *_Nonnull) | key | |
| value: | (NSString *_Nonnull) | value | |
Sets the properties of an extension.
| provider | The name of the extension provider, e.g. agora.io. |
| extension | The name of the extension, e.g. agora.beauty. |
| extensionInfo | The information for extension. See AgoraExtensionInfo. |
| key | The key of the extension. |
| value | The JSON formatted value of the extension key. |
| - (NSString * _Nullable) getExtensionPropertyWithVendor: | (NSString *_Nonnull) | provider | |
| extension: | (NSString *_Nonnull) | extension | |
| key: | (NSString *_Nonnull) | key | |
Gets detailed information on the extensions.
Call timing: This method can be called either before or after joining the channel.
| provider | The name of the extension provider. |
| extension | The name of the extension. |
| key | The key of the extension. |
| - (NSString * _Nullable) getExtensionPropertyWithVendor: | (NSString *_Nonnull) | provider | |
| extension: | (NSString *_Nonnull) | extension | |
| key: | (NSString *_Nonnull) | key | |
| sourceType: | (AgoraMediaSourceType) | sourceType | |
Gets detailed information on the extensions.
Call timing: This method can be called either before or after joining the channel.
| provider | The name of the extension provider. |
| extension | The name of the extension. |
| key | The key of the extension. |
| sourceType | Source type of the extension. See AgoraMediaSourceType. |
| - (NSString * _Nullable) getExtensionPropertyWithVendor: | (NSString *_Nonnull) | provider | |
| extension: | (NSString *_Nonnull) | extension | |
| extensionInfo: | (AgoraExtensionInfo *_Nonnull) | extensionInfo | |
| key: | (NSString *_Nonnull) | key | |
Gets the properties of an extension.
| provider | The name of the extension provider, e.g. agora.io. |
| extension | The name of the extension, e.g. agora.beauty. |
| extensionInfo | The information for extension. See AgoraExtensionInfo. |
| key | The key of the extension. |
| - (int) enableVideo |
Enables the video module.
The video module is disabled by default, call this method to enable it. If you need to disable the video module later, you need to call disableVideo. Call timing: This method can be called either before joining a channel or while in the channel:
rtcEngine:remoteVideoStateChangedOfUid:state:reason:elapsed: callback on the remote client.enableLocalVideo:: Whether to enable the camera to create the local video stream.muteLocalVideoStream:: Whether to publish the local video stream.muteRemoteVideoStream:mute:: Whether to subscribe to and play the remote video stream.muteAllRemoteVideoStreams:: Whether to subscribe to and play all remote video streams.enableLocalVideo:, muteRemoteVideoStream:mute:, and muteAllRemoteVideoStreams:. Proceed it with caution.| - (int) disableVideo |
Disables the video module.
This method is used to disable the video module. Call timing: This method can be called either before or after joining the channel.
enableVideo can swithch to video mode again. Related callbacks: A successful call of this method triggers the rtcEngine:didVideoEnabled:byUid: (NO) callback on the remote client.enableLocalVideo:: Whether to enable the camera to create the local video stream.muteLocalVideoStream:: Whether to publish the local video stream.muteRemoteVideoStream:mute:: Whether to subscribe to and play the remote video stream.muteAllRemoteVideoStreams:: Whether to subscribe to and play all remote video streams.| - (int) enableLocalVideo: | (BOOL) | enabled |
Enables/Disables the local video capture.
This method disables or re-enables the local video capture, and does not affect receiving the remote video stream. After calling enableVideo, the local video capture is enabled by default. If you call enableLocalVideo: (NO) to disable local video capture within the channel, it also simultaneously stops publishing the video stream within the channel. If you want to restart video catpure, you can call enableLocalVideo: (YES) and then call updateChannelWithMediaOptions: to set the options parameter to publish the locally captured video stream in the channel. After the local video capturer is successfully disabled or re-enabled, the SDK triggers the rtcEngine:remoteVideoStateChangedOfUid:state:reason:elapsed: callback on the remote client.
| enabled | Whether to enable the local video capture.
|
| - (NSArray <AgoraVideoCodecCapInfo *> *_Nullable) queryCodecCapability |
Queries the video codec capabilities of the SDK.
AgoraVideoCodecCapInfo array indicating the video encoding capability of the device, if the method call succeeds.| - (int) queryDeviceScore |
Queries device score.
Applicable scenarios: In high-definition or ultra-high-definition video scenarios, you can first call this method to query the device's score. If the returned score is low (for example, below 60), you need to lower the video resolution to avoid affecting the video experience. The minimum device score required for different business scenarios is varied. For specific score recommendations, please technical support.
| - (AgoraHDRCapability) queryHDRCapability: | (AgoraVideoModule) | videoModule |
Queries the HDR capability of the video module.
@technical preview
| - (int) setupLocalVideo: | (AgoraRtcVideoCanvas *_Nullable) | local |
Initializes the local video view.
This method initializes the video view of a local stream on the local device. It only affects the video seen by the local user and does not impact the publishing of the local video. Call this method to bind the local video stream to a video view ( view ) and to set the rendering and mirror modes of the video view. The binding remains valid after leaving the channel. To stop rendering or unbind the local video from the view, set view as nil. Applicable scenarios: After initialization, call this method to set the local video and then join the channel. In real-time interactive scenarios, if you need to simultaneously view multiple preview frames in the local video preview, and each frame is at a different observation position along the video link, you can repeatedly call this method to set different view s and set different observation positions for each view. For example, by setting the video source to the camera and then configuring two view s with position setting to AgoraVideoModulePositionPostCaptureOrigin and AgoraVideoModulePositionPostCapture, you can simultaneously preview the raw, unprocessed video frame and the video frame that has undergone preprocessing (image enhancement effects, virtual background, watermark) in the local video preview. Call timing: You can call this method either before or after joining a channel.
setLocalRenderMode:mirror: instead.| local | The local video view and settings. See AgoraRtcVideoCanvas. |
| - (int) setLocalRenderTargetFps: | (AgoraVideoSourceType) | sourceType | |
| targetFps: | (int) | targetFps | |
Sets the maximum frame rate for rendering local video.
Applicable scenarios: In scenarios where the requirements for video rendering frame rate are not high (such as screen sharing or online education), you can call this method to set the maximum frame rate for local video rendering. The SDK will attempt to keep the actual frame rate of local rendering close to this value, which helps to reduce CPU consumption and improving system performance. Call timing: You can call this method either before or after joining a channel.
| sourceType | The type of the video source. See AgoraVideoSourceType. |
| targetFps | The capture frame rate (fps) of the local video. Sopported values are: 1, 7, 10, 15, 24, 30, 60.CAUTION: Set this parameter to a value lower than the actual video frame rate; otherwise, the settings do not take effect. |
| - (int) setRemoteRenderTargetFps: | (int) | targetFps |
Sets the maximum frame rate for rendering remote video.
Applicable scenarios: In scenarios where the video rendering frame rate is not critical (e.g., screen sharing, online education) or when the remote users are using mid-to-low-end devices, you can call this method to set the maximum frame rate for video rendering on the remote client. The SDK will attempt to render the actual frame rate as close as possible to this value, which helps to reduce CPU consumption and improve system performance. Call timing: You can call this method either before or after joining a channel.
| targetFps | The capture frame rate (fps) of the local video. Sopported values are: 1, 7, 10, 15, 24, 30, 60.CAUTION: Set this parameter to a value lower than the actual video frame rate; otherwise, the settings do not take effect. |
| - (int) setLocalRenderMode: | (AgoraVideoRenderMode) | mode | |
| mirror: | (AgoraVideoMirrorMode) | mirror | |
Updates the display mode of the local video view.
After initializing the local video view, you can call this method to update its rendering and mirror modes. It affects only the video view that the local user sees and does not impact the publishing of the local video. Call timing: - Ensure that you have called the setupLocalVideo: method to initialize the local video view before calling this method.
(AgoraMediaSourceTypePrimaryCamera). In scenarios involving custom video capture or the use of alternative video sources, you need to use setupLocalVideo: instead of this method.| mode | The local video display mode. See AgoraVideoRenderMode. |
| mirror | The mirror mode of the local video view. See AgoraVideoMirrorMode. Attention: If you use a front camera, the SDK enables the mirror mode by default; if you use a rear camera, the SDK disables the mirror mode by default. |
| - (int) startPreview |
Enables the local video preview.
You can call this method to enable local video preview. Call timing: This method must be called after enableVideo and setupLocalVideo:.
stopPreview to disable local preview.| - (int) startPreview: | (AgoraVideoSourceType) | sourceType |
Enables the local video preview and specifies the video source for the preview.
This method is used to start local video preview and specify the video source that appears in the preview screen. Call timing: This method must be called after enableVideo and setupLocalVideo:.
stopPreview to disable local preview.| sourceType | The type of the video source. See AgoraVideoSourceType. |
| - (int) stopPreview |
Stops the local video preview and the video.
| - (int) stopPreview: | (AgoraVideoSourceType) | sourceType |
Stops the local video preview.
Applicable scenarios: After calling startPreview: to start the preview, if you want to stop the local video preview, call this method. Call timing: Call this method before joining a channel or after leaving a channel.
| sourceType | The type of the video source. See AgoraVideoSourceType. |
| - (int) setRemoteRenderMode: | (NSUInteger) | uid | |
| mode: | (AgoraVideoRenderMode) | mode | |
| mirror: | (AgoraVideoMirrorMode) | mirror | |
Updates the display mode of the video view of a remote user.
After initializing the video view of a remote user, you can call this method to update its rendering and mirror modes. This method affects only the video view that the local user sees.
setupRemoteVideo: method.| uid | The user ID of the remote user. |
| mode | The rendering mode of the remote user view. For details, see AgoraVideoRenderMode. |
| mirror | The mirror mode of the remote user view. See AgoraVideoMirrorMode. |
| - (int) muteLocalVideoStream: | (BOOL) | mute |
Stops or resumes publishing the local video stream.
This method is used to control whether to publish the locally captured video stream. If you call this method to stop publishing locally captured video streams, the video capturing device will still work and won't be affected. Compared to enableLocalVideo: (NO), which can also cancel the publishing of local video stream by turning off the local video stream capture, this method responds faster. Call timing: This method can be called either before or after joining the channel. Related callbacks: After successfully calling this method, the local end triggers callback rtcEngine:didVideoPublishStateChange:sourceType:oldState:newState:elapseSinceLastState:; the remote end triggers rtcEngine:didVideoMuted:byUid: and rtcEngine:remoteVideoStateChangedOfUid:state:reason:elapsed: callbacks.
| mute | Whether to stop publishing the local video stream.
|
| - (int) muteRemoteVideoStream: | (NSUInteger) | uid | |
| mute: | (BOOL) | mute | |
Stops or resumes subscribing to the video stream of a specified user.
Call timing: Call this method after joining a channel. Related callbacks: After a successful method call, the SDK triggers the rtcEngine:didVideoSubscribeStateChange:uid:oldState:newState:elapseSinceLastState: callback.
| uid | The user ID of the specified user. |
| mute | Whether to subscribe to the specified remote user's video stream.
|
| - (int) muteAllRemoteVideoStreams: | (BOOL) | mute |
Stops or resumes subscribing to the video streams of all remote users.
After successfully calling this method, the local user stops or resumes subscribing to the video streams of all remote users, including all subsequent users. Call timing: Call this method after joining a channel.
enableVideo or disableVideo, the latest call will prevail. By default, the SDK subscribes to the video streams of all remote users when joining a channel. To modify this behavior, you can set autoSubscribeVideo toNO when calling joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: to join the channel, which will cancel the subscription to the video streams of all users upon joining the channel.| mute | Whether to stop subscribing to the video streams of all remote users.
|
| - (int) setFaceShapeBeautyOptions: | (BOOL) | enable | |
| options: | (AgoraFaceShapeBeautyOptions *_Nullable) | options | |
Sets the face shape beauty options.
Calling this method allows for adjusting specific parts of the face, achieving effects such as slimming the face, enlarging the eyes, and slimming the nose through minor cosmetic procedures. Call timing: Call this method after calling enableVideo.
AgoraClearVisionExtension.xcframework (iOS) or AgoraClearVisionExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| enable | Whether to enable the face shape effect:
|
| options | Face shaping style options, see AgoraFaceShapeBeautyOptions. |
| - (int) setFaceShapeBeautyOptions: | (BOOL) | enable | |
| options: | (AgoraFaceShapeBeautyOptions *_Nullable) | options | |
| sourceType: | (AgoraMediaSourceType) | sourceType | |
Sets the face shape options and specifies the media source.
Calling this method allows for modifying various parts of the face, achieving slimming, enlarging eyes, slimming nose, and other minor cosmetic effects all at once using preset parameters, supporting fine-tuning the overall modification intensity. Both this methods and setFaceShapeBeautyOptions:options:sourceType: can be used to set beauty effects options, the difference is that this method supports specifying the media source to apply the beauty effects. Call timing: Call this method after calling enableVideo.
AgoraClearVisionExtension.xcframework (iOS) or AgoraClearVisionExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| enable | Whether to enable the face shape effect:
|
| options | Face shaping style options, see AgoraFaceShapeBeautyOptions. |
| sourceType | The type of the media source to which the filter effect is applied. See AgoraMediaSourceType.Attention: In this method, this parameter supports only the following two settings:
|
| - (AgoraFaceShapeBeautyOptions * _Nullable) getFaceShapeBeautyOptions |
Gets the beauty effect options.
Calling this method can retrieve the current settings of the beauty effect. Applicable scenarios: When the user opens the beauty style and style intensity menu in the app, you can call this method to get the current beauty effect options, then refresh the menu in the user interface according to the results, and update the UI. Call timing: Call this method after calling enableVideo.
AgoraFaceShapeBeautyOptions instance, if the method call succeeds.| - (AgoraFaceShapeBeautyOptions * _Nullable) getFaceShapeBeautyOptions: | (AgoraMediaSourceType) | sourceType |
Gets the beauty effect options.
Calling this method can retrieve the current settings of the beauty effect. Applicable scenarios: When the user opens the beauty style and style intensity menu in the app, you can call this method to get the current beauty effect options, then refresh the menu in the user interface according to the results, and update the UI. Call timing: Call this method after calling enableVideo.
| sourceType | The type of the media source to which the filter effect is applied. See AgoraMediaSourceType.Attention: In this method, this parameter supports only the following two settings:
|
AgoraFaceShapeBeautyOptions instance, if the method call succeeds.| - (int) setFaceShapeAreaOptions: | (AgoraFaceShapeAreaOptions *_Nullable) | options |
Sets the options for beauty enhancement facial areas.
If the preset beauty effects implemented in the setFaceShapeBeautyOptions:options: method do not meet expectations, you can use this method to set beauty area options, individually fine-tune each part of the face, and achieve a more refined beauty effect. Call timing: Call this method after calling setFaceShapeBeautyOptions:options: or setFaceShapeBeautyOptions:options:.
AgoraClearVisionExtension.xcframework (iOS) or AgoraClearVisionExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| options | Facial enhancement areas, see AgoraFaceShapeAreaOptions. |
| - (int) setFaceShapeAreaOptions: | (AgoraFaceShapeAreaOptions *_Nullable) | options | |
| sourceType: | (AgoraMediaSourceType) | sourceType | |
Sets the options for beauty enhancement facial areas.
If the preset beauty effects implemented in the setFaceShapeBeautyOptions:options: method do not meet expectations, you can use this method to set beauty area options, individually fine-tune each part of the face, and achieve a more refined beauty effect. Call timing: Call this method after calling setFaceShapeBeautyOptions:options: or setFaceShapeBeautyOptions:options:.
AgoraClearVisionExtension.xcframework (iOS) or AgoraClearVisionExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| options | Facial enhancement areas, see AgoraFaceShapeAreaOptions. |
| sourceType | The type of the media source to which the filter effect is applied. See AgoraMediaSourceType.Attention: In this method, this parameter supports only the following two settings:
|
| - (AgoraFaceShapeAreaOptions * _Nullable) getFaceShapeAreaOptions: | (AgoraFaceShapeArea) | area |
Gets the facial beauty area options.
Calling this method can retrieve the current settings of the beauty effect. Applicable scenarios: When the user opens the facial beauty area and shaping intensity menu in the app, you can call this method to get the current beauty effect options, then refresh the menu in the user interface according to the results, and update the UI. Call timing: Call this method after calling enableVideo.
| area | Facial enhancement areas. See AgoraFaceShapeArea. |
AgoraFaceShapeAreaOptions instance, if the method call succeeds.| - (AgoraFaceShapeAreaOptions * _Nullable) getFaceShapeAreaOptions: | (AgoraFaceShapeArea) | area | |
| sourceType: | (AgoraMediaSourceType) | sourceType | |
Gets the facial beauty area options.
Calling this method can retrieve the current settings of the beauty effect. Applicable scenarios: When the user opens the facial beauty area and shaping intensity menu in the app, you can call this method to get the current beauty effect options, then refresh the menu in the user interface according to the results, and update the UI. Call timing: Call this method after calling enableVideo.
| area | Facial enhancement areas. See AgoraFaceShapeArea. |
| sourceType | The type of the media source to which the filter effect is applied. See AgoraMediaSourceType.Attention: In this method, this parameter supports only the following two settings:
|
AgoraFaceShapeAreaOptions instance, if the method call succeeds.| - (int) setVideoDenoiserOptions: | (BOOL) | enable | |
| options: | (AgoraVideoDenoiserOptions *_Nullable) | options | |
Sets video noise reduction.
You can call this method to enable the video noise reduction feature and set the options of the video noise reduction effect. Applicable scenarios: dark environments and low-end video capture devices can cause video images to contain significant noise, which affects video quality. In real-time interactive scenarios, video noise also consumes bitstream resources and reduces encoding efficiency during encoding. Call timing: Call this method after calling enableVideo.
AgoraClearVisionExtension.xcframework (iOS) or AgoraClearVisionExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.setBeautyEffectOptions:options: method to enable the beauty and skin smoothing function to achieve better video noise reduction effects. The recommended AgoraBeautyOptions settings for intense noise reduction effect are as follows:lighteningContrastLevel AgoraLighteningContrastNormallighteningLevel: 0.0smoothnessLevel: 0.5rednessLevel: 0.0sharpnessLevel: 0.1| enable | Whether to enable video noise reduction:
|
| options | The video noise reduction options. See AgoraVideoDenoiserOptions. |
| - (int) setVideoDenoiserOptions: | (BOOL) | enable | |
| options: | (AgoraVideoDenoiserOptions *_Nullable) | options | |
| sourceType: | (AgoraMediaSourceType) | sourceType | |
Sets video noise reduction and specifies the media source.
You can call this method to enable the video noise reduction feature and set the options of the video noise reduction effect. Both this method and setVideoDenoiserOptions:options: set video noise reduction, but this method allows you to specify the media source to which the noise reduction is applied. Applicable scenarios: dark environments and low-end video capture devices can cause video images to contain significant noise, which affects video quality. In real-time interactive scenarios, video noise also consumes bitstream resources and reduces encoding efficiency during encoding. Call timing: Call this method after calling enableVideo.
AgoraClearVisionExtension.xcframework (iOS) or AgoraClearVisionExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.setBeautyEffectOptions:options: method to enable the beauty and skin smoothing function to achieve better video noise reduction effects. The recommended AgoraBeautyOptions settings for intense noise reduction effect are as follows:lighteningContrastLevel AgoraLighteningContrastNormallighteningLevel: 0.0smoothnessLevel: 0.5rednessLevel: 0.0sharpnessLevel: 0.1| enable | Whether to enable video noise reduction:
|
| options | The video noise reduction options. See AgoraVideoDenoiserOptions. |
| sourceType | The type of the media source to which the filter effect is applied. See AgoraMediaSourceType.Attention: In this method, this parameter supports only the following two settings:
|
| - (int) setLowlightEnhanceOptions: | (BOOL) | enable | |
| options: | (AgoraLowlightEnhanceOptions *_Nullable) | options | |
Sets low-light enhancement.
You can call this method to enable the color enhancement feature and set the options of the color enhancement effect. Applicable scenarios: The low-light enhancement feature can adaptively adjust the brightness value of the video captured in situations with low or uneven lighting, such as backlit, cloudy, or dark scenes. It restores or highlights the image details and improves the overall visual effect of the video. Call timing: Call this method after calling enableVideo.
AgoraClearVisionExtension.xcframework (iOS) or AgoraClearVisionExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.setVideoDenoiserOptions:options: to achieve video noise reduction, the specific corresponding relationship is as follows:| enable | Whether to enable low-light enhancement:
|
| options | The low-light enhancement options. See AgoraLowlightEnhanceOptions. |
| - (int) setLowlightEnhanceOptions: | (BOOL) | enable | |
| options: | (AgoraLowlightEnhanceOptions *_Nullable) | options | |
| sourceType: | (AgoraMediaSourceType) | sourceType | |
Sets low light enhance options and specifies the media source.
This method and setLowlightEnhanceOptions:options: both set low light enhance options, but this method allows you to specify the media source to which the low light enhance options are applied. Applicable scenarios: dark environments and low-end video capture devices can cause video images to contain significant noise, which affects video quality. In real-time interactive scenarios, video noise also consumes bitstream resources and reduces encoding efficiency during encoding. Call timing: Call this method after calling enableVideo.
AgoraClearVisionExtension.xcframework (iOS) or AgoraClearVisionExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| enable | Whether to enable low-light enhancement:
|
| options | The low-light enhancement options. See AgoraLowlightEnhanceOptions. |
| sourceType | The type of the media source to which the filter effect is applied. See AgoraMediaSourceType.Attention: In this method, this parameter supports only the following two settings:
|
| - (int) setColorEnhanceOptions: | (BOOL) | enable | |
| options: | (AgoraColorEnhanceOptions *_Nullable) | options | |
Sets color enhancement.
The video images captured by the camera can have color distortion. The color enhancement feature intelligently adjusts video characteristics such as saturation and contrast to enhance the video color richness and color reproduction, making the video more vivid. You can call this method to enable the color enhancement feature and set the options of the color enhancement effect.
enableVideo.AgoraClearVisionExtension.xcframework (iOS) or AgoraClearVisionExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| enable | Whether to enable color enhancement:
|
| options | The color enhancement options. See AgoraColorEnhanceOptions. |
| - (int) setColorEnhanceOptions: | (BOOL) | enable | |
| options: | (AgoraColorEnhanceOptions *_Nullable) | options | |
| sourceType: | (AgoraMediaSourceType) | sourceType | |
Sets color enhance options and specifies the media source.
The video images captured by the camera can have color distortion. The color enhancement feature intelligently adjusts video characteristics such as saturation and contrast to enhance the video color richness and color reproduction, making the video more vivid. Both this method and setColorEnhanceOptions:options: set color enhancement options, but this method allows you to specify the media source to which the color enhance options are applied.
enableVideo.AgoraClearVisionExtension.xcframework (iOS) or AgoraClearVisionExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| enable | Whether to enable color enhancement:
|
| options | The color enhancement options. See AgoraColorEnhanceOptions. |
| sourceType | The type of the media source to which the filter effect is applied. See AgoraMediaSourceType.Attention: In this method, this parameter supports only the following two settings:
|
| - (int) enableVirtualBackground: | (BOOL) | enable | |
| backData: | (AgoraVirtualBackgroundSource *_Nullable) | backData | |
| segData: | (AgoraSegmentationProperty *_Nullable) | segData | |
Enables/Disables the virtual background.
The virtual background feature enables the local user to replace their original background with a static image, dynamic video, blurred background, or portrait-background segmentation to achieve picture-in-picture effect. Once the virtual background feature is enabled, all users in the channel can see the custom background. Call this method after calling enableVideo or startPreview:.
AgoraVideoSegmentationExtension.xcframework (iOS) or AgoraVideoSegmentationExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| enable | Whether to enable virtual background:
|
| backData | The custom background. See AgoraVirtualBackgroundSource. To adapt the resolution of the custom background image to that of the video captured by the SDK, the SDK scales and crops the custom background image while ensuring that the content of the custom background image is not distorted. |
| segData | Processing properties for background images. See AgoraSegmentationProperty. |
| - (int) enableVirtualBackground: | (BOOL) | enable | |
| backData: | (AgoraVirtualBackgroundSource *_Nullable) | backData | |
| segData: | (AgoraSegmentationProperty *_Nullable) | segData | |
| sourceType: | (AgoraMediaSourceType) | sourceType | |
Enables virtual background and specify the media source, or disables virtual background.
The virtual background feature enables the local user to replace their original background with a static image, dynamic video, blurred background, or portrait-background segmentation to achieve picture-in-picture effect. Once the virtual background feature is enabled, all users in the channel can see the custom background. Both this method and enableVirtualBackground:backData:segData: enable/disable virtual background, but this method allows you to specify the media source to which the virtual background is applied. Call this method after calling enableVideo or startPreview:.
AgoraVideoSegmentationExtension.xcframework (iOS) or AgoraVideoSegmentationExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| enable | Whether to enable virtual background:
|
| backData | The custom background. See AgoraVirtualBackgroundSource. To adapt the resolution of the custom background image to that of the video captured by the SDK, the SDK scales and crops the custom background image while ensuring that the content of the custom background image is not distorted. |
| segData | Processing properties for background images. See AgoraSegmentationProperty. |
| sourceType | The type of the media source to which the filter effect is applied. See AgoraMediaSourceType.Attention: In this method, this parameter supports only the following two settings:
|
| - (int) setVideoScenario: | (AgoraApplicationScenarioType) | scenarioType |
Sets video application scenarios.
After successfully calling this method, the SDK will automatically enable the best practice strategies and adjust key performance metrics based on the specified scenario, to optimize the video experience.
| scenarioType | The type of video application scenario. See AgoraApplicationScenarioType.AgoraApplicationMeetingScenario (1) is suitable for meeting scenarios. The SDK automatically enables the following strategies:
|
AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method. | - (int) setVideoQoEPreference: | (AgoraQoEPreferenceType) | preferenceType |
Sets the video qoe preference. You can call this method to set the expected QoE Preference. The SDK will optimize the video experience for each preference you set.
| preferenceType | The qoe preference type. See #VIDEO_QOE_PREFERENCE_TYPE. |
| - (BOOL) isFeatureAvailableOnDevice: | (AgoraFeatureType) | type |
Checks whether the device supports the specified advanced feature.
Checks whether the capabilities of the current device meet the requirements for advanced features such as virtual background and image enhancement. Applicable scenarios: Before using advanced features, you can check whether the current device supports these features based on the call result. This helps to avoid performance degradation or unavailable features when enabling advanced features on low-end devices. Based on the return value of this method, you can decide whether to display or enable the corresponding feature button, or notify the user when the device's capabilities are insufficient.
| type | The type of the advanced feature, see AgoraFeatureType. |
YES: The current device supports the specified feature.NO: The current device does not support the specified feature. | - (int) setVoiceBeautifierPreset: | (AgoraVoiceBeautifierPreset) | preset |
Sets a preset voice beautifier effect.
Call this method to set a preset voice beautifier effect for the local user who sends an audio stream. After setting a voice beautifier effect, all users in the channel can hear the effect. You can set different voice beautifier effects for different scenarios. Call timing: This method can be called either before or after joining the channel. To achieve better vocal effects, it is recommended that you call the following APIs before calling this method:
setAudioScenario: to set the audio scenario to high-quality audio scenario, namely AgoraAudioScenarioGameStreaming (3).setAudioProfile: to set the profile parameter to AgoraAudioProfileMusicHighQuality (4) or AgoraAudioProfileMusicHighQualityStereo (5).profile parameter in setAudioProfile: to AgoraAudioProfileSpeechStandard (1), or the method does not take effect.setVoiceBeautifierPreset:, Agora does not recommend calling the following methods, otherwise the effect set by setVoiceBeautifierPreset: will be overwritten:setAudioEffectPreset:setAudioEffectParameters:param1:param2:setLocalVoicePitch:setLocalVoiceEqualizationOfBandFrequency:withGain:setLocalVoiceReverbOfType:withValue:setVoiceBeautifierParameters:param1:param2:setVoiceConversionPreset:AgoraAudioBeautyExtension.xcframework (iOS) or AgoraAudioBeautyExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| preset | The preset voice beautifier effect options: AgoraVoiceBeautifierPreset. |
| - (int) setVoiceConversionPreset: | (AgoraVoiceConversionPreset) | preset |
Sets a preset voice beautifier effect.
Call this method to set a preset voice changing effect for the local user who publishes an audio stream in a channel. After setting the voice changing effect, all users in the channel can hear the effect. You can set different voice changing effects for the user depending on different scenarios. Call timing: This method can be called either before or after joining the channel. To achieve better vocal effects, it is recommended that you call the following APIs before calling this method:
setAudioScenario: to set the audio scenario to high-quality audio scenario, namely AgoraAudioScenarioGameStreaming (3).setAudioProfile: to set the profile parameter to AgoraAudioProfileMusicHighQuality (4) or AgoraAudioProfileMusicHighQualityStereo (5).profile parameter in setAudioProfile: to AgoraAudioProfileSpeechStandard (1), or the method does not take effect.setVoiceConversionPreset:, Agora does not recommend you to call the following methods, otherwise the effect set by setVoiceConversionPreset: will be overwritten:setAudioEffectPreset:setAudioEffectParameters:param1:param2:setVoiceBeautifierPreset:setVoiceBeautifierParameters:param1:param2:setLocalVoicePitch:setLocalVoiceFormant:setLocalVoiceEqualizationOfBandFrequency:withGain:setLocalVoiceReverbOfType:withValue:AgoraAudioBeautyExtension.xcframework (iOS) or AgoraAudioBeautyExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| preset | The options for the preset voice beautifier effects: AgoraVoiceConversionPreset. |
| - (int) setVoiceBeautifierParameters: | (AgoraVoiceBeautifierPreset) | preset | |
| param1: | (int) | param1 | |
| param2: | (int) | param2 | |
Sets parameters for the preset voice beautifier effects.
Call this method to set a gender characteristic and a reverberation effect for the singing beautifier effect. This method sets parameters for the local user who sends an audio stream. After setting the audio parameters, all users in the channel can hear the effect. To achieve better vocal effects, it is recommended that you call the following APIs before calling this method:
setAudioScenario: to set the audio scenario to high-quality audio scenario, namely AgoraAudioScenarioGameStreaming (3).setAudioProfile: to set the profile parameter to AgoraAudioProfileMusicHighQuality (4) or AgoraAudioProfileMusicHighQualityStereo (5).profile parameter in setAudioProfile: to AgoraAudioProfileSpeechStandard (1), or the method does not take effect.setVoiceBeautifierParameters:param1:param2:, Agora does not recommend calling the following methods, otherwise the effect set by setVoiceBeautifierParameters:param1:param2: will be overwritten:setAudioEffectPreset:setAudioEffectParameters:param1:param2:setVoiceBeautifierPreset:setLocalVoicePitch:setLocalVoiceEqualizationOfBandFrequency:withGain:setLocalVoiceReverbOfType:withValue:setVoiceConversionPreset:AgoraAudioBeautyExtension.xcframework (iOS) or AgoraAudioBeautyExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| preset | The option for the preset audio effect:
|
| param1 | The gender characteristics options for the singing voice:
|
| param2 | The reverberation effect options for the singing voice:
|
| - (int) setVoiceConversionParameters: | (AgoraVoiceConversionPreset) | preset | |
| param1: | (int) | param1 | |
| param2: | (int) | param2 | |
Set parameters for SDK preset voice conversion.
| preset | The options for SDK preset audio effects. See #VOICE_CONVERSION_PRESET. |
| param1 | reserved. |
| param2 | reserved. |
| - (int) setHeadphoneEQPreset: | (AgoraHeadphoneEQPreset) | preset |
Sets the preset headphone equalization effect.
This method is mainly used in spatial audio effect scenarios. You can select the preset headphone equalizer to listen to the audio to achieve the expected audio experience.
| preset | The preset headphone equalization effect. See AgoraHeadphoneEQPreset. |
| - (int) setHeadphoneEQParameters: | (int) | lowGain | |
| highGain: | (int) | highGain | |
Sets the low- and high-frequency parameters of the headphone equalizer.
In a spatial audio effect scenario, if the preset headphone equalization effect is not achieved after calling the setHeadphoneEQPreset: method, you can further adjust the headphone equalization effect by calling this method.
| lowGain | The low-frequency parameters of the headphone equalizer. The value range is [-10,10]. The larger the value, the deeper the sound. |
| highGain | The high-frequency parameters of the headphone equalizer. The value range is [-10,10]. The larger the value, the sharper the sound. |
| - (int) enableVoiceAITuner: | (BOOL) | enabled | |
| type: | (AgoraVoiceAITunerType) | type | |
Enables or disables the voice AI tuner.
The voice AI tuner supports enhancing sound quality and adjusting tone style. Applicable scenarios: Social entertainment scenes including online KTV, online podcast and live streaming in showrooms, where high sound quality is required. Call timing: This method can be called either before or after joining the channel.
| enabled | Whether to enable the voice AI tuner:
|
| type | Voice AI tuner sound types, see AgoraVoiceAITunerType. |
| - (int) enableSoundPositionIndication: | (BOOL) | enabled |
Enables or disables stereo panning for remote users.
Ensure that you call this method before joining a channel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling setRemoteVoicePosition:pan:gain:.
| enabled | Whether to enable stereo panning for remote users:
|
| - (int) setRemoteVoicePosition: | (NSUInteger) | uid | |
| pan: | (double) | pan | |
| gain: | (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.
enableSoundPositionIndication: method before 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:
|
| 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. |
| - (int) enableSpatialAudio: | (BOOL) | enabled |
Enables or disables the spatial audio effect.
After enabling the spatial audio effect, you can call setRemoteUserSpatialAudioParams:params: to set the spatial audio effect parameters of the remote user.
AgoraSpatialAudioExtension.xcframework (iOS) or AgoraSpatialAudioExtension.framework (macOS). If the dynamic library is deleted, the function cannot be enabled normally.| enabled | Whether to enable the spatial audio effect:
|
| - (int) setAINSMode: | (BOOL) | enabled | |
| mode: | (AUDIO_AINS_MODE) | mode | |
Sets whether to enable the AI noise suppression function and set the noise suppression mode.
You can call this method to enable AI noise suppression function. Once enabled, the SDK automatically detects and reduces stationary and non-stationary noise from your audio on the premise of ensuring the quality of human voice. Stationary noise refers to noise signal with constant average statistical properties and negligibly small fluctuations of level within the period of observation. Common sources of stationary noises are:
AgoraAiNoiseSuppressionExtension.xcframework. If the dynamic library is deleted, the function cannot be enabled.| enabled | Whether to enable the AI noise suppression function:
|
| mode | The AI noise suppression modes. See AUDIO_AINS_MODE. |
| - (int) selectAudioTrack: | (NSInteger) | index |
Selects the audio track used during playback.
After getting the track index of the audio file, you can call this method to specify any track to play. For example, if different tracks of a multi-track file store songs in different languages, you can call this method to set the playback language.
https://docs.agora.io/en/help/general-product-inquiry/audio_format#extended-audio-file-formats.startAudioMixing:loopback:cycle:startPos: and receiving the rtcEngine:audioMixingStateChanged:reasonCode: (AgoraAudioMixingStateTypePlaying) callback.| index | The audio track you want to specify. The value should be greater than 0 and less than that of returned by getAudioTrackCount. |
| - (int) getAudioTrackCount |
Gets the index of audio tracks of the current music file.
startAudioMixing:loopback:cycle:startPos: and receiving the rtcEngine:audioMixingStateChanged:reasonCode: (AgoraAudioMixingStateTypePlaying) callback.| - (int) startAudioRecordingWithConfig: | (AgoraAudioRecordingConfiguration *_Nonnull) | config |
Starts client-side recording and configures recording settings.
The SDK supports client-side recording during a call. After calling this method, you can record the audio of users in the channel and generate a recording file. The recording file supports the following formats only:
AgoraAudioRecordingQualityMedium results in a file of approximately 2 MB. Recording automatically stops when the user leaves the channel. Call timing: This method must be called after joining the channel.| config | Recording configuration. See AgoraAudioRecordingConfiguration for details. |
Error Codes for details and troubleshooting. | - (int) setAudioEncodedFrameDelegate: | (id< AgoraAudioEncodedFrameDelegate > _Nullable) | delegate | |
| config: | (AgoraAudioEncodedFrameDelegateConfig *_Nonnull) | config | |
Registers an encoded audio observer.
startAudioRecordingWithConfig: to set the recording type and quality of audio files, but Agora does not recommend using this method and startAudioRecordingWithConfig: at the same time. Only the method called later will take effect.| config | Observer settings for the encoded audio. See AgoraAudioEncodedFrameDelegateConfig. |
| delegate | The encoded audio observer. See AgoraAudioEncodedFrameDelegate. |
| - (int) startEchoTestWithConfig: | (AgoraEchoTestConfiguration *_Nonnull) | config |
Starts an audio device loopback test.
To test whether the user's local sending and receiving streams are normal, you can call this method to perform an audio and video call loop test, which tests whether the audio and video devices and the user's upstream and downstream networks are working properly. After starting the test, the user needs to make a sound or face the camera. The audio or video is output after about two seconds. If the audio playback is normal, the audio device and the user's upstream and downstream networks are working properly; if the video playback is normal, the video device and the user's upstream and downstream networks are working properly. Call timing: You can call this method either before or after joining a channel.
stopEchoTest to end the test; otherwise, the user cannot perform the next audio and video call loop test and cannot join the channel.| config | The configuration of the audio and video call loop test. See AgoraEchoTestConfiguration. |
| - (int) enableInEarMonitoring: | (BOOL) | enabled |
Enables in-ear monitoring.
This method enables or disables in-ear monitoring. Call timing: This method can be called either before or after joining the channel.
| enabled | Enables or disables in-ear monitoring.
|
| - (int) enableInEarMonitoring: | (BOOL) | enabled | |
| includeAudioFilters: | (AgoraEarMonitoringFilterType) | includeAudioFilters | |
Enables in-ear monitoring.
This method enables or disables in-ear monitoring. Call timing: This method can be called either before or after joining the channel.
| enabled | Enables or disables in-ear monitoring.
|
| includeAudioFilters | The audio filter types of in-ear monitoring. See AgoraEarMonitoringFilterType. |
| - (int) setInEarMonitoringVolume: | (NSInteger) | volume |
Sets the volume of the in-ear monitor.
Call timing: This method can be called either before or after joining the channel.
| volume | The volume of the user. The value range is [0,400].
|
| - (int) enableDualStreamMode: | (BOOL) | enabled |
Enables or disables dual-stream mode on the sender side.
Dual streams are a pairing of a high-quality video stream and a low-quality video stream:
setRemoteVideoStream:type: to choose to receive either the high-quality video stream or the low-quality video stream on the subscriber side.enableDualStreamModeEx:streamConfig:connection: method.| enabled | Whether to enable dual-stream mode:
|
| - (int) enableDualStreamMode: | (BOOL) | enabled | |
| streamConfig: | (AgoraSimulcastStreamConfig *_Nonnull) | streamConfig | |
Sets the dual-stream mode on the sender side and the low-quality video stream.
You can call this method to enable or disable the dual-stream mode on the publisher side. Dual streams are a pairing of a high-quality video stream and a low-quality video stream:
setRemoteVideoStream:type: to choose to receive either the high-quality video stream or the low-quality video stream on the subscriber side.enableDualStreamModeEx:streamConfig:connection: method.| enabled | Whether to enable dual-stream mode:
|
| streamConfig | The configuration of the low-quality video stream. See AgoraSimulcastStreamConfig.Note: When setting mode to AgoraDisableSimulcastStream, setting streamConfig will not take effect. |
| - (int) setDualStreamMode: | (AgoraSimulcastStreamMode) | mode |
Sets the dual-stream mode on the sender side.
The SDK defaults to enabling low-quality video stream adaptive mode ( AgoraAutoSimulcastStream ) on the sender side, which means the sender does not actively send low-quality video stream. The receiving end with the role of the host can initiate a low-quality video stream request by calling setRemoteVideoStream:type:, and upon receiving the request, the sending end automatically starts sending low-quality stream.
mode to AgoraDisableSimulcastStream (never send low-quality video streams) or AgoraEnableSimulcastStream (always send low-quality video streams).mode set to AgoraAutoSimulcastStream.enableDualStreamMode: is as follows:mode to AgoraDisableSimulcastStream, it has the same effect as enableDualStreamMode: (NO).mode to AgoraEnableSimulcastStream, it has the same effect as enableDualStreamMode: (YES).| mode | The mode in which the video stream is sent. See AgoraSimulcastStreamMode. |
| - (int) setDualStreamMode: | (AgoraSimulcastStreamMode) | mode | |
| streamConfig: | (AgoraSimulcastStreamConfig *_Nonnull) | streamConfig | |
Sets dual-stream mode configuration on the sender side.
The SDK defaults to enabling low-quality video stream adaptive mode ( AgoraAutoSimulcastStream ) on the sender side, which means the sender does not actively send low-quality video stream. The receiving end with the role of the host can initiate a low-quality video stream request by calling setRemoteVideoStream:type:, and upon receiving the request, the sending end automatically starts sending low-quality stream.
mode to AgoraDisableSimulcastStream (never send low-quality video streams) or AgoraEnableSimulcastStream (always send low-quality video streams).mode set to AgoraAutoSimulcastStream. The difference between this method and setDualStreamMode: is that this method can also configure the low-quality video stream, and the SDK sends the stream according to the configuration in streamConfig.enableDualStreamMode:streamConfig: is as follows:mode to AgoraDisableSimulcastStream, it has the same effect as calling enableDualStreamMode:streamConfig: and setting enabled to NO.mode to AgoraEnableSimulcastStream, it has the same effect as calling enableDualStreamMode:streamConfig: and setting enabled to YES.| mode | The mode in which the video stream is sent. See AgoraSimulcastStreamMode. |
| streamConfig | The configuration of the low-quality video stream. See AgoraSimulcastStreamConfig.Note: When setting mode to AgoraDisableSimulcastStream, setting streamConfig will not take effect. |
| - (int) setSimulcastConfig: | (AgoraSimulcastConfig *_Nonnull) | simulcastConfig |
Sets the simulcast video stream configuration.
You can call this method to set video streams with different resolutions for the same video source. The subscribers can call setRemoteVideoStream:type: to select which stream layer to receive. The broadcaster can publish up to four layers of video streams: one main stream (highest resolution) and three additional streams of different quality levels.
| simulcastConfig | Configuration for different video steam layers. This configuration includes seven layers, from AgoraStreamLayer1 to AgoraStreamLow, with a maximum of three layers enabled simultaneously. See AgoraSimulcastConfig. |
| - (int) setRemoteDefaultVideoStreamType: | (AgoraVideoStreamType) | streamType |
Sets the default video stream type to subscribe to.
Depending on the default behavior of the sender and the specific settings when calling setDualStreamMode:streamConfig:, the scenarios for the receiver calling this method are as follows:
AgoraAutoSimulcastStream ) on the sender side by default, meaning only the high-quality video stream is transmitted. Only the receiver with the role of the **host**can call this method to initiate a low-quality video stream request. Once the sender receives the request, it starts automatically sending the low-quality video stream. At this point, all users in the channel can call this method to switch to low-quality video stream subscription mode.setDualStreamMode:streamConfig: and sets mode to AgoraDisableSimulcastStream (never send low-quality video stream), then calling this method will have no effect.setDualStreamMode:streamConfig: and sets mode to AgoraEnableSimulcastStream (always send low-quality video stream), both the host and audience receivers can call this method to switch to low-quality video stream subscription mode. The SDK will dynamically adjust the size of the corresponding video stream based on the size of the video window to save bandwidth and computing resources. The default aspect ratio of the low-quality video stream is the same as that of the high-quality video stream. According to the current aspect ratio of the high-quality video stream, the system will automatically allocate the resolution, frame rate, and bitrate of the low-quality video stream. Call timing: Call this method before joining a channel. The SDK does not support changing the default subscribed video stream type after joining a channel.setRemoteVideoStream:type:, the setting of setRemoteVideoStream:type: takes effect.| streamType | The default video-stream type. See AgoraVideoStreamType. |
| - (int) setRemoteVideoSubscriptionOptions: | (NSUInteger) | uid | |
| options: | (AgoraVideoSubscriptionOptions *_Nonnull) | options | |
Options for subscribing to remote video streams.
When a remote user has enabled dual-stream mode, you can call this method to choose the option for subscribing to the video streams sent by the remote user. The default subscription behavior of the SDK for remote video streams depends on the type of registered video observer:
AgoraVideoFrameDelegate observer is registered, the default is to subscribe to both raw data and encoded data.AgoraEncodedVideoFrameDelegate observer is registered, the default is to subscribe only to the encoded data.AgoraVideoFrameDelegate observer, the default is to subscribe to both raw data and encoded data. If you want to modify the default behavior, or set different subscription options for different uids, you can call this method to set it.| uid | The user ID of the remote user. |
| options | The video subscription options. See AgoraVideoSubscriptionOptions. |
| - (int) setSubscribeAudioAllowlist: | (NSArray< NSNumber * > *_Nonnull) | allowlist |
Sets the allowlist of subscriptions for audio streams.
You can call this method to specify the audio streams of a user that you want to subscribe to.
muteRemoteAudioStream:mute:, muteAllRemoteAudioStreams: and autoSubscribeAudio in AgoraRtcChannelMediaOptions.| allowlist | The user ID list of users that you want to subscribe to. If you want to specify the audio streams of a user for subscription, add the user ID in this list. If you want to remove a user from the allowlist, you need to call the setSubscribeAudioAllowlist: method to update the user ID list; this means you only add the uid of users that you want to subscribe to in the new user ID list. |
| - (int) setSubscribeVideoAllowlist: | (NSArray< NSNumber * > *_Nonnull) | allowlist |
Sets the allowlist of subscriptions for video streams.
You can call this method to specify the video streams of a user that you want to subscribe to.
muteRemoteVideoStream:mute:, muteAllRemoteVideoStreams: and autoSubscribeAudio in AgoraRtcChannelMediaOptions.| allowlist | The user ID list of users that you want to subscribe to. If you want to specify the video streams of a user for subscription, add the user ID in this list. If you want to remove a user from the allowlist, you need to call the setSubscribeVideoAllowlist: method to update the user ID list; this means you only add the uid of users that you want to subscribe to in the new user ID list. |
| - (int) setHighPriorityUserList: | (NSArray< NSNumber * > *_Nullable) | uidList | |
| option: | (AgoraStreamFallbackOptions) | option | |
Sets high priority user list and related remote subscribe stream fallback option.
This method sets the high priority user list and disables/enables the vips' remote subscribe stream fallback option according to the network conditions in NASA2.
If you use the option as AgoraStreamFallbackOptionAudioOnly = 2, the AutVos will automatically switch the video from a high-stream to a low-stream, or disable the video when the downlink network conditions cannot support both audio and video to guarantee the quality of the audio. The AutVos monitors the network quality and re-enables the video stream when the network conditions improve. Once the subscribed stream falls back to audio only, or the audio stream switches back to the video stream, the [didRemoteSubscribeFallbackToAudioOnly]([AgoraRtcEngineDelegate rtcEngine:didRemoteSubscribeFallbackToAudioOnly:byUid:]) callback will be triggered.
| option | AgoraStreamFallbackOptions |
| - (void) setExternalVideoSource: | (BOOL) | enable | |
| useTexture: | (BOOL) | useTexture | |
| sourceType: | (AgoraExternalVideoSourceType) | sourceType | |
Configures the external video source.
After calling this method to enable an external video source, you can call pushExternalVideoFrame:videoTrackId: to push external video data to the SDK. Call timing: Call this method before joining a channel.
| enable | Whether to use the external video source:
|
| useTexture | Whether to use the external video frame in the Texture format.
|
| sourceType | Whether the external video frame is encoded. See AgoraExternalVideoSourceType. |
| - (void) setExternalVideoSource: | (BOOL) | enable | |
| useTexture: | (BOOL) | useTexture | |
| sourceType: | (AgoraExternalVideoSourceType) | sourceType | |
| encodedVideoTrackOption: | (AgoraEncodedVideoTrackOptions *_Nonnull) | encodedVideoTrackOption | |
Sets the external video source.
Call this API before enableVideo or startPreview.
| enable | Determines whether to enable the external video source.
|
The Agora SDK does not support switching video sources dynamically in the channel. If an external video source is enabled and you are in a channel, if you want to switch to an internal video source, you must exit the channel. Then call this method to set enable as NO, and join the channel again.
| useTexture | Determines whether to use textured video data.
|
| sourceType | Determines the type of the external video source. |
| encodedVideoTrackOption | Determines encoded video track options. |
| - (BOOL) pushExternalVideoFrame: | (AgoraVideoFrame *_Nonnull) | frame |
Pushes the external raw video frame to the SDK.
After calling the setExternalVideoSource:useTexture:sourceType: method and setting the enabled parameter to YES, and the encodedFrame parameter to NO, you can use this method to push the raw external video frame to the SDK.
| frame | The external raw video frame to be pushed. See AgoraVideoFrame. |
YES: Success.NO: Failure. | - (BOOL) pushExternalVideoFrame: | (AgoraVideoFrame *_Nonnull) | frame | |
| videoTrackId: | (NSUInteger) | videoTrackId | |
Pushes the external raw video frame to the SDK through video tracks.
To publish a custom video source, see the following steps:1. Call createCustomVideoTrack to create a video track and get the video track ID.
joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: to join the channel. In AgoraRtcChannelMediaOptions, set customVideoTrackId to the video track ID that you want to publish, and set publishCustomVideoTrack to YES.videoTrackId as the video track ID set in step 2. You can then publish the corresponding custom video source in the channel.setExternalVideoSource:useTexture:sourceType: method and the SDK will automatically create a video track with the videoTrackId set to 0. DANGER: After calling this method, even if you stop pushing external video frames to the SDK, the custom video stream will still be counted as the video duration usage and incur charges. Agora recommends that you take appropriate measures based on the actual situation to avoid such video billing.destroyCustomVideoTrack: to destroy the custom video track.muteLocalVideoStream: to cancel sending video stream or call updateChannelWithMediaOptions: to set publishCustomVideoTrack to NO.| frame | The external raw video frame to be pushed. See AgoraVideoFrame. |
| videoTrackId | The video track ID returned by calling the createCustomVideoTrack method.Note: If you only need to push one custom video source, set videoTrackId to 0. |
YES: Success.NO: Failure. | - (int) pushExternalEncodedVideoFrame: | (NSData *_Nonnull) | frame | |
| info: | (AgoraEncodedVideoFrameInfo *_Nonnull) | info | |
Pushes the encoded external video frame to Agora SDK.
| frame | The encoded external video data, which must be the direct buffer. |
| info | The encoded external video frame info: AgoraEncodedVideoFrameInfo. |
| - (int) pushExternalEncodedVideoFrame: | (NSData *_Nonnull) | frame | |
| info: | (AgoraEncodedVideoFrameInfo *_Nonnull) | info | |
| videoTrackId: | (NSUInteger) | videoTrackId | |
Pushes the encoded external video frame to specified connection in Agora SDK.
| frame | The encoded external video data, which must be the direct buffer. |
| info | The encoded external video frame info: AgoraEncodedVideoFrameInfo. |
| videoTrackId | The id of the video track. |
| - (unsigned int) createCustomVideoTrack |
Creates a custom video track.
To publish a custom video source, see the following steps:1. Call this method to create a video track and get the video track ID.
joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: to join the channel. In AgoraRtcChannelMediaOptions, set customVideoTrackId to the video track ID that you want to publish, and set publishCustomVideoTrack to YES.pushExternalVideoFrame:videoTrackId: and specify videoTrackId as the video track ID set in step 2. You can then publish the corresponding custom video source in the channel.| - (unsigned int) createCustomEncodedVideoTrack: | (AgoraEncodedVideoTrackOptions *_Nonnull) | encodedVideoTrackOption |
Get an custom encoded video track id created by internal,which could used to publish or preview
| - (int) destroyCustomVideoTrack: | (NSUInteger) | videoTrackId |
Destroys the specified video track.
| videoTrackId | The video track ID returned by calling the createCustomVideoTrack method. |
| - (int) destroyCustomEncodedVideoTrack: | (NSUInteger) | videoTrackId |
destroy a created custom encoded video track id
| videoTrackId | The video track id which was created by createCustomEncodedVideoTrack |
| - (void) enableExternalAudioSink: | (BOOL) | enabled | |
| sampleRate: | (NSUInteger) | sampleRate | |
| channels: | (NSUInteger) | channels | |
Sets the external audio sink.
After enabling the external audio sink, you can call pullPlaybackAudioFrameRawData:lengthInByte: to pull remote audio frames. The app can process the remote audio and play it with the audio effects that you want. Applicable scenarios: This method applies to scenarios where you want to use external audio data for playback. Call timing: Call this method before joining a channel.
onPlaybackAudioFrame: callback.| enabled | Whether to enable or disable the external audio sink:
|
| sampleRate | The sample rate (Hz) of the external audio sink, which can be set as 16000, 32000, 44100, or 48000. |
| channels | The number of audio channels of the external audio sink:
|
| - (BOOL) pullPlaybackAudioFrameRawData: | (void *_Nonnull) | data | |
| lengthInByte: | (NSUInteger) | lengthInByte | |
Pulls the remote audio data.
After a successful call of this method, the app pulls the decoded and mixed audio data for playback. Call timing: Call this method after joining a channel. Before calling this method, call enableExternalAudioSink:sampleRate:channels: (enabled: YES) to notify the app to enable and set the external audio rendering.
onPlaybackAudioFrame: callback can be used to get audio data after remote mixing. After calling enableExternalAudioSink:sampleRate:channels: to enable external audio rendering, the app will no longer be able to obtain data from the onPlaybackAudioFrame: callback. Therefore, you should choose between this method and the onPlaybackAudioFrame: callback based on your actual business requirements. The specific distinctions between them are as follows:onPlaybackAudioFrame: callback, the SDK sends the audio data to the app through the callback. Any delay in processing the audio frames may result in audio jitter. This method is only used for retrieving audio data after remote mixing. If you need to get audio data from different audio processing stages such as capture and playback, you can register the corresponding callbacks by calling setAudioFrameDelegate:.| data | The remote audio data to be pulled. The data type is byte[]. |
| lengthInByte | The data length (byte). The value of this parameter is related to the audio duration, and the values of the sampleRate and channels parameters that you set in enableExternalAudioSink:sampleRate:channels:. lengthInByte = sampleRate/1000 × 2 × channels × audio duration (ms). |
YES: Success.NO: Failure. | - (CMSampleBufferRef _Nullable) pullPlaybackAudioFrameSampleBufferByLengthInByte: | (NSUInteger) | lengthInByte |
Pulls remote audio data in the SampleBuffer format.
After a successful call of this method, the app pulls the decoded and mixed audio data for playback.
| lengthInByte | The data length (byte). The value of this parameter is related to the audio duration, and the values of the sampleRate and channels parameters that you set in enableExternalAudioSink:sampleRate:channels:. lengthInByte = sampleRate/1000 × 2 × channels × audio duration (ms). |
YES: Success.NO: Failure. | - (int) createCustomAudioTrack: | (AgoraAudioTrackType) | trackType | |
| config: | (AgoraAudioTrackConfig *_Nonnull) | config | |
Creates a custom audio track.
To publish a custom audio source, see the following steps:1. Call this method to create a custom audio track and get the audio track ID.
joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: to join the channel. In AgoraRtcChannelMediaOptions, set publishCustomAudioTrackId to the audio track ID that you want to publish, and set publishCustomAudioTrack to YES.pushExternalAudioFrameRawData:samples:sampleRate:channels:trackId:timestamp: and specify trackId as the audio track ID set in step 2. You can then publish the corresponding custom audio source in the channel.| trackType | The type of the custom audio track. See AgoraAudioTrackType.Attention: If AgoraAudioTrackTypeDirect is specified for this parameter, you must set publishMicrophoneTrack to NO in AgoraRtcChannelMediaOptions when calling joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: to join the channel; otherwise, joining the channel fails and returns the error code -2. |
| config | The configuration of the custom audio track. See AgoraAudioTrackConfig. |
| - (int) destroyCustomAudioTrack: | (NSInteger) | trackId |
Destroys the specified audio track.
| trackId | The custom audio track ID returned in createCustomAudioTrack:config:. |
| - (int) enableCustomAudioLocalPlayback: | (NSInteger) | trackId | |
| enabled: | (BOOL) | enabled | |
Sets whether to enable the local playback of external audio source.
After calling this method to enable the local playback of external audio source, if you need to stop local playback, you can call this method again and set enabled to NO. You can call adjustCustomAudioPlayoutVolume:volume: to adjust the local playback volume of the custom audio track.
createCustomAudioTrack:config: method to create a custom audio track before calling this method.| trackId | The audio track ID. Set this parameter to the custom audio track ID returned in createCustomAudioTrack:config:. |
| enabled | Whether to play the external audio source:
|
| - (int) setRecordingAudioFrameParametersWithSampleRate: | (NSInteger) | sampleRate | |
| channel: | (NSInteger) | channel | |
| mode: | (AgoraAudioRawFrameOperationMode) | mode | |
| samplesPerCall: | (NSInteger) | samplesPerCall | |
Sets the format of the captured raw audio data.
The SDK calculates the sampling interval based on the samplesPerCall, sampleRate and channel parameters set in this method.Sample interval (sec) = samplePerCall /( sampleRate × channel ). Ensure that the sample interval ≥ 0.01 (s). The SDK triggers the onRecordAudioFrame:channelId: callback according to the sampling interval. Call timing: Call this method before joining a channel.
| sampleRate | The sample rate returned in the callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz. |
| channel | The number of audio channels. You can set the value as 1 or 2.
|
| mode | The use mode of the audio frame. See AgoraAudioRawFrameOperationMode. |
| samplesPerCall | The number of data samples, such as 1024 for the Media Push. |
| - (int) setPlaybackAudioFrameParametersWithSampleRate: | (NSInteger) | sampleRate | |
| channel: | (NSInteger) | channel | |
| mode: | (AgoraAudioRawFrameOperationMode) | mode | |
| samplesPerCall: | (NSInteger) | samplesPerCall | |
Sets the format of the raw audio playback data.
The SDK calculates the sampling interval based on the samplesPerCall, sampleRate and channel parameters set in this method.Sample interval (sec) = samplePerCall /( sampleRate × channel ). Ensure that the sample interval ≥ 0.01 (s). The SDK triggers the onPlaybackAudioFrame: callback according to the sampling interval. Call timing: Call this method before joining a channel.
| sampleRate | The sample rate returned in the callback, which can be set as 8000, 16000, 24000, 32000, 44100, or 48000 Hz. |
| channel | The number of audio channels. You can set the value as 1 or 2.
|
| mode | The use mode of the audio frame. See AgoraAudioRawFrameOperationMode. |
| samplesPerCall | The number of data samples, such as 1024 for the Media Push. |
| - (int) setMixedAudioFrameParametersWithSampleRate: | (NSInteger) | sampleRate | |
| channel: | (NSInteger) | channel | |
| samplesPerCall: | (NSInteger) | samplesPerCall | |
Sets the format of the raw audio data after mixing for audio capture and playback.
The SDK calculates the sampling interval based on the samplesPerCall, sampleRate and channel parameters set in this method.Sample interval (sec) = samplePerCall /( sampleRate × channel ). Ensure that the sample interval ≥ 0.01 (s). The SDK triggers the onMixedAudioFrame:channelId: callback according to the sampling interval. Call timing: Call this method before joining a channel.
| sampleRate | The sample rate returned in the callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz. |
| channel | The number of audio channels. You can set the value as 1 or 2.
|
| samplesPerCall | The number of data samples, such as 1024 for the Media Push. |
| - (int) setEarMonitoringAudioFrameParametersWithSampleRate: | (NSInteger) | sampleRate | |
| channel: | (NSInteger) | channel | |
| mode: | (AgoraAudioRawFrameOperationMode) | mode | |
| samplesPerCall: | (NSInteger) | samplesPerCall | |
Sets the format of the in-ear monitoring raw audio data.
This method is used to set the in-ear monitoring audio data format reported by the onEarMonitoringAudioFrame: callback.
enableInEarMonitoring:includeAudioFilters:, and set includeAudioFilters to AgoraEarMonitoringFilterBuiltInAudioFilters or AgoraEarMonitoringFilterNoiseSuppression.samplesPerCall, sampleRate and channel parameters set in this method.Sample interval (sec) = samplePerCall /( sampleRate × channel ). Ensure that the sample interval ≥ 0.01 (s). The SDK triggers the onEarMonitoringAudioFrame: callback according to the sampling interval.| sampleRate | The sample rate of the audio data reported in the onEarMonitoringAudioFrame: callback, which can be set as 8,000, 16,000, 32,000, 44,100, or 48,000 Hz. |
| channel | The number of audio channels reported in the onEarMonitoringAudioFrame: callback.
|
| mode | The use mode of the audio frame. See AgoraAudioRawFrameOperationMode. |
| samplesPerCall | The number of data samples reported in the onEarMonitoringAudioFrame: callback, such as 1,024 for the Media Push. |
| - (int) setPlaybackAudioFrameBeforeMixingParametersWithSampleRate: | (NSInteger) | sampleRate | |
| channel: | (NSInteger) | channel | |
Sets the format of the raw audio playback data before mixing.
The SDK triggers the onPlaybackAudioFrameBeforeMixing:channelId:uid: callback according to the sampling interval. Call timing: Call this method before joining a channel.
| sampleRate | The sample rate returned in the callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz. |
| channel | The number of audio channels. You can set the value as 1 or 2.
|
| - (int) setPlaybackAudioFrameBeforeMixingParametersWithSampleRate: | (NSInteger) | sampleRate | |
| channel: | (NSInteger) | channel | |
| samplesPerCall: | (NSInteger) | samplesPerCall | |
Sets the format of audio data in the onPlaybackAudioFrameBeforeMixing:channelId:uid: callback.
Used to set the sample rate, number of channels, and number of samples per callback for the audio data returned in the onPlaybackAudioFrameBeforeMixing:channelId:uid: callback.
| sampleRate | Input parameter, sampling rate (Hz) returned in the onPlaybackAudioFrameBeforeMixing:channelId:uid: callback. It can be set as the following values: 8000、16000、32000、44100 or 48000. |
| channel | Input parameter, the number of channels for the audio data returned in the onPlaybackAudioFrameBeforeMixing:channelId:uid: callback.
|
| samplesPerCall | Input parameter, the number of sample rate of the data returned in the onPlaybackAudioFrameBeforeMixing:channelId:uid: callback. For example, in the RTMP streaming scenario, it is recommended to set it to 1024. |
| - (int) adjustCustomAudioPublishVolume: | (NSInteger) | trackId | |
| volume: | (NSInteger) | volume | |
Adjusts the volume of the custom audio track played remotely.
If you want to change the volume of the audio played remotely, you need to call this method again.
createCustomAudioTrack:config: method to create a custom audio track before calling this method.| trackId | The audio track ID. Set this parameter to the custom audio track ID returned in createCustomAudioTrack:config:. |
| volume | The volume of the audio source. The value can range from 0 to 100. 0 means mute; 100 means the original volume. |
| - (int) adjustCustomAudioPlayoutVolume: | (NSInteger) | trackId | |
| volume: | (NSInteger) | volume | |
Adjusts the volume of the custom audio track played locally.
If you want to change the volume of the audio to be played locally, you need to call this method again.
createCustomAudioTrack:config: method to create a custom audio track before calling this method.| trackId | The audio track ID. Set this parameter to the custom audio track ID returned in createCustomAudioTrack:config:. |
| volume | The volume of the audio source. The value can range from 0 to 100. 0 means mute; 100 means the original volume. |
| - (int64_t) getCurrentMonotonicTimeInMs |
Gets the current Monotonic Time of the SDK.
Monotonic Time refers to a monotonically increasing time series whose value increases over time. The unit is milliseconds. In custom video capture and custom audio capture scenarios, in order to ensure audio and video synchronization, Agora recommends that you call this method to obtain the current Monotonic Time of the SDK, and then pass this value into the timestamp parameter in the captured video frame ( AgoraOutputVideoFrame ) and audio frame ( AgoraAudioFrame ). Call timing: This method can be called either before or after joining the channel.
| - (int) registerAudioSpectrumDelegate: | (id< AgoraAudioSpectrumDelegate > _Nullable) | delegate |
Registers an audio spectrum observer.
After successfully registering the audio spectrum observer and calling enableAudioSpectrumMonitor: to enable the audio spectrum monitoring, the SDK reports the callback that you implement in the AgoraAudioSpectrumDelegate class according to the time interval you set.
| delegate | The audio spectrum observer. See AgoraAudioSpectrumDelegate. |
| - (int) unregisterAudioSpectrumDelegate: | (id< AgoraAudioSpectrumDelegate > _Nullable) | delegate |
Unregisters the audio spectrum observer.
After calling registerAudioSpectrumDelegate:, if you want to disable audio spectrum monitoring, you can call this method.
| delegate | The audio spectrum observer. See AgoraAudioSpectrumDelegate. |
| - (int) enableAudioSpectrumMonitor: | (int) | intervalInMS |
Turns on audio spectrum monitoring.
If you want to obtain the audio spectrum data of local or remote users, you can register the audio spectrum observer and enable audio spectrum monitoring.
| intervalInMS | The interval (in milliseconds) at which the SDK triggers the onLocalAudioSpectrum: and onRemoteAudioSpectrum: callbacks. The default value is 100. Do not set this parameter to a value less than 10, otherwise calling this method would fail. |
| - (int) disableAudioSpectrumMonitor |
Disables audio spectrum monitoring.
After calling enableAudioSpectrumMonitor:, if you want to disable audio spectrum monitoring, you can call this method.
| - (int) enableEncryption: | (BOOL) | enabled | |
| encryptionConfig: | (AgoraEncryptionConfig *_Nonnull) | config | |
Enables or disables the built-in encryption.
After the user leaves the channel, the SDK automatically disables the built-in encryption. To enable the built-in encryption, call this method before the user joins the channel again. Applicable scenarios: Scenarios with higher security requirements. Call timing: Call this method before joining a channel.
| enabled | Whether to enable built-in encryption:
|
| config | Built-in encryption configurations. See AgoraEncryptionConfig. |
AgoraRtcEngineKit instance before calling this method. | - (int) createDataStream: | (NSInteger *_Nonnull) | streamId | |
| config: | (AgoraDataStreamConfig *_Nonnull) | config | |
Creates a data stream.
Compared to createDataStream:reliable:ordered:, this method does not guarantee the reliability of data transmission. If a data packet is not received five seconds after it was sent, the SDK directly discards the data. Call timing: You can call this method either before or after joining a channel.
AgoraRtcEngineKit. The data stream will be destroyed when leaving the channel, and the data stream needs to be recreated if needed. If you need a more comprehensive solution for low-latency, high-concurrency, and scalable real-time messaging and status synchronization, it is recommended to use Signaling.| streamId | An output parameter; the ID of the data stream created. |
| config | The configurations for the data stream. See AgoraDataStreamConfig. |
| - (int) sendRdtMessage: | (NSInteger) | uid | |
| type: | (AgoraRdtStreamType) | type | |
| data: | (NSData *_Nonnull) | data | |
Send Reliable message to remote uid in channel.
@technical preview
| uid | remote user id. |
| type | Reliable Data Transmission tunnel message type. See AgoraRdtStreamType. |
| data | The sent data. |
| - (int) sendMediaControlMessage: | (NSInteger) | uid | |
| data: | (NSData *_Nonnull) | data | |
Send media control message.
@technical preview
| uid | remote user id. In particular, if the uid is set to 0, it means broadcasting the message to the entire channel. |
| data | The sent data. |
| - (int) startRtmpStreamWithoutTranscoding: | (NSString *_Nonnull) | url |
Starts pushing media streams to a CDN without transcoding.
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API. You can call this method to push an audio or video stream to the specified CDN address. This method can push media streams to only one CDN address at a time, so if you need to push streams to multiple addresses, call this method multiple times. After you call this method, the SDK triggers the rtcEngine:rtmpStreamingChangedToState:state:reason: callback on the local client to report the state of the streaming.
stopRtmpStream: first, then call this method to retry pushing streams; otherwise, the SDK returns the same error code as the last failed push.| url | The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported. |
| - (int) startRtmpStreamWithTranscoding: | (NSString *_Nonnull) | url | |
| transcoding: | (AgoraLiveTranscoding *_Nullable) | transcoding | |
Starts Media Push and sets the transcoding configuration.
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API. You can call this method to push a live audio-and-video stream to the specified CDN address and set the transcoding configuration. This method can push media streams to only one CDN address at a time, so if you need to push streams to multiple addresses, call this method multiple times. Under one Agora project, the maximum number of concurrent tasks to push media streams is 200 by default. If you need a higher quota, contact technical support. After you call this method, the SDK triggers the rtcEngine:rtmpStreamingChangedToState:state:reason: callback on the local client to report the state of the streaming.
stopRtmpStream: first, then call this method to retry pushing streams; otherwise, the SDK returns the same error code as the last failed push.| url | The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported. |
| transcoding | The transcoding configuration for Media Push. See AgoraLiveTranscoding. |
| - (int) updateRtmpTranscoding: | (AgoraLiveTranscoding *_Nullable) | transcoding |
Updates the transcoding configuration.
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API. After you start pushing media streams to CDN with transcoding, you can dynamically update the transcoding configuration according to the scenario. The SDK triggers the rtcEngineTranscodingUpdated: callback after the transcoding configuration is updated.
| transcoding | The transcoding configuration for Media Push. See AgoraLiveTranscoding. |
| - (int) stopRtmpStream: | (NSString *_Nonnull) | url |
Stops pushing media streams to a CDN.
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API. You can call this method to stop the live stream on the specified CDN address. This method can stop pushing media streams to only one CDN address at a time, so if you need to stop pushing streams to multiple addresses, call this method multiple times. After you call this method, the SDK triggers the rtcEngine:rtmpStreamingChangedToState:state:reason: callback on the local client to report the state of the streaming.
| url | The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported. |
| - (int) setScreenCaptureScenario: | (AgoraScreenScenarioType) | scenarioType |
Sets the screen sharing scenario.
When you start screen sharing or window sharing, you can call this method to set the screen sharing scenario. The SDK adjusts the video quality and experience of the sharing according to the scenario.
| scenarioType | The screen sharing scenario. See AgoraScreenScenarioType. |
| - (int) stopScreenCapture |
Stops screen capture.
Applicable scenarios:
startScreenCapture:, you need to call this method to stop screen capture.startScreenCaptureByWindowId:regionRect:captureParams: or startScreenCaptureByDisplayId:regionRect:captureParams:, you need to call this method to stop screen capture. Call timing: You can call this method either before or after joining a channel.| - (int) startScreenCapture: | (AgoraScreenCaptureParameters2 *_Nullable) | parameters |
Starts screen capture.
Applicable scenarios: In the screen sharing scenario, you need to call this method to start capturing the screen video stream. Call timing: You can call this method either before or after joining the channel, with the following differences:
joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: to join channel and set publishScreenCaptureVideo to YES to start screen sharing.updateChannelWithMediaOptions: and set publishScreenCaptureVideo to YES to start screen sharing. Related callbacks: When the state of the screen sharing extension process changes, the SDK triggers the rtcEngine:localVideoStateChangedOfState:reason:sourceType: callback accordingly. When the type of sourceType is AgoraVideoSourceTypeScreen, the state parameter indicates the state of the screen sharing.AgoraReplayKitExtension.xcframework. If the dynamic library is deleted, screen sharing cannot be enabled normally.AgoraAudioScenarioGameStreaming by using the setAudioScenario: method before joining the channel.dimensions in AgoraScreenVideoParameters:| parameters | The screen sharing encoding parameters. See AgoraScreenCaptureParameters2. |
| - (int) updateScreenCapture: | (AgoraScreenCaptureParameters2 *_Nullable) | parameters |
Updates the screen sharing configuration.
| parameters | The configuration of the screen sharing. |
| - (AgoraScreenCaptureFrameRateCapability) queryScreenCaptureCapability |
Queries the highest frame rate supported by the device during screen sharing.
Applicable scenarios: To ensure optimal screen sharing performance, particularly in enabling high frame rates like 60 fps, Agora recommends you to query the device's maximum supported frame rate using this method beforehand. This way, if the device cannot support such a high frame rate, you can adjust the screen sharing stream accordingly to avoid any negative impact on the sharing quality. If the device does not support high frame rate, you can reduce the frame rate of the screen sharing stream appropriately when sharing the screen to ensure that the sharing effect meets your expectation.
AgoraScreenCaptureFrameRateCapability.nil. | - (NSArray<AgoraFocalLengthInfo *>* _Nullable) queryCameraFocalLengthCapability |
Queries the focal length capability supported by the camera.
If you want to enable the wide-angle or ultra-wide-angle mode for camera capture, it is recommended to start by calling this method to check whether the device supports the required focal length capability. Then, adjust the camera's focal length configuration based on the query result by calling setCameraCapturerConfiguration:, ensuring the best camera capture performance.
AgoraFocalLengthInfo objects, which contain the camera's orientation and focal length type. | - (CGFloat) cameraMaxZoomFactor |
Gets the maximum zoom ratio supported by the camera.
rtcEngine:localVideoStateChangedOfState:reason:sourceType: callback and returns the local video state as AgoraVideoLocalStateCapturing (1).| - (int) switchCamera |
Switches between front and rear cameras.
You can call this method to dynamically switch cameras based on the actual camera availability during the app's runtime, without having to restart the video stream or reconfigure the video source. Call timing: This method must be called after the camera is successfully enabled, that is, after the SDK triggers the rtcEngine:localVideoStateChangedOfState:reason:sourceType: callback and returns the local video state as AgoraVideoLocalStateCapturing (1).
AgoraVideoSourceTypeCamera (0) when calling startCameraCapture:config:.| - (int) enableMultiCamera: | (BOOL) | enabled | |
| config: | (AgoraCameraCapturerConfiguration *_Nullable) | config | |
Enables or disables multi-camera capture.
In scenarios where there are existing cameras to capture video, Agora recommends that you use the following steps to capture and publish video with multiple cameras:1. Call this method to enable multi-channel camera capture.
startPreview: to start the local video preview.startCameraCapture:config:, and set sourceType to start video capture with the second camera.joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:, and set publishSecondaryCameraTrack to YES to publish the video stream captured by the second camera in the channel. If you want to disable multi-channel camera capture, use the following steps:1. Call stopCameraCapture:.enabled set to NO. When using this function, ensure that the system version is 13.0 or later. The minimum iOS device types that support multi-camera capture are as follows:startPreview: to enable multi-camera capture:startPreview:, the local video preview shows the image captured by the two cameras at the same time.startPreview:, the SDK stops the current camera capture first, and then enables the primary camera and the second camera. The local video preview appears black for a short time, and then automatically returns to normal.| enabled | Whether to enable multi-camera video capture mode:
|
| config | Capture configuration for the second camera. See AgoraCameraCapturerConfiguration. |
| - (int) enableCameraCenterStage: | (BOOL) | enabled |
Enables or disables portrait center stage.
The portrait center stage feature is off by default. You need to call this method to turn it on. If you need to disable this feature, you need to call this method again and set enabled to NO. Applicable scenarios: The portrait center stage feature can be widely used in scenarios such as online meetings, shows, online education, etc. The host can use this feature to ensure that they are always in the center of the screen, whether they move or not, in order to achieve a good display effect. Call timing: This method must be called after the camera is successfully enabled, that is, after the SDK triggers the rtcEngine:localVideoStateChangedOfState:reason:sourceType: callback and returns the local video state as AgoraVideoLocalStateCapturing (1).
isCameraCenterStageSupported to check whether the current device supports portrait center stage before enabling this feature.| enabled | Whether to enable the portrait center stage:
|
| - (int) startCameraCapture: | (AgoraVideoSourceType) | sourceType | |
| config: | (AgoraCameraCapturerConfiguration *_Nullable) | config | |
Starts camera capture.
You can call this method to start capturing video from one or more cameras by specifying sourceType.
enableMultiCamera:config: and set enabled to YES before calling this method.| sourceType | The type of the video source. See AgoraVideoSourceType. Note:
|
| config | The configuration of the video capture. See AgoraCameraCapturerConfiguration. Note: On iOS, this parameter has no practical function. Use the config parameter in enableMultiCamera:config: instead to set the video capture configuration. |
| - (int) stopCameraCapture: | (AgoraVideoSourceType) | sourceType |
Stops camera capture.
After calling startCameraCapture:config: to start capturing video through one or more cameras, you can call this method and set the sourceType parameter to stop the capture from the specified cameras.
enableMultiCamera:config: after calling this method and set enabled to NO.| sourceType | The type of the video source. See AgoraVideoSourceType. |
| - (int) enableFaceDetection: | (BOOL) | enable |
Enables or disables face detection for the local user.
Call timing: This method needs to be called after the camera is started (for example, by calling startPreview: or enableVideo ). Related callbacks: Once face detection is enabled, the SDK triggers the rtcEngine:facePositionDidChangeWidth:previewHeight:faces: callback to report the face information of the local user, which includes the following:
| enable | Whether to enable face detection for the local user:
|
| - (int) addVideoWatermark: | (NSURL *_Nonnull) | url | |
| options: | (WatermarkOptions *_Nonnull) | options | |
Adds a watermark image to the local video.
This method adds a PNG watermark image to the local video in the live streaming. Once the watermark image is added, all the audience in the channel (CDN audience included), and the capturing device can see and capture it. The Agora SDK supports adding only one watermark image onto a live video stream. The newly added watermark image replaces the previous one. The watermark coordinates are dependent on the settings in the setVideoEncoderConfiguration: method:
AgoraVideoOutputOrientationMode ) is fixed landscape mode or the adaptive landscape mode, the watermark uses the landscape orientation.AgoraVideoOutputOrientationMode ) is fixed portrait mode or the adaptive portrait mode, the watermark uses the portrait orientation.setVideoEncoderConfiguration: method; otherwise, the watermark image will be cropped. You can control the visibility of the watermark during preview by setting the visibleInPreview parameter when calling this method. However, whether it ultimately takes effect also depends on the position parameter you set when calling setupLocalVideo: (the position of the video frame in the video link). Refer to the table below for details. | Observation position | visibleInPreview value | Watermark visibility |
|---|---|---|
(Default) AgoraVideoModulePositionPostCapture | YES | Yes |
NO | No | |
AgoraVideoModulePositionPreEncoder | YES | Yes |
NO | Yes |
enableVideo.startRtmpStreamWithTranscoding:transcoding: method.| url | The local file path of the watermark image to be added. This method supports adding a watermark image from the local absolute or relative file path. |
| options | The options of the watermark image to be added. See WatermarkOptions. |
| - (int) addVideoWatermarkWithConfig: | (WatermarkConfig *_Nonnull) | config |
Adds a watermark image to the local video.
You can use this method to overlay a watermark image on the local video stream, and configure the watermark's position, size, and visibility in the preview using WatermarkConfig.
| config | Configuration of the watermark image. See WatermarkConfig. |
| - (int) removeVideoWatermark: | (NSString *_Nonnull) | id |
Removes the watermark image from the local video.
This method removes a previously added watermark image from the local video stream using the specified unique ID.
| id | The identifier of the watermark to be removed. |
| - (int) registerLocalUserAccount: | (NSString *_Nonnull) | userAccount | |
| appId: | (NSString *_Nonnull) | appId | |
Registers a user account.
Once registered, the user account can be used to identify the local user when the user joins the channel. After the registration is successful, the user account can identify the identity of the local user, and the user can use it to join the channel. This method is optional. If you want to join a channel using a user account, you can choose one of the following methods:
registerLocalUserAccountWithAppID:userAccount: method to register a user account, and then call the joinChannelByToken:channelId:userAccount:joinSuccess: or joinChannelByToken:channelId:userAccount:mediaOptions:joinSuccess: method to join a channel, which can shorten the time it takes to enter the channel.joinChannelByToken:channelId:userAccount:joinSuccess: or joinChannelByToken:channelId:userAccount:mediaOptions:joinSuccess: method to join a channel. Related callbacks: After successfully calling this method, the rtcEngine:didLocalUserRegisteredWithUserId:userAccount: callback will be triggered on the local client to report the local user's UID and user account.userAccount used when registering a User Account. If you want to join a channel with the original String userAccount used during registration, call the joinChannelByToken:channelId:userAccount:mediaOptions:joinSuccess: method to join the channel, instead of calling joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: and pass in the Int UID obtained through this methoduserAccount is unique in the channel.| appID | The App ID of your project on Agora Console. |
| userAccount | The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as nil. Supported characters are as follow(89 in total):
|
| - (int) joinChannelByToken: | (NSString *_Nullable) | token | |
| channelId: | (NSString *_Nonnull) | channelId | |
| userAccount: | (NSString *_Nonnull) | userAccount | |
| joinSuccess: | (void(^)(NSString *_Nonnull channel, NSUInteger uid, NSInteger elapsed)) | joinSuccessBlock | |
Joins a channel with a User Account and Token.
Before calling this method, if you have not called registerLocalUserAccountWithAppID:userAccount: to register a user account, when you call this method to join a channel, the SDK automatically creates a user account for you. Calling the registerLocalUserAccountWithAppID:userAccount: method to register a user account, and then calling this method to join a channel can shorten the time it takes to enter the channel. Once a user joins the channel, the user subscribes to the audio and video streams of all the other users in the channel by default, giving rise to usage and billings. To stop subscribing to a specified stream or all remote streams, call the corresponding mute methods. Call timing: Call this method after sharedEngineWithConfig:delegate:. Related callbacks: After the user successfully joins the channel, the SDK triggers the following callbacks:
rtcEngine:didLocalUserRegisteredWithUserId:userAccount:, rtcEngine:didJoinChannel:withUid:elapsed: and rtcEngine:connectionChangedToState:reason: callbacks.rtcEngine:didJoinedOfUid:elapsed: and rtcEngine:didUserInfoUpdatedWithUserId:userInfo: callbacks if a user joins the channel in the COMMUNICATION profile, or if a host joins the channel in the LIVE_BROADCASTING profile.sharedEngineWithConfig:delegate: method; otherwise, you may fail to join the channel with the token. To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a UID, then ensure all the other users use the UID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the ID of the user is set to the same parameter type.| token | The token generated on your server for authentication.Note:
|
| channelId | The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
|
| userAccount | The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as nil. Supported characters are as follows(89 in total):
|
| joinSuccessBlock | Occurs when a user joins a channel. joinSuccessBlock takes higher priority than rtcEngine:didJoinChannel:withUid:elapsed:. When both are implemented, rtcEngine:didJoinChannel:withUid:elapsed: does not take effect. Agora recommends setting joinSuccessBlock as nil to use rtcEngine:didJoinChannel:withUid:elapsed:. |
uid parameter is not set to an integer, or the value of a member in AgoraRtcChannelMediaOptions is invalid. You need to pass in a valid parameter and join the channel again.AgoraRtcEngineKit object. You need to reinitialize the AgoraRtcEngineKit object.AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method.AgoraRtcEngineKit object is wrong. The typical cause is that after calling startEchoTestWithConfig: to start a call loop test, you call this method to join the channel without calling stopEchoTest to stop the test. You need to call stopEchoTest before calling this method.rtcEngine:connectionChangedToState:reason: callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the AgoraConnectionStateDisconnected (1) state.channelId to rejoin the channel.uid to rejoin the channel. | - (int) joinChannelByToken: | (NSString *_Nullable) | token | |
| channelId: | (NSString *_Nonnull) | channelId | |
| userAccount: | (NSString *_Nonnull) | userAccount | |
| mediaOptions: | (AgoraRtcChannelMediaOptions *_Nonnull) | mediaOptions | |
| joinSuccess: | (void(^)(NSString *_Nonnull channel, NSUInteger uid, NSInteger elapsed)) | joinSuccessBlock | |
Join a channel using a user account and token, and set the media options.
Before calling this method, if you have not called registerLocalUserAccountWithAppID:userAccount: to register a user account, when you call this method to join a channel, the SDK automatically creates a user account for you. Calling the registerLocalUserAccountWithAppID:userAccount: method to register a user account, and then calling this method to join a channel can shorten the time it takes to enter the channel. Compared to joinChannelByToken:channelId:userAccount:joinSuccess:, this method has the options parameter which is used to set media options, such as whether to publish audio and video streams within a channel. By default, the user subscribes to the audio and video streams of all the other users in the channel, giving rise to usage and billings. To stop subscribing to other streams, set the options parameter or call the corresponding mute methods. Call timing: Call this method after sharedEngineWithConfig:delegate:. Related callbacks: After the user successfully joins the channel, the SDK triggers the following callbacks:
rtcEngine:didLocalUserRegisteredWithUserId:userAccount:, rtcEngine:didJoinChannel:withUid:elapsed: and rtcEngine:connectionChangedToState:reason: callbacks.rtcEngine:didJoinedOfUid:elapsed: and rtcEngine:didUserInfoUpdatedWithUserId:userInfo: callbacks if a user joins the channel in the COMMUNICATION profile, or if a host joins the channel in the LIVE_BROADCASTING profile.sharedEngineWithConfig:delegate: method; otherwise, you may fail to join the channel with the token. To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a UID, then ensure all the other users use the UID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the ID of the user is set to the same parameter type.| token | The token generated on your server for authentication.Note:
|
| channelId | The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
|
| userAccount | The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as nil. Supported characters are as follows(89 in total):
|
| mediaOptions | The channel media options. See AgoraRtcChannelMediaOptions. |
| joinSuccessBlock | Occurs when a user joins a channel. joinSuccessBlock takes higher priority than rtcEngine:didJoinChannel:withUid:elapsed:. When both are implemented, rtcEngine:didJoinChannel:withUid:elapsed: does not take effect. Agora recommends setting joinSuccessBlock as nil to use rtcEngine:didJoinChannel:withUid:elapsed:. |
uid parameter is not set to an integer, or the value of a member in AgoraRtcChannelMediaOptions is invalid. You need to pass in a valid parameter and join the channel again.AgoraRtcEngineKit object. You need to reinitialize the AgoraRtcEngineKit object.AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method.AgoraRtcEngineKit object is wrong. The typical cause is that after calling startEchoTestWithConfig: to start a call loop test, you call this method to join the channel without calling stopEchoTest to stop the test. You need to call stopEchoTest before calling this method.rtcEngine:connectionChangedToState:reason: callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the AgoraConnectionStateDisconnected (1) state.channelId to rejoin the channel.uid to rejoin the channel. | - (AgoraUserInfo* _Nullable) getUserInfoByUserAccount: | (NSString *_Nonnull) | userAccount | |
| withError: | (AgoraErrorCode *_Nullable) | error | |
Gets the user information by passing in the user account.
After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object, and triggers the rtcEngine:didUserInfoUpdatedWithUserId:userInfo: callback on the local client. After receiving the callback, you can call this method and pass in the user account to get the UID of the remote user from the AgoraUserInfo object. Call timing: Call this method after receiving the rtcEngine:didUserInfoUpdatedWithUserId:userInfo: callback. Related callbacks: rtcEngine:didUserInfoUpdatedWithUserId:userInfo:
| userAccount | The user account. |
| error | Error code. |
AgoraUserInfo instance, if the method call succeeds.| - (AgoraUserInfo* _Nullable) getUserInfoByUid: | (NSUInteger) | uid | |
| withError: | (AgoraErrorCode *_Nullable) | error | |
Gets the user information by passing in the user ID.
After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object, and triggers the rtcEngine:didUserInfoUpdatedWithUserId:userInfo: callback on the local client. After receiving the callback, you can call this method and pass in the UID to get the user account of the specified user from the AgoraUserInfo object. Call timing: Call this method after receiving the rtcEngine:didUserInfoUpdatedWithUserId:userInfo: callback. Related callbacks: rtcEngine:didUserInfoUpdatedWithUserId:userInfo:
| uid | The user ID. |
| error | Error code. |
AgoraUserInfo instance, if the method call succeeds.| - (BOOL) setAudioFrameDelegate: | (id< AgoraAudioFrameDelegate > _Nullable) | delegate |
Registers an audio frame observer object.
Call this method to register an audio frame observer object (register a callback). When you need the SDK to trigger the onMixedAudioFrame:channelId:, onRecordAudioFrame:channelId:, onPlaybackAudioFrame:, onPlaybackAudioFrameBeforeMixing:channelId:uid: or onEarMonitoringAudioFrame: callback, you need to use this method to register the callbacks. Call timing: Call this method before joining a channel.
| delegate | The observer instance. See AgoraAudioFrameDelegate. Set the value as nil to release the instance. Agora recommends calling this method after receiving rtcEngine:didLeaveChannelWithStats: to release the audio observer object. |
YES: Success.NO: Failure. | - (BOOL) setVideoFrameDelegate: | (id< AgoraVideoFrameDelegate > _Nullable) | delegate |
Registers a raw video frame observer object.
If you want to observe raw video frames (such as YUV or RGBA format), Agora recommends that you implement one AgoraVideoFrameDelegate class with this method. When calling this method to register a video observer, you can register callbacks in the AgoraVideoFrameDelegate class as needed. After you successfully register the video frame observer, the SDK triggers the registered callbacks each time a video frame is received. Applicable scenarios: After registering the raw video observer, you can use the obtained raw video data in various video pre-processing scenarios, such as virtual backgrounds and image enhacement by yourself. Agora provides an open source iOS sample project BeautyAPI on GitHub for your reference. Call timing: Call this method before joining a channel.
width and height parameters, which may be adapted under the following circumstances:| delegate | The observer instance. See AgoraVideoFrameDelegate. To release the instance, set the value as nil. |
YES: Success.NO: Failure. | - (BOOL) setEncodedVideoFrameDelegate: | (id< AgoraEncodedVideoFrameDelegate > _Nullable) | delegate |
Registers a receiver object for the encoded video image.
If you only want to observe encoded video frames (such as H.264 format) without decoding and rendering the video, Agora recommends that you implement one AgoraEncodedVideoFrameDelegate class through this method.
| delegate | The observer instance. See AgoraEncodedVideoFrameDelegate. Set the value as nil to release the instance. |
YES: Success.NO: Failure. | - (BOOL) setFaceInfoDelegate: | (id< AgoraFaceInfoDelegate > _Nullable) | delegate |
Registers or unregisters a facial information observer.
You can call this method to register the onFaceInfo: callback to receive the facial information processed by Agora speech driven extension. When calling this method to register a facial information observer, you can register callbacks in the AgoraFaceInfoDelegate class as needed. After successfully registering the facial information observer, the SDK triggers the callback you have registered when it captures the facial information converted by the speech driven extension. Applicable scenarios: Facial information processed by the Agora speech driven extension is BS (Blend Shape) data that complies with ARkit standards. You can further process the BS data using third-party 3D rendering engines, such as driving avatar to make mouth movements corresponding to speech.
enableExtensionWithVendor:extension:enabled:sourceType:.| delegate | Facial information observer, see AgoraFaceInfoDelegate. If you need to unregister a facial information observer, pass in nil. |
| - (BOOL) setMediaMetadataDataSource: | (id< AgoraMediaMetadataDataSource > _Nullable) | metadataDataSource | |
| withType: | (AgoraMetadataType) | type | |
Sets the data source of the metadata.
You need to implement the AgoraMediaMetadataDataSource protocol in this method and specify the data format of the metadata. After a successful method call, the SDK triggers the metadataMaxSize callback. This method can be used with setMediaMetadataDelegate:withType: to add synchronized metadata in the video stream for more diversified live interactions, such as sending shopping links, digital coupons, and online quizzes.
| metadataDataSource | The AgoraMediaMetadataDataSource protocol. |
| type | The metadata type. The SDK currently only supports AgoraMetadataTypeVideo. See AgoraMetadataType. |
YES: Success.NO: Failure. | - (BOOL) setMediaMetadataDelegate: | (id< AgoraMediaMetadataDelegate > _Nullable) | metadataDelegate | |
| withType: | (AgoraMetadataType) | type | |
Registers the metadata observer.
You need to implement the AgoraMediaMetadataDelegate class and specify the metadata type in this method. This method enables you to add synchronized metadata in the video stream for more diversified live interactive streaming, such as sending shopping links, digital coupons, and online quizzes. A successful call of this method triggers the metadataMaxSize callback.
joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:.| observer | The metadata observer. See AgoraMediaMetadataDelegate. |
| type | The metadata type. The SDK currently only supports AgoraMetadataTypeVideo. See AgoraMetadataType. |
| + (NSString * _Nonnull) getSdkVersion |
Gets the SDK version.
| + (NSString* _Nonnull) getErrorDescription: | (NSInteger) | error |
Gets the warning or error description.
| error | The error code reported by the SDK. |
| - (int) setLogFile: | (NSString *_Nonnull) | filePath |
Sets the log file.
Specifies an SDK output log file. The log file records all log data for the SDK’s operation. Call timing: This method needs to be called immediately after sharedEngineWithConfig:delegate:, otherwise the output log may be incomplete.
| filePath | The complete path of the log files. These log files are encoded in UTF-8. |
| - (int) setLogFilter: | (NSUInteger) | filter |
Sets the log output level of the SDK.
This method sets the output log level of the SDK. You can use one or a combination of the log filter levels. The log level follows the sequence of AgoraLogFilterOff, AgoraLogFilterCritical, AgoraLogFilterError, AgoraLogFilterWarning, AgoraLogFilterInfo, and AgoraLogFilterDebug. Choose a level to see the logs preceding that level. If, for example, you set the log level to AgoraLogFilterWarning, you see the logs within levels AgoraLogFilterCritical, AgoraLogFilterError and AgoraLogFilterWarning.
| filter | The output log level of the SDK. See AgoraLogFilter. |
| - (int) setLogFileSize: | (NSUInteger) | fileSizeInKBytes |
Sets the log file size.
By default, the SDK generates five SDK log files and five API call log files with the following rules:
agorasdk.log, agorasdk.1.log, agorasdk.2.log, agorasdk.3.log, and agorasdk.4.log.agoraapi.log, agoraapi.1.log, agoraapi.2.log, agoraapi.3.log, and agoraapi.4.log.agorasdk.log or agoraapi.log.agorasdk.log is full, the SDK processes the log files in the following order:1. Delete the agorasdk.4.log file (if any).agorasdk.3.log to agorasdk.4.log.agorasdk.2.log to agorasdk.3.log.agorasdk.1.log to agorasdk.2.log.agorasdk.log file.agoraapi.log file are the same as for agorasdk.log.agorasdk.log file only and does not effect the agoraapi.log file.| fileSizeInKBytes | The size (KB) of an agorasdk.log file. The value range is [128,20480]. The default value is 2,048 KB. If you set fileSizeInKByte smaller than 128 KB, the SDK automatically adjusts it to 128 KB; if you set fileSizeInKByte greater than 20,480 KB, the SDK automatically adjusts it to 20,480 KB. |
| - (NSString * _Nullable) uploadLogFile |
Upload current log file immediately to server. only use this when an error occurs block before log file upload success or timeout.
| - (int) writeLog: | (AgoraLogLevel) | level | |
| content: | (NSString *_Nonnull) | content | |
You can Write the log to SDK log files of the specified level
| level | Log level: AgoraLogLevel. |
| - (NSString * _Nullable) getCallId |
Retrieves the call ID.
When a user joins a channel on a client, a callId is generated to identify the call from the client. You can call this method to get callId, and pass it in when calling methods such as rate:rating:description: and complain:description:. Call timing: Call this method after joining a channel.
| - (int) rate: | (NSString *_Nonnull) | callId | |
| rating: | (NSInteger) | rating | |
| description: | (NSString *_Nullable) | description | |
Allows a user to rate a call after the call ends.
| callId | The current call ID. You can get the call ID by calling getCallId. |
| rating | The value is between 1 (the lowest score) and 5 (the highest score). |
| description | (Optional) A description of the call. The string length should be less than 800 bytes. |
| - (int) complain: | (NSString *_Nonnull) | callId | |
| description: | (NSString *_Nullable) | description | |
Allows a user to complain about the call quality after a call ends.
This method allows users to complain about the quality of the call. Call this method after the user leaves the channel.
| callId | The current call ID. You can get the call ID by calling getCallId. |
| description | (Optional) A description of the call. The string length should be less than 800 bytes. |
AgoraRtcEngineKit is initialized. | - (int) startLastmileProbeTest: | (AgoraLastmileProbeConfig *_Nullable) | config |
Starts the last mile network probe test.
This method starts the last-mile network probe test before joining a channel to get the uplink and downlink last mile network statistics, including the bandwidth, packet loss, jitter, and round-trip time (RTT). Call timing: Do not call other methods before receiving the rtcEngine:lastmileQuality: and rtcEngine:lastmileProbeTestResult: callbacks. Otherwise, the callbacks may be interrupted. Related callbacks: After successfully calling this method, the SDK sequentially triggers the following 2 callbacks:
rtcEngine:lastmileQuality:: The SDK triggers this callback within two seconds depending on the network conditions. This callback rates the network conditions and is more closely linked to the user experience.rtcEngine:lastmileProbeTestResult:: The SDK triggers this callback within 30 seconds depending on the network conditions. This callback returns the real-time statistics of the network conditions and is more objective.| config | The configurations of the last-mile network probe test. See AgoraLastmileProbeConfig. |
| - (int) stopLastmileProbeTest |
Stops the last mile network probe test.
| - (uint64_t) getNtpWallTimeInMs |
Gets the current NTP (Network Time Protocol) time.
In the real-time chorus scenario, especially when the downlink connections are inconsistent due to network issues among multiple receiving ends, you can call this method to obtain the current NTP time as the reference time, in order to align the lyrics and music of multiple receiving ends and achieve chorus synchronization.
| - (id<AgoraRtcMediaPlayerProtocol>_Nullable) createMediaPlayerWithDelegate: | (id< AgoraRtcMediaPlayerDelegate >_Nullable) | delegate |
Creates a media player instance.
Before calling any APIs in the AgoraRtcMediaPlayerProtocol class, you need to call this method to create an instance of the media player. If you need to create multiple instances, you can call this method multiple times. Call timing: You can call this method either before or after joining a channel.
| delegate | The event handler for AgoraRtcEngineKit. See AgoraRtcEngineDelegate. |
AgoraRtcMediaPlayerProtocol object, if the method call succeeds.AgoraRtcMediaPlayerProtocol instance, if the method call succeeds. | - (id<AgoraRtcMediaPlayerCacheManagerProtocol> _Nullable) createMediaPlayerCacheManager |
Creates one AgoraRtcMediaPlayerCacheManagerProtocol instance.
Before calling any APIs in the AgoraRtcMediaPlayerCacheManagerProtocol class, you need to call this method to get a cache manager instance of a media player. Call timing: Make sure the AgoraRtcEngineKit is initialized before you call this method.
AgoraRtcMediaPlayerCacheManagerProtocol instance. | - (int) destroyMediaPlayer: | (id< AgoraRtcMediaPlayerProtocol >_Nullable) | mediaPlayer |
Destroys the media player instance.
| mediaPlayer | AgoraRtcMediaPlayerProtocol object. |
| - (id<AgoraRtcMediaPlayerProtocol> _Nullable) getMediaPlayer: | (int) | mediaPlayerId |
getMediaPlayer
| mediaPlayerId | of the mediaPlayer. |
| - (int) startRhythmPlayer: | (NSString *_Nonnull) | sound1 | |
| sound2: | (NSString *_Nonnull) | sound2 | |
| config: | (AgoraRhythmPlayerConfig *_Nullable) | config | |
Enables the virtual metronome.
beatsPerMinute you set in AgoraRhythmPlayerConfig. For example, if you set beatsPerMinute as 60, the SDK plays one beat every second. If the file duration exceeds the beat duration, the SDK only plays the audio within the beat duration.publishRhythmPlayerTrack in AgoraRtcChannelMediaOptions as YES. Applicable scenarios: In music education, physical education and other scenarios, teachers usually need to use a metronome so that students can practice with the correct beat. The meter is composed of a downbeat and upbeats. The first beat of each measure is called a downbeat, and the rest are called upbeats. Call timing: This method can be called either before or after joining the channel. Related callbacks: After successfully calling this method, the SDK triggers the rtcEngine:didRhythmPlayerStateChanged:reason: callback locally to report the status of the virtual metronome.| sound1 | The absolute path or URL address (including the filename extensions) of the file for the downbeat. For example, /var/mobile/Containers/Data/audio.mp4. For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support. |
| sound2 | The absolute path or URL address (including the filename extensions) of the file for the upbeats. For example, /var/mobile/Containers/Data/audio.mp4. For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support. |
| config | The metronome configuration. See AgoraRhythmPlayerConfig. |
sound1 and sound2. | - (int) stopRhythmPlayer |
Disables the virtual metronome.
After calling startRhythmPlayer:sound2:config:, you can call this method to disable the virtual metronome.
| - (int) configRhythmPlayer: | (AgoraRhythmPlayerConfig *_Nullable) | config |
Configures the virtual metronome.
startRhythmPlayer:sound2:config:, you can call this method to reconfigure the virtual metronome.beatsPerMinute you set in AgoraRhythmPlayerConfig. For example, if you set beatsPerMinute as 60, the SDK plays one beat every second. If the file duration exceeds the beat duration, the SDK only plays the audio within the beat duration.publishRhythmPlayerTrack in AgoraRtcChannelMediaOptions as YES. Call timing: This method can be called either before or after joining the channel. Related callbacks: After successfully calling this method, the SDK triggers the rtcEngine:didRhythmPlayerStateChanged:reason: callback locally to report the status of the virtual metronome.| config | The metronome configuration. See AgoraRhythmPlayerConfig. |
| - (int) setDirectCdnStreamingAudioConfiguration: | (AgoraAudioProfile) | profile |
Sets the audio profile of the audio streams directly pushed to the CDN by the host.
When you set the publishMicrophoneTrack or publishCustomAudioTrack in the AgoraDirectCdnStreamingMediaOptions as YES to capture audios, you can call this method to set the audio profile.
| profile | The audio profile, including the sampling rate, bitrate, encoding mode, and the number of channels. See AgoraAudioProfile. |
| - (int) setDirectCdnStreamingVideoConfiguration: | (AgoraVideoEncoderConfiguration *_Nonnull) | config |
Sets the video profile of the media streams directly pushed to the CDN by the host.
This method only affects video streams captured by cameras or screens, or from custom video capture sources. That is, when you set publishCameraTrack or publishCustomVideoTrack in AgoraDirectCdnStreamingMediaOptions as YES to capture videos, you can call this method to set the video profiles. If your local camera does not support the video resolution you set,the SDK automatically adjusts the video resolution to a value that is closest to your settings for capture, encoding or streaming, with the same aspect ratio as the resolution you set. You can get the actual resolution of the video streams through the onDirectCdnStreamingStats: callback.
| config | Video profile. See AgoraVideoEncoderConfiguration.Note: During CDN live streaming, Agora only supports setting AgoraVideoOutputOrientationMode as AgoraVideoOutputOrientationModeFixedLandscape or AgoraVideoOutputOrientationModeFixedPortrait. |
| - (int) startDirectCdnStreaming: | (id< AgoraDirectCdnStreamingEventDelegate > _Nonnull) | delegate | |
| publishUrl: | (NSString *_Nonnull) | publishUrl | |
| mediaOptions: | (AgoraDirectCdnStreamingMediaOptions *_Nonnull) | options | |
Starts pushing media streams to the CDN directly.
Aogra does not support pushing media streams to one URL repeatedly. Media options Agora does not support setting the value of publishCameraTrack and publishCustomVideoTrack as YES, or the value of publishMicrophoneTrack and publishCustomAudioTrack as YES at the same time. When choosing media setting options ( AgoraDirectCdnStreamingMediaOptions ), you can refer to the following examples: If you want to push audio and video streams captured by the host from a custom source, the media setting options should be set as follows:
publishCustomAudioTrack is set as YES and call the pushExternalAudioFrameSampleBuffer:sampleRate:channels:trackId: or pushExternalAudioFrameRawData:samples:sampleRate:channels:trackId:timestamp: methodpublishCustomVideoTrack is set as YES and call the pushExternalVideoFrame:videoTrackId: methodpublishCameraTrack is set as NO (the default value)publishMicrophoneTrack is set as NO (the default value) As of v4.2.0, Agora SDK supports audio-only live streaming. You can set publishCustomAudioTrack or publishMicrophoneTrack in AgoraDirectCdnStreamingMediaOptions as YES and call pushExternalAudioFrameSampleBuffer:sampleRate:channels:trackId: or pushExternalAudioFrameRawData:samples:sampleRate:channels:trackId:timestamp: to push audio streams.| delegate | See onDirectCdnStreamingStateChanged:reason:message: and onDirectCdnStreamingStats:. |
| publishUrl | The CDN live streaming URL. |
| options | The media setting options for the host. See AgoraDirectCdnStreamingMediaOptions. |
| - (int) stopDirectCdnStreaming |
Stops pushing media streams to the CDN directly.
| - (int) updateDirectCdnStreamingMediaOptions: | (AgoraDirectCdnStreamingMediaOptions *_Nonnull) | options |
Change the media source during the pushing
| - (int) setAdvancedAudioOptions: | (AgoraAdvancedAudioOptions *_Nonnull) | options |
Sets audio advanced options.
If you have advanced audio processing requirements, such as capturing and sending stereo audio, you can call this method to set advanced audio options.
joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:, enableAudio and enableLocalAudio:.| options | The advanced options for audio. See AgoraAdvancedAudioOptions. |
| - (int) sendCustomReportMessage: | (NSString *_Nullable) | messageId | |
| category: | (NSString *_Nullable) | category | |
| event: | (NSString *_Nullable) | event | |
| label: | (NSString *_Nullable) | label | |
| value: | (NSInteger) | value | |
Reports customized messages.
Agora supports reporting and analyzing customized messages. This function is in the beta stage with a free trial. The ability provided in its beta test version is reporting a maximum of 10 message pieces within 6 seconds, with each message piece not exceeding 256 bytes and each string not exceeding 100 bytes. To try out this function, contact support@agora.io and discuss the format of customized messages with us.
| - (int) setLogLevel: | (AgoraLogLevel) | level |
Sets the output log level of the SDK.
Choose a level to see the logs preceding that level.
| level | The log level. See AgoraLogLevel. |
| - (int) setLocalAccessPoint: | (AgoraLocalAccessPointConfiguration *_Nonnull) | config |
Configures the connection to the Agora private media server access module.
After successfully deploying the Agora private media server and integrating the 4.x RTC SDK on an intranet client, you can call this method to specify the Local Access Point and assign the access module to the SDK.
Call timing: You must call this method before joining a channel.
contact sales to learn more about and deploy the Agora Hybrid Cloud.| config | The Local Access Point configuration. See AgoraLocalAccessPointConfiguration for details. |
Error Codes for details and troubleshooting advice. | - (int) setCloudProxy: | (AgoraCloudProxyType) | proxyType |
Sets up cloud proxy service.
When users' network access is restricted by a firewall, configure the firewall to allow specific IP addresses and ports provided by Agora; then, call this method to enable the cloud proxyType and set the cloud proxy type with the proxyType parameter. After successfully connecting to the cloud proxy, the SDK triggers the rtcEngine:connectionChangedToState:reason: ( AgoraConnectionStateConnecting, AgoraConnectionChangedReasonSettingProxyServer ) callback. To disable the cloud proxy that has been set, call the setCloudProxy:(AgoraNoneProxy). To change the cloud proxy type that has been set, call the setCloudProxy: (AgoraNoneProxy) first, and then call the setCloudProxy: to set the proxyType you want.
startAudioMixing:loopback:cycle:startPos: method to play online music files in the HTTP protocol. The services for Media Push and cohosting across channels use the cloud proxy with the TCP protocol.| proxyType | The type of the cloud proxy. See AgoraCloudProxyType. This parameter is mandatory. The SDK reports an error if you do not pass in a value. |
| - (NSInteger) takeSnapshot: | (NSInteger) | uid | |
| filePath: | (NSString *_Nonnull) | filePath | |
Takes a snapshot of a video stream.
This method takes a snapshot of a video stream from the specified user, generates a JPG image, and saves it to the specified path. Call timing: Call this method after joining a channel. Related callbacks: After a successful call of this method, the SDK triggers the rtcEngine:snapshotTaken:filePath:width:height:errCode: callback to report whether the snapshot is successfully taken, as well as the details for that snapshot.
AgoraRtcChannelMediaOptions.| uid | The user ID. Set uid as 0 if you want to take a snapshot of the local user's video. |
| filePath | The local path (including filename extensions) of the snapshot. For example:
|
| - (NSInteger) takeSnapshotWithConfig: | (NSInteger) | uid | |
| config: | (AgoraSnapshotConfig *_Nonnull) | config | |
Takes a screenshot of the video at the specified observation point.
This method takes a snapshot of a video stream from the specified user, generates a JPG image, and saves it to the specified path. Call timing: Call this method after joining a channel. Related callbacks: After a successful call of this method, the SDK triggers the rtcEngine:snapshotTaken:filePath:width:height:errCode: callback to report whether the snapshot is successfully taken, as well as the details for that snapshot.
AgoraRtcChannelMediaOptions.| uid | The user ID. Set uid as 0 if you want to take a snapshot of the local user's video. |
| config | The configuration of the snaptshot. See AgoraSnapshotConfig. |
| - (int) enableContentInspect: | (BOOL) | enabled | |
| config: | (AgoraContentInspectConfig *_Nonnull) | config | |
Enables or disables video screenshot and upload.
When video screenshot and upload function is enabled, the SDK takes screenshots and uploads videos sent by local users based on the type and frequency of the module you set in AgoraContentInspectConfig. After video screenshot and upload, the Agora server sends the callback notification to your app server in HTTPS requests and sends all screenshots to the third-party cloud storage service. Call timing: This method can be called either before or after joining the channel.
AgoraContentInspectTypeSupervise ), the video screenshot and upload dynamic library AgoraContentInspectExtension.xcframework (iOS) or AgoraContentInspectExtension.framework (macOS) is required. Deleting this library disables the screenshot and upload feature.| enabled | Whether to enalbe video screenshot and upload:
|
| config | Screenshot and upload configuration. See AgoraContentInspectConfig. |
| - (int) setAVSyncSource: | (NSString *_Nonnull) | channelId | |
| uid: | (NSUInteger) | uid | |
Sets audio-video synchronization on the publishing side.
A single user may use two separate devices to send audio and video streams respectively. To ensure that the audio and video are synchronized in time on the receiving side, you can call this method on the video publishing device and pass in the channel name and user ID of the audio publishing device. The SDK automatically adjusts the video stream based on the timestamp of the sent audio stream. This ensures audio-video synchronization on the receiving end even when the two publishing devices are on different uplink networks (e.g., Wi-Fi and 4G).
| channelId | The channel name where the audio publishing device is located. |
| uid | The user ID of the audio publishing device. |
Error Codes for details and troubleshooting advice. | - (int) sendAudioMetadata: | (NSData *_Nonnull) | metadata |
send audio metadata
| metadata | The NSData of metadata |
| - (int) enableVideoImageSource: | (BOOL) | enable | |
| options: | (AgoraImageTrackOptions *_Nullable) | options | |
Sets whether to replace the current video feeds with images when publishing video streams.
When publishing video streams, you can call this method to replace the current video feeds with custom images. Once you enable this function, you can select images to replace the video feeds through the AgoraImageTrackOptions parameter. If you disable this function, the remote users see the video feeds that you publish. Call timing: Call this method after joining a channel.
| enable | Whether to replace the current video feeds with custom images:
|
| options | Image configurations. See AgoraImageTrackOptions. |
| - (int) getNetworkType |
Gets the type of the local network connection.
You can use this method to get the type of network in use at any stage.
| - (AgoraMediaRecorder * _Nullable) createMediaRecorder: | (AgoraRecorderStreamInfo *_Nonnull) | info |
Creates a media recording object.
Before starting audio and video stream recording, you need to call this method to create a media recording object. The SDK supports recording multiple audio and video streams from either local or remote users. You can call this method multiple times to create multiple recording objects, and use the info parameter to specify the channel name and the user ID of the stream to be recorded.
After successfully creating the object, you need to call setMediaRecorderDelegate: to register an observer for the recording object in order to listen for related callbacks, and then call startRecording: to start recording.
| info | Information about the audio and video stream to be recorded. See AgoraRecorderStreamInfo. |
AgoraMediaRecorder object.| - (int) destroyMediaRecorder: | (AgoraMediaRecorder *_Nullable) | mediaRecorder |
Destroys the audio and video recording object.
When you no longer need to record audio and video streams, you can call this method to destroy the corresponding audio and video recording object. If recording is in progress, call stopRecording to stop the recording first, and then call this method to destroy the audio and video recording object.
| mediaRecorder | The AgoraMediaRecorder object to be destroyed. |
Error Codes for details and troubleshooting suggestions. | - (id<AgoraH265TranscoderProtocol>_Nullable) getH265Transcoder |
Get the H265Transcoder instance
| - (int) enableWebSdkInteroperability: | (BOOL) | enabled |
Enables interoperability with the Agora Web SDK (applicable only in the live streaming.
You can call this method to enable or disable interoperability with the Agora Web SDK. If a channel has Web SDK users, ensure that you call this method, or the video of the Native user will be a black screen for the Web user. This method is only applicable in live streaming scenarios, and interoperability is enabled by default in communication scenarios.
| enabled | Whether to enable interoperability:
|
| - (int) setAudioProfile: | (AgoraAudioProfile) | profile | |
| scenario: | (AgoraAudioScenario) | scenario | |
Sets the audio profile and audio scenario.
Applicable scenarios: This method is suitable for various audio scenarios. You can choose as needed. For example, in scenarios with high audio quality requirements such as music teaching, it is recommended to set profile to AgoraAudioProfileMusicHighQuality(4) and scenario to AgoraAudioScenarioGameStreaming(3). Call timing: You can call this method either before or after joining a channel.
AgoraAudioScenarioGameStreaming(3). In this scenario, the SDK will switch to media volume to avoid this issue.| profile | The audio profile, including the sampling rate, bitrate, encoding mode, and the number of channels. See AgoraAudioProfile. |
| scenario | The audio scenarios. Under different audio scenarios, the device uses different volume types. See AgoraAudioScenario. |
| - (int) setExternalAudioSource: | (BOOL) | enabled | |
| sampleRate: | (NSInteger) | sampleRate | |
| channels: | (NSInteger) | channels | |
Sets the external audio source.
Call this method before calling joinChannelByToken:channelId:info:uid:joinSuccess: and startPreview.
| enabled | - YES: Enable the external audio source.
|
| sampleRate | The sample rate (Hz) of the external audio source, which can be set as 8000, 16000, 32000, 44100, or 48000. |
| channels | The number of audio channels of the external audio source:
|
| - (int) setExternalAudioSource: | (BOOL) | enabled | |
| sampleRate: | (NSInteger) | sampleRate | |
| channels: | (NSInteger) | channels | |
| localPlayback: | (BOOL) | localPlayback | |
| publish: | (BOOL) | publish | |
Sets the external audio source parameters.
Call timing: Call this method before joining a channel.
| enabled | Whether to enable the external audio source:
|
| sampleRate | The sample rate (Hz) of the external audio source which can be set as 8000, 16000, 32000, 44100, or 48000. |
| channels | The number of channels of the external audio source, which can be set as 1 (Mono) or 2 (Stereo). |
| localPlayback | Whether to play the external audio source:
|
| publish | Whether to publish audio to the remote users:
|
| - (int) setLocalRenderMode: | (NSUInteger) | uid | |
| mode: | (AgoraVideoRenderMode) | mode | |
Sets the local video display mode.
Call this method to set the local video display mode. This method can be called multiple times during a call to change the display mode.
| mode | The local video display mode. See AgoraVideoRenderMode. |
| uid | The user ID. |
| - (int) enableExternalAudioSourceLocalPlayback: | (BOOL) | enable |
Enable or disable the external audio source local playback.
| enable | Determines whether to enable the external audio source local playback: |
| - (void) addDelegate: | (id< AgoraRtcEngineDelegate > _Nonnull) | delegate |
Adds multiple SDK delegate.
| delegate | The AgoraRtcEngineDelegate object. |
| - (void) removeDelegate: | (id< AgoraRtcEngineDelegate > _Nonnull) | delegate |
Removes multiple SDK delegate.
| delegate | The AgoraRtcEngineDelegate object. |
| - (int) joinChannelExByToken: | (NSString *_Nullable) | token | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
| delegate: | (id< AgoraRtcEngineDelegate > _Nullable) | delegate | |
| mediaOptions: | (AgoraRtcChannelMediaOptions *_Nonnull) | mediaOptions | |
| joinSuccess: | (void(^)(NSString *_Nonnull channel, NSUInteger uid, NSInteger elapsed)) | joinSuccessBlock | |
Join a channel using a token, and set the media options.
Before calling this method, if you have not called registerLocalUserAccountWithAppID:userAccount: to register a user account, when you call this method to join a channel, the SDK automatically creates a user account for you. Calling the registerLocalUserAccountWithAppID:userAccount: method to register a user account, and then calling this method to join a channel can shorten the time it takes to enter the channel. Once a user joins the channel, the user subscribes to the audio and video streams of all the other users in the channel by default, giving rise to usage and billings. If you want to stop subscribing to the media stream of other users, you can set the mediaOptions parameter or call the corresponding mute method. Call timing: Call this method after sharedEngineWithConfig:delegate:. Related callbacks: After the user successfully joins the channel, the SDK triggers the following callbacks:
rtcEngine:didLocalUserRegisteredWithUserId:userAccount:, rtcEngine:didJoinChannel:withUid:elapsed: and rtcEngine:connectionChangedToState:reason: callbacks.rtcEngine:didJoinedOfUid:elapsed: and rtcEngine:didUserInfoUpdatedWithUserId:userInfo: callbacks if a user joins the channel in the COMMUNICATION profile, or if a host joins the channel in the LIVE_BROADCASTING profile.sharedEngineWithConfig:delegate: method; otherwise, you may fail to join the channel with the token. To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a UID, then ensure all the other users use the UID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the ID of the user is set to the same parameter type.| token | The token generated on your server for authentication.Note:
|
| connection | The connection information. See AgoraRtcConnection. |
| delegate | The callback class of AgoraRtcEngine. See AgoraRtcEngineDelegate. You can get the callback events of multiple channels through the delegte object passed in this parameter. |
| mediaOptions | The channel media options. See AgoraRtcChannelMediaOptions. |
| joinSuccessBlock | Occurs when a user joins a channel. joinSuccessBlock takes higher priority than rtcEngine:didJoinChannel:withUid:elapsed:. When both are implemented, rtcEngine:didJoinChannel:withUid:elapsed: does not take effect. Agora recommends setting joinSuccessBlock as nil to use rtcEngine:didJoinChannel:withUid:elapsed:. |
uid parameter is not set to an integer, or the value of a member in AgoraRtcChannelMediaOptions is invalid. You need to pass in a valid parameter and join the channel again.AgoraRtcEngineKit object. You need to reinitialize the AgoraRtcEngineKit object.AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method.AgoraRtcEngineKit object is wrong. The typical cause is that after calling startEchoTestWithConfig: to start a call loop test, you call this method to join the channel without calling stopEchoTest to stop the test. You need to call stopEchoTest before calling this method.rtcEngine:connectionChangedToState:reason: callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the AgoraConnectionStateDisconnected (1) state.channelId to rejoin the channel.uid to rejoin the channel. Provided by category AgoraRtcEngineKit(Ex).
| - (int) joinChannelExByToken: | (NSString *_Nullable) | token | |
| channelId: | (NSString *_Nonnull) | channelId | |
| userAccount: | (NSString *_Nonnull) | userAccount | |
| delegate: | (id< AgoraRtcEngineDelegate > _Nullable) | delegate | |
| mediaOptions: | (AgoraRtcChannelMediaOptions *_Nonnull) | mediaOptions | |
| joinSuccess: | (void(^)(NSString *_Nonnull channel, NSUInteger uid, NSInteger elapsed)) | joinSuccessBlock | |
Join a channel using a user account and token, and set the media options.
Before calling this method, if you have not called registerLocalUserAccountWithAppID:userAccount: to register a user account, when you call this method to join a channel, the SDK automatically creates a user account for you. Calling the registerLocalUserAccountWithAppID:userAccount: method to register a user account, and then calling this method to join a channel can shorten the time it takes to enter the channel. Once a user joins the channel, the user subscribes to the audio and video streams of all the other users in the channel by default, giving rise to usage and billings. If you want to stop subscribing to the media stream of other users, you can set the mediaOptions parameter or call the corresponding mute method. Call timing: Call this method after sharedEngineWithConfig:delegate:. Related callbacks: After the user successfully joins the channel, the SDK triggers the following callbacks:
rtcEngine:didLocalUserRegisteredWithUserId:userAccount:, rtcEngine:didJoinChannel:withUid:elapsed: and rtcEngine:connectionChangedToState:reason: callbacks.rtcEngine:didJoinedOfUid:elapsed: and rtcEngine:didUserInfoUpdatedWithUserId:userInfo: callbacks if a user joins the channel in the COMMUNICATION profile, or if a host joins the channel in the LIVE_BROADCASTING profile.sharedEngineWithConfig:delegate: method; otherwise, you may fail to join the channel with the token. To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a UID, then ensure all the other users use the UID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the ID of the user is set to the same parameter type.| token | The token generated on your server for authentication.Note:
|
| channelId | The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
|
| userAccount | The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as nil. Supported characters are as follows(89 in total):
|
| delegate | The callback class of AgoraRtcEngine. See AgoraRtcEngineDelegate. You can get the callback events of multiple channels through the delegte object passed in this parameter. |
| mediaOptions | The channel media options. See AgoraRtcChannelMediaOptions. |
| joinSuccessBlock | Occurs when a user joins a channel. joinSuccessBlock takes higher priority than rtcEngine:didJoinChannel:withUid:elapsed:. When both are implemented, rtcEngine:didJoinChannel:withUid:elapsed: does not take effect. Agora recommends setting joinSuccessBlock as nil to use rtcEngine:didJoinChannel:withUid:elapsed:. |
uid parameter is not set to an integer, or the value of a member in AgoraRtcChannelMediaOptions is invalid. You need to pass in a valid parameter and join the channel again.AgoraRtcEngineKit object. You need to reinitialize the AgoraRtcEngineKit object.AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method.AgoraRtcEngineKit object is wrong. The typical cause is that after calling startEchoTestWithConfig: to start a call loop test, you call this method to join the channel without calling stopEchoTest to stop the test. You need to call stopEchoTest before calling this method.rtcEngine:connectionChangedToState:reason: callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the AgoraConnectionStateDisconnected (1) state.channelId to rejoin the channel.uid to rejoin the channel. Provided by category AgoraRtcEngineKit(Ex).
| - (int) updateChannelExWithMediaOptions: | (AgoraRtcChannelMediaOptions *_Nonnull) | mediaOptions | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Updates the channel media options after joining the channel.
| options | The channel media options. See AgoraRtcChannelMediaOptions. |
| connection | The connection information. See AgoraRtcConnection. |
AgoraRtcChannelMediaOptions is invalid. For example, the token or the user ID is invalid. You need to fill in a valid parameter.AgoraRtcEngineKit object has not been initialized. You need to initialize the AgoraRtcEngineKit object before calling this method.AgoraRtcEngineKit object is wrong. The possible reason is that the user is not in the channel. Agora recommends that you use the rtcEngine:connectionChangedToState:reason: callback to see whether the user is in the channel. If you receive the AgoraConnectionStateDisconnected (1) or AgoraConnectionStateFailed (5) state, the user is not in the channel. You need to call joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: to join a channel before calling this method. Provided by category AgoraRtcEngineKit(Ex).
| - (int) setDelegateEx: | (id< AgoraRtcEngineDelegate > _Nullable) | delegate | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Resets the SDK delegate.
The SDK uses the delegate to inform the app on engine runtime events. All methods defined in the delegate are optional implementation methods.
| delegate | The AgoraRtcEngineDelegate protocol. |
| connection | The AgoraRtcConnection object. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) muteLocalAudioStreamEx: | (BOOL) | mute | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops or resumes publishing the local audio stream.
A successful call of this method triggers the rtcEngine:didAudioMuted:byUid: and rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed: callbacks on the remote client.
| mute | Whether to stop publishing the local audio stream:
|
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) muteLocalVideoStreamEx: | (BOOL) | mute | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops or resumes publishing the local video stream.
A successful call of this method triggers the rtcEngine:didVideoMuted:byUid: callback on the remote client.
| mute | Whether to stop publishing the local video stream.
|
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) muteRemoteAudioStreamEx: | (NSUInteger) | uid | |
| mute: | (BOOL) | mute | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops or resumes receiving the audio stream of a specified user.
This method is used to stops or resumes receiving the audio stream of a specified user. You can call this method before or after joining a channel. If a user leaves a channel, the settings in this method become invalid.
| uid | The ID of the specified user. |
| mute | Whether to stop receiving the audio stream of the specified user:
|
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) muteAllRemoteAudioStreamsEx: | (BOOL) | mute | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops or resumes subscribing to the audio streams of all remote users.
After successfully calling this method, the local user stops or resumes subscribing to the audio streams of all remote users, including the ones join the channel subsequent to this call.
autoSubscribeAudio as NO when calling joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:.| mute | Whether to stop subscribing to the audio streams of all remote users:
|
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setVideoEncoderConfigurationEx: | (AgoraVideoEncoderConfiguration *_Nonnull) | config | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the video encoder configuration.
Sets the encoder configuration for the local video. Each configuration profile corresponds to a set of video parameters, including the resolution, frame rate, and bitrate. Call timing: Call this method after joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:.
config specified in this method is the maximum value under ideal network conditions. If the video engine cannot render the video using the specified config due to unreliable network conditions, the parameters further down the list are considered until a successful configuration is found.| config | Video profile. See AgoraVideoEncoderConfiguration. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setupRemoteVideoEx: | (AgoraRtcVideoCanvas *_Nonnull) | remote | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Initializes the video view of a remote user.
This method initializes the video view of a remote stream on the local device. It affects only the video view that the local user sees. Call this method to bind the remote video stream to a video view and to set the rendering and mirror modes of the video view. The application specifies the uid of the remote video in the AgoraRtcVideoCanvas method before the remote user joins the channel. If the remote uid is unknown to the application, set it after the application receives the rtcEngine:didJoinedOfUid:elapsed: callback. If the Video Recording function is enabled, the Video Recording Service joins the channel as a dummy client, causing other clients to also receive the onUserJoined callback. Do not bind the dummy client to the application view because the dummy client does not send any video streams. To unbind the remote user from the view, set the view parameter to NULL. Once the remote user leaves the channel, the SDK unbinds the remote user.
joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:.setRemoteRenderModeEx:mode:mirror:connection: method.| remote | The remote video view settings. See AgoraRtcVideoCanvas. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setRemoteRenderModeEx: | (NSUInteger) | uid | |
| mode: | (AgoraVideoRenderMode) | mode | |
| mirror: | (AgoraVideoMirrorMode) | mirror | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the video display mode of a specified remote user.
After initializing the video view of a remote user, you can call this method to update its rendering and mirror modes. This method affects only the video view that the local user sees.
setupRemoteVideo: method.| uid | The user ID of the remote user. |
| mode | The video display mode of the remote user. See AgoraVideoRenderMode. |
| mirror | The mirror mode of the remote user view. See AgoraVideoMirrorMode. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) muteRemoteVideoStreamEx: | (NSUInteger) | uid | |
| mute: | (BOOL) | mute | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops or resumes receiving the video stream of a specified user.
This method is used to stop or resume receiving the video stream of a specified user. You can call this method before or after joining a channel. If a user leaves a channel, the settings in this method become invalid.
| uid | The user ID of the remote user. |
| mute | Whether to stop receiving the video stream of the specified user:
|
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) muteAllRemoteVideoStreamsEx: | (BOOL) | mute | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops or resumes subscribing to the video streams of all remote users.
After successfully calling this method, the local user stops or resumes subscribing to the video streams of all remote users, including all subsequent users.
| mute | Whether to stop subscribing to the video streams of all remote users.
|
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) enableDualStreamModeEx: | (BOOL) | enabled | |
| streamConfig: | (AgoraSimulcastStreamConfig *) | streamConfig | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Enables or disables dual-stream mode on the sender side.
You can call this method to enable or disable the dual-stream mode on the publisher side. Dual streams are a pairing of a high-quality video stream and a low-quality video stream:
setRemoteVideoStream:type: to choose to receive either the high-quality video stream or the low-quality video stream on the subscriber side.| enabled | Whether to enable dual-stream mode:
|
| streamConfig | The configuration of the low-quality video stream. See AgoraSimulcastStreamConfig.Note: When setting mode to AgoraDisableSimulcastStream, setting streamConfig will not take effect. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setDualStreamModeEx: | (AgoraSimulcastStreamMode) | mode | |
| streamConfig: | (AgoraSimulcastStreamConfig *) | streamConfig | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the dual-stream mode on the sender side.
The SDK defaults to enabling low-quality video stream adaptive mode ( AgoraAutoSimulcastStream ) on the sender side, which means the sender does not actively send low-quality video stream. The receiving end with the role of the host can initiate a low-quality video stream request by calling setRemoteVideoStreamEx:type:connection:, and upon receiving the request, the sending end automatically starts sending low-quality stream.
mode to AgoraDisableSimulcastStream (never send low-quality video streams) or AgoraEnableSimulcastStream (always send low-quality video streams).mode set to AgoraAutoSimulcastStream.enableDualStreamModeEx:streamConfig:connection: is as follows:mode to AgoraDisableSimulcastStream, it has the same effect as enableDualStreamModeEx:streamConfig:connection: (NO).mode to AgoraEnableSimulcastStream, it has the same effect as enableDualStreamModeEx:streamConfig:connection: (YES).| mode | The mode in which the video stream is sent. See AgoraSimulcastStreamMode. |
| streamConfig | The configuration of the low-quality video stream. See AgoraSimulcastStreamConfig.Note: When setting mode to AgoraDisableSimulcastStream, setting streamConfig will not take effect. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setSimulcastConfigEx: | (AgoraSimulcastConfig *) | simulcastConfig | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the simulcast video stream configuration.
This method can be called in scenarios involving multiple channels. You can call the setSimulcastConfig method to set video streams with different resolutions for the same video source. The subscribers can call to select which stream layer to receive. The broadcaster can publish up to four layers of video streams: one main stream (highest resolution) and three additional streams of different quality levels. setRemoteVideoStream:type: Applicable scenarios: This method can be called in scenarios involving multiple channels.
| simulcastConfig | Configuration for different video steam layers. This configuration includes seven layers, from AgoraStreamLayer1 to AgoraStreamLow, with a maximum of three layers enabled simultaneously. See AgoraSimulcastConfig. |
| connection | One AgoraRtcConnection object. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setRemoteVideoStreamEx: | (NSUInteger) | uid | |
| type: | (AgoraVideoStreamType) | streamType | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the video stream type to subscribe to.
Depending on the default behavior of the sender and the specific settings when calling setDualStreamMode:streamConfig:, the scenarios for the receiver calling this method are as follows:
AgoraAutoSimulcastStream ) on the sender side by default, meaning only the high-quality video stream is transmitted. Only the receiver with the role of the **host**can call this method to initiate a low-quality video stream request. Once the sender receives the request, it starts automatically sending the low-quality video stream. At this point, all users in the channel can call this method to switch to low-quality video stream subscription mode.setDualStreamMode:streamConfig: and sets mode to AgoraDisableSimulcastStream (never send low-quality video stream), then calling this method will have no effect.setDualStreamMode:streamConfig: and sets mode to AgoraEnableSimulcastStream (always send low-quality video stream), both the host and audience receivers can call this method to switch to low-quality video stream subscription mode. The SDK will dynamically adjust the size of the corresponding video stream based on the size of the video window to save bandwidth and computing resources. The default aspect ratio of the low-quality video stream is the same as that of the high-quality video stream. According to the current aspect ratio of the high-quality video stream, the system will automatically allocate the resolution, frame rate, and bitrate of the low-quality video stream.setDualStreamModeEx:streamConfig:connection: and set mode to AgoraDisableSimulcastStream (never send low-quality video stream), calling this method will not take effect, you should call setDualStreamModeEx:streamConfig:connection: again on the sending end and adjust the settings.| uid | The user ID. |
| streamType | The video stream type, see AgoraVideoStreamType. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setRemoteVideoSubscriptionOptionsEx: | (NSUInteger) | uid | |
| options: | (AgoraVideoSubscriptionOptions *_Nonnull) | options | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets options for subscribing to remote video streams.
When a remote user has enabled dual-stream mode, you can call this method to choose the option for subscribing to the video streams sent by the remote user.
| uid | The user ID of the remote user. |
| options | The video subscription options. See AgoraVideoSubscriptionOptions. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (AgoraUserInfo* _Nullable) getUserInfoByUserAccountEx: | (NSString *_Nonnull) | userAccount | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
| withError: | (AgoraErrorCode *_Nullable) | error | |
Gets the user information by passing in the user account.
After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object, and triggers the rtcEngine:didUserInfoUpdatedWithUserId:userInfo: callback on the local client. After receiving the callback, you can call this method and pass in the UID to get the user account of the specified user from the AgoraUserInfo object.
| userAccount | The user account. |
| connection | The connection information. See AgoraRtcConnection. |
| error | Error code. |
Provided by category AgoraRtcEngineKit(Ex).
| - (AgoraUserInfo* _Nullable) getUserInfoByUidEx: | (NSUInteger) | uid | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
| withError: | (AgoraErrorCode *_Nullable) | error | |
Gets the user information by passing in the user ID.
After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object, and triggers the rtcEngine:didUserInfoUpdatedWithUserId:userInfo: callback on the local client. After receiving the callback, you can call this method and pass in the UID to get the user account of the specified user from the AgoraUserInfo object.
| uid | The user ID. |
| error | Error code. |
| connection | The connection information. See AgoraRtcConnection. |
AgoraUserInfo object, if the method call succeeds.Provided by category AgoraRtcEngineKit(Ex).
| - (AgoraConnectionState) getConnectionStateEx: | (AgoraRtcConnection *_Nonnull) | connection |
Gets the current connection state of the SDK.
Call timing: This method can be called either before or after joining the channel.
| connection | The connection information. See AgoraRtcConnection. |
AgoraConnectionState. Provided by category AgoraRtcEngineKit(Ex).
| - (int) adjustRecordingSignalVolumeEx: | (NSInteger) | volume | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Adjusts the recording volume.
| volume | The recording volume, which ranges from 0 to 400:
|
| connection | AgoraRtcConnection by channelId and uid combine |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) muteRecordingSignalEx: | (BOOL) | mute | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Mutes or resume recording signal volume.
| mute | Determines whether to mute or resume the recording signal volume.
|
| connection | AgoraRtcConnection by channelId and uid combine |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) adjustUserPlaybackSignalVolumeEx: | (NSUInteger) | uid | |
| volume: | (NSInteger) | volume | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Adjusts the playback signal volume of a specified remote user.
You can call this method to adjust the playback volume of a specified remote user. To adjust the playback volume of different remote users, call the method as many times, once for each remote user. Call timing: Call this method after joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:.
| uid | The user ID of the remote user. |
| volume | The volume of the user. The value range is [0,400].
|
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) sendCustomReportMessageEx: | (NSString *_Nullable) | messageId | |
| category: | (NSString *_Nullable) | category | |
| event: | (NSString *_Nullable) | event | |
| label: | (NSString *_Nullable) | label | |
| value: | (NSInteger) | value | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Agora supports reporting and analyzing customized messages.
Agora supports reporting and analyzing customized messages. This function is in the beta stage with a free trial. The ability provided in its beta test version is reporting a maximum of 10 message pieces within 6 seconds, with each message piece not exceeding 256 bytes and each string not exceeding 100 bytes. To try out this function, contact support@agora.io and discuss the format of customized messages with us.
Provided by category AgoraRtcEngineKit(Ex).
| - (int) enableAudioVolumeIndicationEx: | (NSInteger) | interval | |
| smooth: | (NSInteger) | smooth | |
| reportVad: | (BOOL) | reportVad | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Enables the reporting of users' volume indication.
This method enables the SDK to regularly report the volume information to the app of the local user who sends a stream and remote users (three users at most) whose instantaneous volumes are the highest. Call timing: Call this method after joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:. Related callbacks: The SDK triggers the rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume: callback according to the interval you set if this method is successfully called and there are users publishing streams in the channel.
| interval | Sets the time interval between two consecutive volume indications:
|
| smooth | The smoothing factor that sets the sensitivity of the audio volume indicator. The value ranges between 0 and 10. The recommended value is 3. The greater the value, the more sensitive the indicator. |
| reportVad | - YES: Enables the voice activity detection of the local user. Once it is enabled, the vad parameter of the rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume: callback reports the voice activity status of the local user.
|
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setRemoteVoicePositionEx: | (NSUInteger) | uid | |
| pan: | (double) | pan | |
| gain: | (double) | gain | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the 2D position (the position on the horizontal plane) of the remote user's voice.
This method sets the voice position and volume of a remote user. 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.
| 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:
|
| 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. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) addVideoWatermarkEx: | (NSURL *_Nonnull) | url | |
| options: | (WatermarkOptions *_Nonnull) | options | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Adds a watermark image to the local video.
This method adds a PNG watermark image to the local video in the live streaming. Once the watermark image is added, all the audience in the channel (CDN audience included), and the capturing device can see and capture it. The Agora SDK supports adding only one watermark image onto a live video stream. The newly added watermark image replaces the previous one. The watermark coordinates are dependent on the settings in the setVideoEncoderConfigurationEx:connection: method:
AgoraVideoOutputOrientationMode ) is fixed landscape mode or the adaptive landscape mode, the watermark uses the landscape orientation.AgoraVideoOutputOrientationMode ) is fixed portrait mode or the adaptive portrait mode, the watermark uses the portrait orientation.setVideoEncoderConfigurationEx:connection: method; otherwise, the watermark image will be cropped.enableVideo before calling this method.startPreview: method, you can use the visibleInPreview member to set whether or not the watermark is visible in the preview.| url | The local file path of the watermark image to be added. This method supports adding a watermark image from the local absolute or relative file path. |
| options | The options of the watermark image to be added. See WatermarkOptions. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) addVideoWatermarkEx: | (WatermarkConfig *_Nonnull) | configs | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Adds a watermark image to the local video.
Applicable scenarios: This method applies to multi-channel scenarios.
| configs | Watermark configuration. See WatermarkConfig. |
| connection | AgoraRtcConnection object. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) removeVideoWatermarkEx: | (NSString *_Nonnull) | id | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Removes the specified watermark image from the local or remote video stream.
Applicable scenarios: This method applies to multi-channel scenarios.
| id | Identifier of the watermark to be removed. |
| connection | Connection information, including channel ID and user ID. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) clearVideoWatermarkEx: | (AgoraRtcConnection *_Nonnull) | connection |
Removes the watermark image from the video stream.
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) createDataStreamEx: | (NSInteger *_Nonnull) | streamId | |
| reliable: | (BOOL) | reliable | |
| ordered: | (BOOL) | ordered | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Creates a data stream.
You can call this method to create a data stream and improve the reliability and ordering of data transmission. Call timing: Call this method after joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:. Related callbacks: After setting reliable to YES, if the recipient does not receive the data within five seconds, the SDK triggers the rtcEngine:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached: callback and returns an error code.
AgoraRtcEngineKit. The data stream will be destroyed when leaving the channel, and the data stream needs to be recreated if needed.| streamId | An output parameter; the ID of the data stream created. |
| reliable | Sets whether the recipients are guaranteed to receive the data stream within five seconds:
|
| ordered | Sets whether the recipients receive the data stream in the sent order:
|
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) createDataStreamEx: | (NSInteger *_Nonnull) | streamId | |
| config: | (AgoraDataStreamConfig *_Nonnull) | config | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Creates a data stream.
Compared to createDataStreamEx:reliable:ordered:connection:, this method does not guarantee the reliability of data transmission. If a data packet is not received five seconds after it was sent, the SDK directly discards the data. Call timing: Call this method after joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:.
AgoraRtcEngineKit. The data stream will be destroyed when leaving the channel, and the data stream needs to be recreated if needed. If you need a more comprehensive solution for low-latency, high-concurrency, and scalable real-time messaging and status synchronization, it is recommended to use Signaling.| streamId | An output parameter; the ID of the data stream created. |
| config | The configurations for the data stream. See AgoraDataStreamConfig. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) sendStreamMessageEx: | (NSInteger) | streamId | |
| data: | (NSData *_Nonnull) | data | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sends data stream messages.
After calling createDataStream:config:, you can call this method to send data stream messages to all users in the channel. The SDK has the following restrictions on this method:
rtcEngine:receiveStreamMessageFromUid:streamId:data: callback on the remote client, from which the remote user gets the stream message. A failed method call triggers the rtcEngine:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached: callback on the remote client.Signaling.createDataStream:config: and joining the channel.| streamId | The data stream ID. You can get the data stream ID by calling createDataStream:config:. |
| data | The message to be sent. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) sendRdtMessageEx: | (NSInteger) | uid | |
| type: | (AgoraRdtStreamType) | type | |
| data: | (NSData *_Nonnull) | data | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Send Reliable message to remote uid in channel.
@technical preview
| uid | remote user id. |
| type | Reliable Data Transmission tunnel message type. See AgoraRdtStreamType. |
| data | The sent data. |
| connection | AgoraRtcConnection by channelId and uid combine. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) sendMediaControlMessageEx: | (NSInteger) | uid | |
| data: | (NSData *_Nonnull) | data | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Send media control message.
@technical preview
| uid | Remote user id. In particular, if the uid is set to 0, it means broadcasting the message to the entire channel. |
| data | The sent data. |
| connection | AgoraRtcConnection by channelId and uid combine. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setHighPriorityUserListEx: | (NSArray< NSNumber * > *_Nullable) | uidList | |
| option: | (AgoraStreamFallbackOptions) | option | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the high priority user list and related remote subscribe fallback option.
| uidList | The uid list of high priority users. |
| option | The remote subscribe fallback option of high priority users. |
| connection | AgoraRtcConnection by channelId and uid combine. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setSubscribeAudioAllowlistEx: | (NSArray< NSNumber * > *_Nonnull) | allowlist | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the allowlist of subscriptions for audio streams.
You can call this method to specify the audio streams of a user that you want to subscribe to.
muteRemoteAudioStream:mute:, muteAllRemoteAudioStreams: and autoSubscribeAudio in AgoraRtcChannelMediaOptions.| allowlist | The user ID list of users that you want to subscribe to. If you want to specify the audio streams of a user for subscription, add the user ID in this list. If you want to remove a user from the allowlist, you need to call the setSubscribeAudioAllowlist: method to update the user ID list; this means you only add the uid of users that you want to subscribe to in the new user ID list. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setSubscribeVideoAllowlistEx: | (NSArray< NSNumber * > *_Nonnull) | allowlist | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the allowlist of subscriptions for video streams.
You can call this method to specify the video streams of a user that you want to subscribe to.
muteRemoteVideoStream:mute:, muteAllRemoteVideoStreams: and autoSubscribeAudio in AgoraRtcChannelMediaOptions.| allowlist | The user ID list of users that you want to subscribe to. If you want to specify the video streams of a user for subscription, add the user ID in this list. If you want to remove a user from the allowlist, you need to call the setSubscribeVideoAllowlistEx: method to update the user ID list; this means you only add the uid of users that you want to subscribe to in the new user ID list. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (NSInteger) takeSnapshotEx: | (AgoraRtcConnection *_Nonnull) | connection | |
| uid: | (NSInteger) | uid | |
| filePath: | (NSString *_Nonnull) | filePath | |
Takes a snapshot of a video stream using connection ID.
This method takes a snapshot of a video stream from the specified user, generates a JPG image, and saves it to the specified path. Call timing: Call this method after joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:. Related callbacks: After a successful call of this method, the SDK triggers the rtcEngine:snapshotTaken:filePath:width:height:errCode: callback to report whether the snapshot is successfully taken, as well as the details for that snapshot.
AgoraRtcChannelMediaOptions.| connection | The connection information. See AgoraRtcConnection. |
| uid | The user ID. Set uid as 0 if you want to take a snapshot of the local user's video. |
| filePath | The local path (including filename extensions) of the snapshot. For example:
|
Provided by category AgoraRtcEngineKit(Ex).
| - (NSInteger) takeSnapshotExWithConfig: | (AgoraRtcConnection *_Nonnull) | connection | |
| uid: | (NSInteger) | uid | |
| config: | (AgoraSnapshotConfig *_Nonnull) | config | |
Gets a video screenshot of the specified observation point using the connection ID.
This method takes a snapshot of a video stream from the specified user, generates a JPG image, and saves it to the specified path. Call timing: Call this method after joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:. Related callbacks: After a successful call of this method, the SDK triggers the rtcEngine:snapshotTaken:filePath:width:height:errCode: callback to report whether the snapshot is successfully taken, as well as the details for that snapshot.
AgoraRtcChannelMediaOptions.| connection | The connection information. See AgoraRtcConnection. |
| uid | The user ID. Set uid as 0 if you want to take a snapshot of the local user's video. |
| config | The configuration of the snaptshot. See AgoraSnapshotConfig. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) sendAudioMetadataEx: | (AgoraRtcConnection *_Nonnull) | connection | |
| metadata: | (NSData *_Nonnull) | metadata | |
send audio metadata
| metadata | The NSData of metadata |
| connection | AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) enableContentInspectEx: | (BOOL) | enabled | |
| config: | (AgoraContentInspectConfig *_Nonnull) | config | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Enables or disables video screenshot and upload.
This method can take screenshots for multiple video streams and upload them. When video screenshot and upload function is enabled, the SDK takes screenshots and uploads videos sent by local users based on the type and frequency of the module you set in AgoraContentInspectConfig. After video screenshot and upload, the Agora server sends the callback notification to your app server in HTTPS requests and sends all screenshots to the third-party cloud storage service. Call timing: This method can be called either before or after joining the channel.
technical support to activate the video screenshot upload service.| enabled | Whether to enalbe video screenshot and upload:
|
| config | Screenshot and upload configuration. See AgoraContentInspectConfig. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) startRtmpStreamWithoutTranscodingEx: | (NSString *_Nonnull) | url | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Starts pushing media streams to a CDN without transcoding.
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API. You can call this method to push an audio or video stream to the specified CDN address. This method can push media streams to only one CDN address at a time, so if you need to push streams to multiple addresses, call this method multiple times. After you call this method, the SDK triggers the rtcEngine:rtmpStreamingChangedToState:state:reason: callback on the local client to report the state of the streaming.
stopRtmpStream: first, then call this method to retry pushing streams; otherwise, the SDK returns the same error code as the last failed push.| url | The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) startRtmpStreamWithTranscodingEx: | (NSString *_Nonnull) | url | |
| transcoding: | (AgoraLiveTranscoding *_Nullable) | transcoding | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Starts Media Push and sets the transcoding configuration.
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API. You can call this method to push a live audio-and-video stream to the specified CDN address and set the transcoding configuration. This method can push media streams to only one CDN address at a time, so if you need to push streams to multiple addresses, call this method multiple times. After you call this method, the SDK triggers the rtcEngine:rtmpStreamingChangedToState:state:reason: callback on the local client to report the state of the streaming.
stopRtmpStreamEx:connection: first, then call this method to retry pushing streams; otherwise, the SDK returns the same error code as the last failed push.| url | The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported. |
| transcoding | The transcoding configuration for Media Push. See AgoraLiveTranscoding. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) updateRtmpTranscodingEx: | (AgoraLiveTranscoding *_Nullable) | transcoding | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Updates the transcoding configuration.
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API. After you start pushing media streams to CDN with transcoding, you can dynamically update the transcoding configuration according to the scenario. The SDK triggers the rtcEngineTranscodingUpdated: callback after the transcoding configuration is updated.
| transcoding | The transcoding configuration for Media Push. See AgoraLiveTranscoding. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) stopRtmpStreamEx: | (NSString *_Nonnull) | url | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops pushing media streams to a CDN.
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API. You can call this method to stop the live stream on the specified CDN address. This method can stop pushing media streams to only one CDN address at a time, so if you need to stop pushing streams to multiple addresses, call this method multiple times. After you call this method, the SDK triggers the rtcEngine:rtmpStreamingChangedToState:state:reason: callback on the local client to report the state of the streaming.
| url | The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) startOrUpdateChannelMediaRelayEx: | (AgoraChannelMediaRelayConfiguration *_Nonnull) | config | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Starts relaying media streams across channels or updates channels for media relay.
The first successful call to this method starts relaying media streams from the source channel to the destination channels. To relay the media stream to other channels, or exit one of the current media relays, you can call this method again to update the destination channels. This feature supports relaying media streams to a maximum of six destination channels. After a successful method call, the SDK triggers the rtcEngine:channelMediaRelayStateDidChange:error: callback, and this callback returns the state of the media stream relay. Common states are as follows:
rtcEngine:channelMediaRelayStateDidChange:error: callback returns AgoraChannelMediaRelayStateRunning (2) and AgoraChannelMediaRelayErrorNone (0), it means that the SDK starts relaying media streams from the source channel to the destination channel.rtcEngine:channelMediaRelayStateDidChange:error: callback returns AgoraChannelMediaRelayStateFailure (3), an exception occurs during the media stream relay.technical support.| config | The configuration of the media stream relay. See AgoraChannelMediaRelayConfiguration. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) stopChannelMediaRelayEx: | (AgoraRtcConnection *_Nonnull) | connection |
Stops the media stream relay. Once the relay stops, the host quits all the target channels.
After a successful method call, the SDK triggers the rtcEngine:channelMediaRelayStateDidChange:error: callback. If the callback reports AgoraChannelMediaRelayStateIdle (0) and AgoraChannelMediaRelayErrorNone (0), the host successfully stops the relay.
rtcEngine:channelMediaRelayStateDidChange:error: callback with the AgoraChannelMediaRelayErrorServerNoResponse (2) or AgoraChannelMediaRelayErrorServerConnectionLost (8) status code. You can call the leaveChannel:leaveChannelBlock: method to leave the channel, and the media stream relay automatically stops.| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) pauseAllChannelMediaRelayEx: | (AgoraRtcConnection *_Nonnull) | connection |
Pauses the media stream relay to all target channels.
After the cross-channel media stream relay starts, you can call this method to pause relaying media streams to all target channels; after the pause, if you want to resume the relay, call resumeAllChannelMediaRelay.
startOrUpdateChannelMediaRelayEx:connection:.| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) resumeAllChannelMediaRelayEx: | (AgoraRtcConnection *_Nonnull) | connection |
Resumes the media stream relay to all target channels.
After calling the pauseAllChannelMediaRelayEx: method, you can call this method to resume relaying media streams to all destination channels.
pauseAllChannelMediaRelayEx:.| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) startMediaRenderingTracingEx: | (AgoraRtcConnection *_Nonnull) | connection |
Enables tracing the video frame rendering process.
The SDK starts tracing the rendering status of the video frames in the channel from the moment this method is successfully called and reports information about the event through the rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo: callback. Applicable scenarios: Agora recommends that you use this method in conjunction with the UI settings (such as buttons and sliders) in your app to improve the user experience. For example, call this method when the user clicks the Join Channel button, and then get the time spent during the video frame rendering process through the rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo: callback, so as to optimize the indicators accordingly.
joinChannelByToken:channelId:uid:mediaOptions:joinSuccess: to join the channel. You can call this method at an appropriate time according to the actual application scenario to set the starting position for tracking video rendering events.| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) setParametersEx: | (NSString *_Nonnull) | options | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options.
| options | SDK options in JSON format. |
| connection | AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (NSString * _Nullable) getCallIdEx: | (AgoraRtcConnection *_Nonnull) | connection |
Gets the call ID with the connection ID.
When a user joins a channel on a client, a callId is generated to identify the call from the client. You can call this method to get callId, and pass it in when calling methods such as rate:rating:description: and complain:description:. Call timing: Call this method after joining a channel.
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
| - (void) addDelegateEx: | (id< AgoraRtcEngineDelegate > _Nonnull) | delegate | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Adds multiple SDK delegate.
| delegate | The AgoraRtcEngineDelegate object. |
| connection | The AgoraRtcConnection object. |
Provided by category AgoraRtcEngineKit(Ex).
| - (void) removeDelegateEx: | (id< AgoraRtcEngineDelegate > _Nonnull) | delegate | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Removes multiple SDK delegate.
| delegate | The AgoraRtcEngineDelegate object. |
| connection | The AgoraRtcConnection object. |
Provided by category AgoraRtcEngineKit(Ex).
| - (int) enableEncryptionEx: | (BOOL) | enabled | |
| encryptionConfig: | (AgoraEncryptionConfig *_Nonnull) | config | |
| connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Enables or disables the built-in encryption.
After the user leaves the channel, the SDK automatically disables the built-in encryption. To enable the built-in encryption, call this method before the user joins the channel again. Applicable scenarios: Scenarios with higher security requirements. Call timing: Call this method before joining a channel.
| enabled | Whether to enable built-in encryption:
|
| config | Built-in encryption configurations. See AgoraEncryptionConfig. |
| connection | The connection information. See AgoraRtcConnection. |
Provided by category AgoraRtcEngineKit(Ex).
|
readwritenonatomicweak |
Sets and retrieves AgoraRtcEngineDelegate.
The SDK uses AgoraRtcEngineDelegate to inform the app on engine runtime events. All methods defined in the delegate are optional implementation methods.