NERtc iOS SDK V4.6.10
Instance Methods | List of all members
<NERtcEngineDelegate> Protocol Reference

NERtcEngine Frequently used callbacks More...

#import <NERtcEngineDelegate.h>

Inheritance diagram for <NERtcEngineDelegate>:
<NERtcEngineDelegateEx>

Instance Methods

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

Detailed Description

NERtcEngine Frequently used callbacks

Method Documentation

◆ 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.

Parameters
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.

Note
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.
Parameters
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.

Note
  • 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.
Parameters
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.

Parameters
errCodeThe 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.

Parameters
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.

Since
V4.3.0
Parameters
warnCodeThe warn code. For more information, see NERtcWarning.
msgThe warning description.

◆ onNERtcEngineMediaRightChangeWithAudio:video:

- (void) onNERtcEngineMediaRightChangeWithAudio: (BOOL)  isAudioBannedByServer
video: (BOOL)  isVideoBannedByServer 
optional

Audio/Video Callback when banned by server.

Since
v4.6.0
Parameters
isAudioBannedByServerindicates whether to ban the audio.
  • true: banned
  • false unbanned
isVideoBannedByServerindicates whether to ban the video.
  • true: banned
  • false unbanned

◆ 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.

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

◆ onNERtcEngineUser:subStreamAudioMuted:

- (void) onNERtcEngineUser: (uint64_t)  userID
subStreamAudioMuted: (BOOL)  muted 
optional

Occurs when a remote user pauses or resumes publishing the audio substream.

Since
V4.6.10
Parameters
userIDUser ID indicating which user performs the operation.
mutedindicates if the audio substream is stopped.
  • YES: stops publishing the audio substream.
  • No: resumes publishing the audio substream.

◆ onNERtcEngineUserAudioDidStart:

- (void) onNERtcEngineUserAudioDidStart: (uint64_t)  userID
optional

Occurs when a remote user enables audio.

Parameters
userIDThe ID of a remote user.

◆ onNERtcEngineUserAudioDidStop:

- (void) onNERtcEngineUserAudioDidStop: (uint64_t)  userID
optional

Occurs when a remote user disables audio.

Parameters
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.
    Parameters
    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.
    Parameters
    userIDThe ID of the user that leaves the room.
    reasonThe reason why the remote user leaves. For more information, see NERtcSessionLeaveReason.

◆ onNERtcEngineUserSubStreamAudioDidStart:

- (void) onNERtcEngineUserSubStreamAudioDidStart: (uint64_t)  userID
optional

Occurs when a remote user enables the audio substream.

Since
V4.6.10
Parameters
userIDRemote user ID.

◆ onNERtcEngineUserSubStreamAudioDidStop:

- (void) onNERtcEngineUserSubStreamAudioDidStop: (uint64_t)  userID
optional

Occurs when a remote user stops the audio substream.

Since
V4.6.10
Parameters
userIDremote user ID.

◆ onNERtcEngineUserSubStreamDidStartWithUserID:subStreamProfile:

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

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

Note
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 CommsEase and replace the audio-only SDK.
Parameters
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.

Note
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 CommsEase and replace the audio-only SDK.
Parameters
userIDThe ID of a remote user.

◆ onNERtcEngineUserVideoDidStartWithUserID:videoProfile:

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

Occurs when a remote user enables video.

Note
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 CommsEase and replace the audio-only SDK.
Parameters
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.

Note
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 CommsEase and replace the audio-only SDK.
Parameters
userIDThe ID of a remote user.

The documentation for this protocol was generated from the following file: