Agora RTC Objective-C API Reference
Refactor
|
Data Steam | |
(int) | - createDataStreamEx:reliable:ordered:connection: |
(int) | - createDataStreamEx:config:connection: |
(int) | - sendStreamMessageEx:data:connection: |
Stream Publish | |
(int) | - setSubscribeAudioAllowlistEx:connection: |
(int) | - setSubscribeVideoAllowlistEx:connection: |
(int) | - startRtmpStreamWithoutTranscodingEx:connection: |
(int) | - startRtmpStreamWithTranscodingEx:transcoding:connection: |
(int) | - updateRtmpTranscodingEx:connection: |
(int) | - stopRtmpStreamEx:connection: |
(int) | - startChannelMediaRelayEx:connection: |
(int) | - updateChannelMediaRelayEx:connection: |
(int) | - stopChannelMediaRelayEx: |
(int) | - pauseAllChannelMediaRelayEx: |
(int) | - resumeAllChannelMediaRelayEx: |
- (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 | |
Joins a channel.
You can call this method multiple times to join multiple channels.
token | The token for authentication.
|
connection | AgoraRtcConnection by channelId and uid combine |
delegate | AgoraRtcEngineDelegate protocol.(Need a new object when called) |
mediaOptions | AgoraRtcChannelMediaOptions Object. |
joinSuccessBlock | Same as AgoraRtcEngineDelegate.rtcEngine:didJoinChannel:withUid:elapsed: didJoinChannel. We recommend you set this parameter as nil to use didJoinChannel .
|
Extends class AgoraRtcEngineKit.
- (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 | |
Joins the channel with a user account.
After the user successfully joins the channel, the SDK triggers the following callbacks:
COMMUNICATION
profile, or is a host in the LIVE_BROADCASTING
profile.token | The token generated at your server:
|
channelId | The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are:
|
userAccount | The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are:
|
delegate | AgoraRtcEngineDelegate protocol. |
mediaOptions | The channel media options: ChannelMediaOptions |
Extends class AgoraRtcEngineKit.
- (int) updateChannelExWithMediaOptions: | (AgoraRtcChannelMediaOptions *_Nonnull) | mediaOptions | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Updates the channel media options after joining the channel.
mediaOptions | The channel media options: ChannelMediaOptions. |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) muteLocalAudioStreamEx: | (BOOL) | mute | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops or resumes sending the local audio stream with connection.
mute | Determines whether to send or stop sending the local audio stream:
|
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) muteLocalVideoStreamEx: | (BOOL) | mute | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops or resumes sending the local video stream with connection.
mute | Determines whether to send or stop sending the local video stream:
|
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) muteRemoteAudioStreamEx: | (NSUInteger) | uid | |
mute: | (BOOL) | mute | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Mutes a specified remote user's audio stream.
uid | User ID whose audio streams the user intends to mute. |
mute | * YES: Stops playing a specified user’s audio streams. NO: Resumes playing a specified user’s audio streams. |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) muteAllRemoteAudioStreamsEx: | (BOOL) | mute | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops or resumes receiving all remote audio stream with connection.
mute | Whether to stop receiving remote audio streams:
|
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) setVideoEncoderConfigurationEx: | (AgoraVideoEncoderConfiguration *_Nonnull) | config | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the video encoder configuration.
Each configuration profile corresponds to a set of video parameters, including the resolution, frame rate, and bitrate.
The parameters specified in this method are the maximum values under ideal network conditions. If the video engine cannot render the video using the specified parameters due to poor network conditions, the parameters further down the list are considered until a successful configuration is found.
config | The local video encoder configuration, see #AgoraVideoEncoderConfiguration. |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) setupRemoteVideoEx: | (AgoraRtcVideoCanvas *_Nonnull) | remote | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Binds the remote user to the video display window, that is, sets the view for the user of the specified uid.
Usually, the application should specify the uid of the remote video in the method call before the user enters a channel. If the remote uid is unknown to the application, you can set the uid after receiving the AgoraRtcEngineDelegate.rtcEngine:didJoinedOfUid:elapsed: didJoinedOfUid event.
remote | AgoraRtcVideoCanvas |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) setRemoteRenderModeEx: | (NSUInteger) | uid | |
mode: | (AgoraVideoRenderMode) | mode | |
mirror: | (AgoraVideoMirrorMode) | mirror | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Configures the remote video display mode. The application can call this method multiple times to change the display mode.
uid | User id of the user whose video streams are received. |
mode | AgoraVideoRenderMode |
mirror | AgoraVideoMirrorMode |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) muteRemoteVideoStreamEx: | (NSUInteger) | uid | |
mute: | (BOOL) | mute | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops or resumes receiving the video stream of a specified user.
uid | ID of the specified remote user. |
mute | Determines whether to receive or stop receiving a specified video stream:
|
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) muteAllRemoteVideoStreamsEx: | (BOOL) | mute | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stops or resumes receiving all remote video stream with connection.
mute | Whether to stop receiving remote video streams:
|
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) enableDualStreamModeEx: | (BOOL) | enabled | |
streamConfig: | (AgoraSimulcastStreamConfig *) | streamConfig | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Enables or disables the dual video stream mode.
If dual-stream mode is enabled, the subscriber can choose to receive the high-stream (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) video using setRemoteVideoStreamType setRemoteVideoStreamType.
enabled |
|
streamConfig | The minor stream config |
connection | An output parameter which is used to control different connection instances. |
Extends class AgoraRtcEngineKit.
- (int) setDualStreamModeEx: | (AgoraSimulcastStreamMode) | mode | |
streamConfig: | (AgoraSimulcastStreamConfig *) | streamConfig | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Enables or disables the dual video stream mode.
If dual-stream mode is enabled, the subscriber can choose to receive the high-stream (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) video using setRemoteVideoStreamType setRemoteVideoStreamType.
mode | The dual-stream mode. |
streamConfig | The minor stream config |
connection | An output parameter which is used to control different connection instances. |
Extends class AgoraRtcEngineKit.
- (int) setRemoteVideoStreamEx: | (NSUInteger) | uid | |
type: | (AgoraVideoStreamType) | streamType | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the remote video stream type.
If the remote user has enabled the dual-stream mode, by default the SDK receives the high-stream video. Call this method to switch to the low-stream video.
uid | ID of the remote user sending the video stream. |
streamType | The video stream type: AgoraVideoStreamType. |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) setRemoteVideo: | (NSUInteger) | uid | |
SubscriptionOptionsEx: | (AgoraVideoSubscriptionOptions *_Nonnull) | options | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the remote video subscription options
uid | ID of the remote user sending the video stream. |
options | Sets the video subscription options. |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) pushExternalEncodedVideoFrameEx: | (NSData *_Nonnull) | frame | |
info: | (AgoraEncodedVideoFrameInfo *_Nonnull) | info | |
videoTrackId: | (NSUInteger) | videoTrackId | |
Pushes the encoded external video frame to specified connection in Agora SDK.
data | The encoded external video data, which must be the direct buffer. |
frameInfo | The encoded external video frame info: AgoraEncodedVideoFrameInfo. |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (BOOL) pushExternalVideoFrame: | (AgoraVideoFrame *_Nonnull) | frame | |
videoTrackId: | (NSUInteger) | videoTrackId | |
Pushes the external video frame.
This method pushes the video frame using the AgoraVideoFrame class and passes it to the Agora SDK with the format
parameter in AgoraVideoFormat.
Call setExternalVideoSource:useTexture:pushMode: setExternalVideoSource and set the pushMode
parameter as YES
before calling this method.
frame | Video frame containing the SDK's encoded video data to be pushed: AgoraVideoFrame. |
videoTrackId | The id of the video track. |
YES
: Success.NO
: Failure. Extends class AgoraRtcEngineKit.
- (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 user ID and user account of the remote user, caches them in a mapping table object (AgoraUserInfo
), and triggers the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback on the local client.
After receiving the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback, you can call this method to get the user ID of the remote user from the userInfo
object by passing in the user account.
userAccount | The user account of the user. Ensure that you set this parameter. |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (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 user ID and user account of the remote user, caches them in a mapping table object (userInfo
), and triggers the onUserInfoUpdated callback on the local client.
After receiving the onUserInfoUpdated callback, you can call this method to get the user account of the remote user from the userInfo
object by passing in the user ID.
uid | The user ID of the remote user. Ensure that you set this parameter. |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (AgoraConnectionState) getConnectionStateEx: | (AgoraRtcConnection *_Nonnull) | connection |
Gets the connection state of the SDK.
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) adjustUserPlaybackSignalVolumeEx: | (NSUInteger) | uid | |
volume: | (NSInteger) | volume | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Adjust the playback signal volume of a specified remote user.
You can call this method as many times as necessary to adjust the playback volume of different remote users, or to repeatedly adjust the playback volume of the same remote user.
Note**
uid | The ID of the remote user. |
volume | The playback volume of the specified remote user. The value ranges between 0 and 400, including the following: |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) sendCustomReportMessageEx: | (NSString *_Nullable) | messageId | |
category: | (NSString *_Nullable) | category | |
event: | (NSString *_Nullable) | event | |
label: | (NSString *_Nullable) | label | |
value: | (NSInteger) | value | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Extends class AgoraRtcEngineKit.
- (int) enableAudioVolumeIndicationEx: | (NSInteger) | interval | |
smooth: | (NSInteger) | smooth | |
reportVad: | (BOOL) | reportVad | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Extends class AgoraRtcEngineKit.
- (int) setRemoteVoicePositionEx: | (NSUInteger) | uid | |
pan: | (double) | pan | |
gain: | (double) | gain | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the sound position and gain of a remote user.
When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.
Note:**
uid | The ID of the remote user. |
pan | The sound position of the remote user. The value ranges from -1.0 to 1.0: |
gain | Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain. |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (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 interactive 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. Agora supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one.
The watermark position depends on the settings in the [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]) method:
When setting the watermark position, the region must be less than the dimensions set in the [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]) method. Otherwise, the watermark image will be cropped.
Note**
visibleInPreview
member in the WatermarkOptions class to set whether or not the watermark is visible in preview.url | The local file path of the watermark image to be added. This method supports adding a watermark image from the local file path. If the watermark image to be added is in the project file, you need to change the image's Type from PNG image to Data in the Xcode property, otherwise, the Agora Native SDK cannot recognize the image. |
options | The options of the watermark image to be added. See WatermarkOptions. |
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) clearVideoWatermarkEx: | (AgoraRtcConnection *_Nonnull) | connection |
Clears the watermark image on the video stream.
connection | AgoraRtcConnection by channelId and uid combine |
Extends class AgoraRtcEngineKit.
- (int) createDataStreamEx: | (NSInteger *_Nonnull) | streamId | |
reliable: | (BOOL) | reliable | |
ordered: | (BOOL) | ordered | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Creates a data stream.
Each user can create up to five data streams during the lifecycle of the AgoraRtcEngineKit
.
reliable
and ordered
parameters to YES
or NO
. Do not set one as YES
and the other as NO
.streamId | ID of the created data stream. |
reliable | Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds:
|
ordered | Sets whether or not the recipients receive the data stream in the sent order:
|
connection | AgoraRtcConnection by channelId and uid combine. |
Extends class AgoraRtcEngineKit.
- (int) createDataStreamEx: | (NSInteger *_Nonnull) | streamId | |
config: | (AgoraDataStreamConfig *_Nonnull) | config | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Creates a data stream.
Each user can create up to five data streams during the lifecycle of the [AgoraRtcChannel](AgoraRtcChannel).
streamId | ID of the created data stream. |
config | the config of data stream. |
connection | AgoraRtcConnection by channelId and uid combine. |
Extends class AgoraRtcEngineKit.
- (int) sendStreamMessageEx: | (NSInteger) | streamId | |
data: | (NSData *_Nonnull) | data | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sends data stream messages to all users in a channel.
The SDK has the following restrictions on this method:
If the remote user receives the data stream within five seconds, the SDK triggers the AgoraRtcEngineDelegate.rtcEngine:receiveStreamMessageFromUid:streamId:data: receiveStreamMessageFromUid callback on the remote client, from which the remote user gets the stream message.
If the remote user does not receive the data stream within five seconds, the SDK triggers the AgoraRtcEngineDelegate.rtcEngine:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached: didOccurStreamMessageErrorFromUid callback on the remote client.
streamId | ID of the sent data stream returned in the createDataStream method. |
data | Sent data. |
connection | AgoraRtcConnection by channelId and uid combine. |
Extends class AgoraRtcEngineKit.
- (int) setSubscribeAudioAllowlistEx: | (NSArray< NSNumber * > *_Nonnull) | allowlist | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the allowlist of subscribe remote stream audio.
allowlist | The uid list of users who do subscribe to audio. |
connection | AgoraRtcConnection by channelId and uid combine. |
If a user is in the blocklist and allowlist at the same time, the user will not subscribe to audio.
Extends class AgoraRtcEngineKit.
- (int) setSubscribeVideoAllowlistEx: | (NSArray< NSNumber * > *_Nonnull) | allowlist | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Sets the allowlist of subscribe remote stream video.
allowlist | The uid list of users who do subscribe to video. |
connection | AgoraRtcConnection by channelId and uid combine. |
If a user is in the blocklist and allowlist at the same time, the user will not subscribe to video.
Extends class AgoraRtcEngineKit.
- (NSInteger) takeSnapshotEx: | (AgoraRtcConnection *_Nonnull) | connection | |
uid: | (NSInteger) | uid | |
filePath: | (NSString *_Nonnull) | filePath | |
Extends class AgoraRtcEngineKit.
- (int) startRtmpStreamWithoutTranscodingEx: | (NSString *_Nonnull) | url | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Publishes the local stream without transcoding to a specified CDN live RTMP address. (CDN live only.)
url | The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. |
connection | AgoraRtcConnection. |
Extends class AgoraRtcEngineKit.
- (int) startRtmpStreamWithTranscodingEx: | (NSString *_Nonnull) | url | |
transcoding: | (AgoraLiveTranscoding *_Nullable) | transcoding | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Publishes the local stream with transcoding to a specified CDN live RTMP address. (CDN live only.)
url | The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. |
transcoding | Sets the CDN live audio/video transcoding settings. See LiveTranscoding. |
connection | AgoraRtcConnection. |
Extends class AgoraRtcEngineKit.
- (int) updateRtmpTranscodingEx: | (AgoraLiveTranscoding *_Nullable) | transcoding | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Update the video layout and audio settings for CDN live. (CDN live only.)
transcoding | Sets the CDN live audio/video transcoding settings. See LiveTranscoding. |
connection | AgoraRtcConnection. |
Extends class AgoraRtcEngineKit.
- (int) stopRtmpStreamEx: | (NSString *_Nonnull) | url | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Stop an RTMP stream with transcoding or without transcoding from the CDN. (CDN live only.)
url | The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. |
connection | AgoraRtcConnection. |
Extends class AgoraRtcEngineKit.
- (int) startChannelMediaRelayEx: | (AgoraChannelMediaRelayConfiguration *_Nonnull) | config | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Starts to relay media streams across channels.
configuration | The configuration of the media stream relay:AgoraChannelMediaRelayConfiguration. |
connection | AgoraRtcConnection. |
Extends class AgoraRtcEngineKit.
- (int) updateChannelMediaRelayEx: | (AgoraChannelMediaRelayConfiguration *_Nonnull) | config | |
connection: | (AgoraRtcConnection *_Nonnull) | connection | |
Updates the channels for media stream relay
configuration | The media stream relay configuration: AgoraChannelMediaRelayConfiguration. |
connection | AgoraRtcConnection. |
Extends class AgoraRtcEngineKit.
- (int) stopChannelMediaRelayEx: | (AgoraRtcConnection *_Nonnull) | connection |
Stops the media stream relay.
Once the relay stops, the host quits all the destination channels.
connection | AgoraRtcConnection. |
Extends class AgoraRtcEngineKit.
- (int) pauseAllChannelMediaRelayEx: | (AgoraRtcConnection *_Nonnull) | connection |
pause the channels for media stream relay.
connection | AgoraRtcConnection. |
Extends class AgoraRtcEngineKit.
- (int) resumeAllChannelMediaRelayEx: | (AgoraRtcConnection *_Nonnull) | connection |
resume the channels for media stream relay.
connection | AgoraRtcConnection. |
Extends class AgoraRtcEngineKit.