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

NERtcChannelDelegate class provides callbacks that report events and statistics of a specified channel. More...

#import <NERtcChannelDelegate.h>

Inheritance diagram for <NERtcChannelDelegate>:

Instance Methods

(void) - onNERtcChannelConnectionStateChangeWithState:reason:
 Occurs when the state of the channel connection between the SDK and the server changes. More...
 
(void) - onNERtcChannelDidLeaveChannelWithResult:
 Occurs when a user leaves a room. More...
 
(void) - onNERtcChannelUserDidJoinWithUserID:userName:
 Occurs when a remote user joins the current room. More...
 
(void) - onNERtcChannelUserDidLeaveWithUserID:reason:
 Occurs when a remote user leaves a room. More...
 
(void) - onNERtcChannelDidClientRoleChanged:newRole:
 Occurs when a user changes the role in live streaming. More...
 
(void) - onNERtcChannelUserAudioDidStart:
 Occurs when a remote user enables audio. More...
 
(void) - onNERtcChannelUserAudioDidStop:
 Occurs when a remote user disables audio. More...
 
(void) - onNERtcChannelUser:audioMuted:
 Occurs when a remote user stops or resumes sending audio streams. More...
 
(void) - onNERtcChannelUserSubStreamAudioDidStart:
 Occurs when a remote user enables the audio substream. More...
 
(void) - onNERtcChannelUserSubStreamAudioDidStop:
 Occurs when a remote user stops the audio substream. More...
 
(void) - onNERtcChannelUser:subStreamAudioMuted:
 Occurs when a remote user pauses or resumes publishing the audio substream. More...
 
(void) - onNERtcChannelUserVideoDidStartWithUserID:videoProfile:
 Occurs when a remote user enables video. More...
 
(void) - onNERtcChannelUserVideoDidStop:
 Occurs when a remote user disables video. More...
 
(void) - onNERtcChannelUserSubStreamDidStartWithUserID:subStreamProfile:
 Occurs when a remote user enables screen sharing by using the substream. More...
 
(void) - onNERtcChannelUserSubStreamDidStop:
 Occurs when a remote user stops screen sharing by using the substream. More...
 
(void) - onNERtcChannelUser:videoMuted:
 Occurs when a remote user stops or resumes sending video streams. More...
 
(void) - onNERtcChannelDidDisconnectWithReason:
 After the connection breaks down and the SDK fails to connect to the server three consecutive times. More...
 
(void) - onNERtcChannelReconnectingStart
 Occurs when reconnection starts. More...
 
(void) - onNERtcChannelRejoinChannel:
 Occurs when a user rejoins a room. More...
 
(void) - onNERtcChannelFirstAudioDataDidReceiveWithUserID:
 Occurs when the first audio frame from a remote user is received. More...
 
(void) - onNERtcChannelFirstVideoDataDidReceiveWithUserID:
 Occurs when the first audio frame from a remote user is received. More...
 
(void) - onNERtcChannelFirstAudioFrameDecoded:
 Occurs when the first audio frame from a remote user is decoded. More...
 
(void) - onNERtcChannelFirstVideoFrameDecoded:width:height:
 Occurs when the first video frame from a remote user is displayed. More...
 
(void) - onNERtcChannelRecvSEIMsg:message:
 Occurs when the content of remote SEI is received. More...
 
(void) - onNERtcChannelLiveStreamState:taskID:url:
 Occurs when the streaming state in live streaming changes. More...
 
(void) - onLocalAudioVolumeIndication:
 Occurs when the system prompts the current local audio volume. More...
 
(void) - onLocalAudioVolumeIndication:withVad:
 Occurs when the system prompts the current local audio volume. More...
 
(void) - onRemoteAudioVolumeIndication:totalVolume:
 Occurs when the system prompts the active speaker and the audio volume. More...
 
(void) - onNERtcChannelLocalPublishFallbackToAudioOnly:streamType:
 Occurs when the published local media stream falls back to an audio-only stream due to poor network conditions or switches back to audio and video stream after the network conditions improve. More...
 
(void) - onNERtcChannelRemoteSubscribeFallbackToAudioOnly:isFallback:streamType:
 Occurs when the subscribed remote media stream falls back to audio-only stream due to poor network conditions or switches back to the audio and video stream after the network conditions improve. More...
 
(void) - onNERtcChannelDidError:
 Occurs when an error occurs. More...
 
(void) - onNERtcChannelMediaRightChangeWithAudio:video:
 音视频权限被禁止通知 More...
 
(void) - onNERtcChannelDidWarning:msg:
 Occurs when a warning occurs. More...
 
(void) - onNERtcChannelMediaRelayStateDidChange:channelName:
 Occurs when the state of the media stream relay changes. More...
 
(void) - onNERtcChannelDidReceiveChannelMediaRelayEvent:channelName:error:
 Returns forwarding events during the media stream relay. More...
 

Detailed Description

NERtcChannelDelegate class provides callbacks that report events and statistics of a specified channel.

Since
V4.5.0

Method Documentation

◆ onLocalAudioVolumeIndication:

- (void) onLocalAudioVolumeIndication: (int)  volume
optional

Occurs when the system prompts the current local audio volume.

This callback is disabled by default. You can enable the callback by calling the enableAudioVolumeIndication method. After the callback is enabled, if a local user speaks, the SDK triggers the callback based on the time interval specified in the enableAudioVolumeIndication method. If the local user mutes the local audio by calling muteLocalAudio, the SDK no longer reports this callback.

Since
V4.5.0
Parameters
volumeThe audio volume. Value range: 0 to 100.

◆ onLocalAudioVolumeIndication:withVad:

- (void) onLocalAudioVolumeIndication: (int)  volume
withVad: (BOOL)  enableVad 
optional

Occurs when the system prompts the current local audio volume.


By default, the callback is disabled. You can enable the callback by calling the enableAudioVolumeIndication method. After the callback is enabled, if a local user speaks, the SDK triggers the callback based on the time interval specified in the enableAudioVolumeIndication method.
If the local audio is muted by calling muteLocalAudioStream, the SDK will set the volume to 0 and return to the application layer.

Since
V4.6.10
Parameters
volumeindicates the mixing audio volume. Value range: 0 to 100.
enableVadindicates whether voice activity detection is enabled.

◆ onNERtcChannelConnectionStateChangeWithState:reason:

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

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

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

Since
V4.5.0
Parameters
stateThe state of the channel connection. For more information, see NERtcConnectionStateType.
reasonThe reason why the state changes. For more information, see NERtcReasonConnectionChangedType.

◆ onNERtcChannelDidClientRoleChanged:newRole:

- (void) onNERtcChannelDidClientRoleChanged: (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.

◆ onNERtcChannelDidDisconnectWithReason:

- (void) onNERtcChannelDidDisconnectWithReason: (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.
Since
V4.5.0
Parameters
reasonThe reason why the network is disconnected. For more information, see NERtcEngineErrorCode.NERtcError.

◆ onNERtcChannelDidError:

- (void) onNERtcChannelDidError: (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.

Since
V4.5.0
Parameters
errCodeThe error code. For more information, see NERtcEngineErrorCode.NERtcError.

◆ onNERtcChannelDidLeaveChannelWithResult:

- (void) onNERtcChannelDidLeaveChannelWithResult: (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.

Since
V4.5.0
Parameters
resultThe result of the leaveChannel operation. For more information, see NERtcEngineErrorCode.NERtcError.

◆ onNERtcChannelDidReceiveChannelMediaRelayEvent:channelName:error:

- (void) onNERtcChannelDidReceiveChannelMediaRelayEvent: (NERtcChannelMediaRelayEvent event
channelName: (NSString *)  channelName
error: (NERtcError error 
optional

Returns forwarding events during the media stream relay.

Since
V4.5.0
Parameters
eventThe media stream relay event. For more information, see NERtcChannelMediaRelayEvent.
channelNameThe name of the destination room where the media streams are relayed.
errorThe specific error code. For more information, see NERtcEngineErrorCode.NERtcError.

◆ onNERtcChannelDidWarning:msg:

- (void) onNERtcChannelDidWarning: (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.5.0
Parameters
warnCodeThe warn code. For more information, see NERtcWarning.
msgThe warning description.

◆ onNERtcChannelFirstAudioDataDidReceiveWithUserID:

- (void) onNERtcChannelFirstAudioDataDidReceiveWithUserID: (uint64_t)  userID
optional

Occurs when the first audio frame from a remote user is received.

Since
V4.5.0
Parameters
userIDThe ID of a remote user whose audio streams are sent.

◆ onNERtcChannelFirstAudioFrameDecoded:

- (void) onNERtcChannelFirstAudioFrameDecoded: (uint64_t)  userID
optional

Occurs when the first audio frame from a remote user is decoded.

Since
V4.5.0
Parameters
userIDThe ID of a remote user whose audio streams are sent.

◆ onNERtcChannelFirstVideoDataDidReceiveWithUserID:

- (void) onNERtcChannelFirstVideoDataDidReceiveWithUserID: (uint64_t)  userID
optional

Occurs when the first audio frame from a remote user is received.

If the first video frame from a remote user is displayed in the view, the callback is triggered.

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.
Since
V4.5.0
Parameters
userIDThe ID of a remote user whose video streams are sent.

◆ onNERtcChannelFirstVideoFrameDecoded:width:height:

- (void) onNERtcChannelFirstVideoFrameDecoded: (uint64_t)  userID
width: (uint32_t)  width
height: (uint32_t)  height 
optional

Occurs when the first video frame from a remote user is displayed.

If the engine receives the first frame of remote video streams, the callback is triggered. The callback allows the app to set the video canvas.

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.
Since
V4.5.0
Parameters
userIDThe ID of a remote user whose video streams are sent.
widthThe width of the first video frame. Unit: px.
heightThe height of the first video frame. Unit: px.

◆ onNERtcChannelLiveStreamState:taskID:url:

- (void) onNERtcChannelLiveStreamState: (NERtcLiveStreamStateCode state
taskID: (NSString *)  taskID
url: (NSString *)  url 
optional

Occurs when the streaming state in live streaming changes.

Since
V4.5.0
Parameters
stateThe streaming state in live streaming. For more information, see NERtcLiveStreamStateCode.
taskIDThe ID of a streaming task.
urlThe URL for the streaming task.

◆ onNERtcChannelLocalPublishFallbackToAudioOnly:streamType:

- (void) onNERtcChannelLocalPublishFallbackToAudioOnly: (BOOL)  isFallback
streamType: (NERtcStreamChannelType streamType 
optional

Occurs when the published local media stream falls back to an audio-only stream due to poor network conditions or switches back to audio and video stream after the network conditions improve.

If you call setLocalPublishFallbackOption and set option to AUDIO_ONLY, this callback is triggered when the locally published stream falls back to audio-only mode due to poor uplink network conditions, or when the audio stream switches back to the audio and video stream after the uplink network conditions improve.

Since
V4.5.0
Parameters
isFallbackThe option whether the locally published stream falls back to audio-only mode or switches back to audio and video stream.
  • YES: The published stream from a local client falls back to audio-only mode due to poor uplink network conditions.
  • NO: The audio stream switches back to the audio and video stream after the uplink network condition improves.
streamTypeThe type of the video stream, such as mainstream and substream. For more information, see NERtcStreamChannelType.

◆ onNERtcChannelMediaRelayStateDidChange:channelName:

- (void) onNERtcChannelMediaRelayStateDidChange: (NERtcChannelMediaRelayState state
channelName: (NSString *)  channelName 
optional

Occurs when the state of the media stream relay changes.

Since
V4.5.0
Parameters
stateThe state of the media stream relay. For more information, see NERtcChannelMediaRelayState.
channelNameThe name of the destination room where the media streams are relayed.

◆ onNERtcChannelMediaRightChangeWithAudio:video:

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

音视频权限被禁止通知

Parameters
isAudioBannedByServer音频是否被服务器禁止
isVideoBannedByServer视频是否被服务器禁止

◆ onNERtcChannelReconnectingStart

- (void) onNERtcChannelReconnectingStart
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.

Since
V4.5.0

◆ onNERtcChannelRecvSEIMsg:message:

- (void) onNERtcChannelRecvSEIMsg: (uint64_t)  userID
message: (NSData *)  message 
optional

Occurs when the content of remote SEI is received.

After a remote client successfully sends SEI, the local client receives a message returned by the callback.

Note
The audio-only SDK disables this callback. If you need to use the callback, you can download the standard SDK from the official website of CommsEase and replace the audio-only SDK.
Since
V4.5.0
Parameters
userIDThe ID of the user who sends SEI.
messageThe message that contains SEI.

◆ onNERtcChannelRejoinChannel:

- (void) onNERtcChannelRejoinChannel: (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.

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

◆ onNERtcChannelRemoteSubscribeFallbackToAudioOnly:isFallback:streamType:

- (void) onNERtcChannelRemoteSubscribeFallbackToAudioOnly: (uint64_t)  uid
isFallback: (BOOL)  isFallback
streamType: (NERtcStreamChannelType streamType 
optional

Occurs when the subscribed remote media stream falls back to audio-only stream due to poor network conditions or switches back to the audio and video stream after the network conditions improve.

If you call setRemoteSubscribeFallbackOption and set option to AUDIO_ONLY, this callback is triggered when the subscribed remote media stream falls back to audio-only mode due to poor downlink network conditions, or when the subscribed remote media stream switches back to the audio and video stream after the downlink network conditions improve.

Since
V4.5.0
Parameters
isFallbackThe option whether the subscribed remote media stream falls back to audio-only mode or switches back to the audio and video stream.
  • YES: The subscribed remote media stream falls back to audio-only mode due to poor downstream network conditions.
  • NO: The subscribed remote media stream switches back to the audio and video stream after the downstream network conditions improve.
uidThe ID of a remote user.
streamTypeThe type of the video stream, such as mainstream and substream. For more information, see NERtcStreamChannelType.

◆ onNERtcChannelUser:audioMuted:

- (void) onNERtcChannelUser: (uint64_t)  userID
audioMuted: (BOOL)  muted 
optional

Occurs when a remote user stops or resumes sending audio streams.

Since
V4.5.0
Parameters
userIDThe ID of the user whose audio streams are sent.
mutedThe option whether to pause sending audio streams.

◆ onNERtcChannelUser:subStreamAudioMuted:

- (void) onNERtcChannelUser: (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.

◆ onNERtcChannelUser:videoMuted:

- (void) onNERtcChannelUser: (uint64_t)  userID
videoMuted: (BOOL)  muted 
optional

Occurs when a remote user stops or resumes sending video streams.

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.
Since
V4.5.0
Parameters
userIDThe ID of the user whose video streams are sent.
mutedThe option whether to pause sending video streams.

◆ onNERtcChannelUserAudioDidStart:

- (void) onNERtcChannelUserAudioDidStart: (uint64_t)  userID
optional

Occurs when a remote user enables audio.

Since
V4.5.0
Parameters
userIDThe ID of a remote user.

◆ onNERtcChannelUserAudioDidStop:

- (void) onNERtcChannelUserAudioDidStop: (uint64_t)  userID
optional

Occurs when a remote user disables audio.

Since
V4.5.0
Parameters
userIDThe ID of a remote user.

◆ onNERtcChannelUserDidJoinWithUserID:userName:

- (void) onNERtcChannelUserDidJoinWithUserID: (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.
    Since
    V4.5.0
    Parameters
    userIDThe ID of a remote user.
    userNameThe name of the user who joins the room. The field is deprecated. Ignore the field.

◆ onNERtcChannelUserDidLeaveWithUserID:reason:

- (void) onNERtcChannelUserDidLeaveWithUserID: (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.
Since
V4.5.0
Parameters
userIDThe ID of the user that leaves the room.
reasonThe reason why the remote user leaves. For more information, see NERtcSessionLeaveReason.

◆ onNERtcChannelUserSubStreamAudioDidStart:

- (void) onNERtcChannelUserSubStreamAudioDidStart: (uint64_t)  userID
optional

Occurs when a remote user enables the audio substream.

Since
V4.6.10
Parameters
userIDRemote user ID.

◆ onNERtcChannelUserSubStreamAudioDidStop:

- (void) onNERtcChannelUserSubStreamAudioDidStop: (uint64_t)  userID
optional

Occurs when a remote user stops the audio substream.

Since
V4.6.10
Parameters
userIDremote user ID.

◆ onNERtcChannelUserSubStreamDidStartWithUserID:subStreamProfile:

- (void) onNERtcChannelUserSubStreamDidStartWithUserID: (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.
Since
V4.5.0
Parameters
userIDThe ID of a remote user.
profileThe resolution of the remote video. For more information, see NERtcVideoProfileType.

◆ onNERtcChannelUserSubStreamDidStop:

- (void) onNERtcChannelUserSubStreamDidStop: (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.
Since
V4.5.0
Parameters
userIDThe ID of a remote user.

◆ onNERtcChannelUserVideoDidStartWithUserID:videoProfile:

- (void) onNERtcChannelUserVideoDidStartWithUserID: (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.
Since
V4.5.0
Parameters
userIDThe ID of the user whose video streams are sent.
profileThe video profile of the remote user. For more information, see NERtcVideoProfileType.

◆ onNERtcChannelUserVideoDidStop:

- (void) onNERtcChannelUserVideoDidStop: (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.
Since
V4.5.0
Parameters
userIDThe ID of a remote user.

◆ onRemoteAudioVolumeIndication:totalVolume:

- (void) onRemoteAudioVolumeIndication: (nullable NSArray< NERtcAudioVolumeInfo * > *)  speakers
totalVolume: (int)  totalVolume 
optional

Occurs when the system prompts the active speaker and the audio volume.

By default, the callback is disabled. You can enable the callback by calling the enableAudioVolumeIndication method. After the callback is enabled, if a local user speaks, the SDK triggers the callback based on the time interval specified in the enableAudioVolumeIndication method. In the array returned:

  • If a uid is contained in the array returned in the last response but not in the array returned in the current response. The remote user with the uid does not speak by default.
  • If the volume is 0, the user does not speak.
  • If the array is empty, the remote user does not speak.
Since
V4.5.0
Parameters
speakersThe array that contains the information about user IDs and volumes. For more information, see NERtcAudioVolumeInfo.
totalVolumeThe volume of the mixing audio. Value range: 0 to 100.

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