NERtcEngine Frequently used callbacks
更多...
#import <NERtcEngineDelegate.h>
NERtcEngine Frequently used callbacks
◆ onNERtcEngineConnectionStateChangeWithState:reason:
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.
- 参数
-
◆ onNERtcEngineDidClientRoleChanged:newRole:
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.
- 参数
-
oldRole | The role before the user changes the role. |
newRole | The 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.
- 参数
-
◆ 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.
- 参数
-
◆ 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.
- 参数
-
◆ 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
- 参数
-
warnCode | The warn code. For more information, see NERtcWarning. |
msg | The 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.
- 参数
-
◆ onNERtcEngineUserAudioDidStart:
- (void) onNERtcEngineUserAudioDidStart: |
|
(uint64_t) |
userID |
|
|
optional |
Occurs when a remote user enables audio.
- 参数
-
userID | The ID of a remote user. |
◆ onNERtcEngineUserAudioDidStop:
- (void) onNERtcEngineUserAudioDidStop: |
|
(uint64_t) |
userID |
|
|
optional |
Occurs when a remote user disables audio.
- 参数
-
userID | The 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.
- 参数
-
userID | The ID of a remote user. |
userName | The name of the user who joins the room. The field is deprecated. Ignore the field. |
◆ onNERtcEngineUserDidLeaveWithUserID:reason:
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.
- 参数
-
userID | The ID of the user that leaves the room. |
reason | The 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.
- 参数
-
userID | The ID of a remote user. |
profile | The 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.
- 参数
-
userID | The 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.
- 参数
-
userID | The ID of the user whose video streams are sent. |
profile | The 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.
- 参数
-
userID | The ID of a remote user. |
该协议的文档由以下文件生成: