NERtc iOS SDK  V4.4.301
构造函数 | 所有成员列表
<NERtcEngineDelegate>协议 参考

NERtcEngine Frequently used callbacks 更多...

#import <NERtcEngineDelegate.h>

类 <NERtcEngineDelegate> 继承关系图:
<NERtcEngineDelegateEx>

构造函数

(void) - onNERtcEngineDidError:
 Occurs when an error occurs. 更多...
 
(void) - onNERtcEngineDidWarning:msg:
 Occurs when a warning occurs. 更多...
 
(void) - onNERtcEngineConnectionStateChangeWithState:reason:
 Occurs when the state of the network connection between the SDK and the server changes. 更多...
 
(void) - onNERtcEngineDidLeaveChannelWithResult:
 Occurs when a user leaves a room. 更多...
 
(void) - onNERtcEngineDidDisconnectWithReason:
 After the connection breaks down and the SDK fails to connect to the server three consecutive times. 更多...
 
(void) - onNERtcEngineRejoinChannel:
 Occurs when a user rejoins a room. 更多...
 
(void) - onNERtcEngineUserDidJoinWithUserID:userName:
 Occurs when a remote user joins the current room. 更多...
 
(void) - onNERtcEngineUserDidLeaveWithUserID:reason:
 Occurs when a remote user leaves a room. 更多...
 
(void) - onNERtcEngineDidClientRoleChanged:newRole:
 Occurs when a user changes the role in live streaming. 更多...
 
(void) - onNERtcEngineReconnectingStart
 Occurs when reconnection starts. 更多...
 
(void) - onNERtcEngineUserAudioDidStart:
 Occurs when a remote user enables audio. 更多...
 
(void) - onNERtcEngineUserAudioDidStop:
 Occurs when a remote user disables audio. 更多...
 
(void) - onNERtcEngineUserVideoDidStartWithUserID:videoProfile:
 Occurs when a remote user enables video. 更多...
 
(void) - onNERtcEngineUserVideoDidStop:
 Occurs when a remote user disables video. 更多...
 
(void) - onNERtcEngineUserSubStreamDidStartWithUserID:subStreamProfile:
 Occurs when a remote user enables screen sharing by using the substream. 更多...
 
(void) - onNERtcEngineUserSubStreamDidStop:
 Occurs when a remote user stops screen sharing by using the substream. 更多...
 

详细描述

NERtcEngine Frequently used callbacks

函数文档

◆ onNERtcEngineConnectionStateChangeWithState:reason:

- (void) onNERtcEngineConnectionStateChangeWithState: (NERtcConnectionStateType state
reason: (NERtcReasonConnectionChangedType reason 
optional

Occurs when the state of the network connection between the SDK and the server changes.

The callback is triggered when the state of the network connection changes. The callback returns the current state of connection and the reason why the network state changes.

参数
stateThe state of the current connection. For more information, see NERtcConnectionStateType.
reasonThe reason why the state changes. For more information, see NERtcReasonConnectionChangedType.

◆ onNERtcEngineDidClientRoleChanged:newRole:

- (void) onNERtcEngineDidClientRoleChanged: (NERtcClientRole oldRole
newRole: (NERtcClientRole newRole 
optional

Occurs when a user changes the role in live streaming.

After the user joins a room, the user can call the setClientRole method to change the role. Then, the callback is triggered. For example, switching from host to audience, or from audience to host.

注解
In live streaming, if you join a room and successfully call this method to change the role, the following callbacks are triggered.
  • If the role changes from host to audience, the onClientRoleChange callback is triggered on the client, and the onUserLeave callback is triggered on a remote client.
  • If the role changes from audience to host, the onClientRoleChange callback is triggered on the client, and the onUserJoined callback is triggered on a remote client.
参数
oldRoleThe role before the user changes the role.
newRoleThe role after the user changes the role.

◆ onNERtcEngineDidDisconnectWithReason:

- (void) onNERtcEngineDidDisconnectWithReason: (NERtcError reason
optional

After the connection breaks down and the SDK fails to connect to the server three consecutive times.

注解
  • The callback is triggered if the SDK fails to connect to the server three consecutive times after you successfully call the joinChannel method.
  • If the SDK fails to connect to the server three consecutive times, the SDK stops retries.
参数
reasonThe reason why the network is disconnected. For more information, see NERtcEngineErrorCode.NERtcError.

◆ onNERtcEngineDidError:

- (void) onNERtcEngineDidError: (NERtcError errCode
optional

Occurs when an error occurs.

The callback is triggered to report an error related to network or media during SDK runtime.

In most cases, the SDK cannot fix the issue and resume running. The SDK requires the app to take action or informs the user of the issue.

参数
errorCodeThe error code. For more information, see NERtcEngineErrorCode.NERtcError.

◆ onNERtcEngineDidLeaveChannelWithResult:

- (void) onNERtcEngineDidLeaveChannelWithResult: (NERtcError result
optional

Occurs when a user leaves a room.

After an app invokes the leaveChannel method, SDK prompts whether the app successfully leaves the room.

参数
resultThe result of the leaveChannel operation. For more information, see NERtcEngineErrorCode.NERtcError.

◆ onNERtcEngineDidWarning:msg:

- (void) onNERtcEngineDidWarning: (NERtcWarning warnCode
msg: (NSString *)  msg 
optional

Occurs when a warning occurs.

The callback is triggered to report a warning related to network or media during SDK runtime.

In most cases, the SDK cannot fix the issue and resume running. The SDK requires the app to take action or informs the user of the issue.

自从
V4.3.0
参数
warnCodeThe warn code. For more information, see NERtcWarning.
msgThe warning description.

◆ onNERtcEngineReconnectingStart

- (void) onNERtcEngineReconnectingStart
optional

Occurs when reconnection starts.

If a client is disconnected from the server, the SDK starts reconnecting. The callback is triggered when the reconnection starts. For more information about the reconnection result, see onNERtcEngineRejoinChannel and onNERtcEngineDidDisconnectWithReason.

◆ onNERtcEngineRejoinChannel:

- (void) onNERtcEngineRejoinChannel: (NERtcError result
optional

Occurs when a user rejoins a room.

If a client is disconnected from the server due to poor network quality, the SDK starts reconnecting. If the client and server are reconnected, the callback is triggered.

参数
resultThe result of reconnection. For more information, see NERtcEngineErrorCode.NERtcError.

◆ onNERtcEngineUserAudioDidStart:

- (void) onNERtcEngineUserAudioDidStart: (uint64_t)  userID
optional

Occurs when a remote user enables audio.

参数
userIDThe ID of a remote user.

◆ onNERtcEngineUserAudioDidStop:

- (void) onNERtcEngineUserAudioDidStop: (uint64_t)  userID
optional

Occurs when a remote user disables audio.

参数
userIDThe ID of a remote user.

◆ onNERtcEngineUserDidJoinWithUserID:userName:

- (void) onNERtcEngineUserDidJoinWithUserID: (uint64_t)  userID
userName: (NSString *)  userName 
optional

Occurs when a remote user joins the current room.

The callback prompts that a remote user joins the room and returns the ID of the user that joins the room. If the user ID already exists, the remote user also receives a message that the user already joins the room, which is returned by the callback.

The callback is triggered in the following cases:

  • A remote user joins the room by calling the joinChannel method.
  • A remote user rejoins the room after the client is disconnected.
参数
userIDThe ID of a remote user.
userNameThe name of the user who joins the room. The field is deprecated. Ignore the field.

◆ onNERtcEngineUserDidLeaveWithUserID:reason:

- (void) onNERtcEngineUserDidLeaveWithUserID: (uint64_t)  userID
reason: (NERtcSessionLeaveReason reason 
optional

Occurs when a remote user leaves a room.

A message is returned that a remote user leaves the room or becomes disconnected. A user leaves a room due to the following reasons: the user exit the room or connections time out.

  • If a user leaves the room, the remote user receives a message that indicates that the user leaves the room.
  • If the connection times out, and the user does not receive data packets for a time period of 40 to 50 seconds, then the user becomes disconnected.
参数
userIDThe ID of the user that leaves the room.
reasonThe reason why the remote user leaves. For more information, see NERtcSessionLeaveReason.

◆ onNERtcEngineUserSubStreamDidStartWithUserID:subStreamProfile:

- (void) onNERtcEngineUserSubStreamDidStartWithUserID: (uint64_t)  userID
subStreamProfile: (NERtcVideoProfileType profile 
optional

Occurs when a remote user enables screen sharing by using the substream.

注解
The audio-only SDK disables this API. If you need to use the API, you can download the standard SDK from the official website of YunXin and replace the audio-only SDK.
参数
userIDThe ID of a remote user.
profileThe resolution of the remote video. For more information, see NERtcVideoProfileType.

◆ onNERtcEngineUserSubStreamDidStop:

- (void) onNERtcEngineUserSubStreamDidStop: (uint64_t)  userID
optional

Occurs when a remote user stops screen sharing by using the substream.

注解
The audio-only SDK disables this API. If you need to use the API, you can download the standard SDK from the official website of YunXin and replace the audio-only SDK.
参数
userIDThe ID of a remote user.

◆ onNERtcEngineUserVideoDidStartWithUserID:videoProfile:

- (void) onNERtcEngineUserVideoDidStartWithUserID: (uint64_t)  userID
videoProfile: (NERtcVideoProfileType profile 
optional

Occurs when a remote user enables video.

注解
The audio-only SDK disables this API. If you need to use the API, you can download the standard SDK from the official website of YunXin and replace the audio-only SDK.
参数
userIDThe ID of the user whose video streams are sent.
profileThe video profile of the remote user. For more information, see NERtcVideoProfileType.

◆ onNERtcEngineUserVideoDidStop:

- (void) onNERtcEngineUserVideoDidStop: (uint64_t)  userID
optional

Occurs when a remote user disables video.

注解
The audio-only SDK disables this API. If you need to use the API, you can download the standard SDK from the official website of YunXin and replace the audio-only SDK.
参数
userIDThe ID of a remote user.

该协议的文档由以下文件生成: