NERtc Windows SDK  V4.4.301
Public 成员函数 | 所有成员列表
nertc::IRtcEngineEventHandler类 参考

#include <nertc_engine_event_handler.h>

类 nertc::IRtcEngineEventHandler 继承关系图:
nertc::IRtcEngineEventHandlerEx

Public 成员函数

virtual void onError (int error_code, const char *msg)
 
virtual void onWarning (int warn_code, const char *msg)
 
virtual void onReleasedHwResources (NERtcErrorCode result)
 
virtual void onJoinChannel (channel_id_t cid, uid_t uid, NERtcErrorCode result, uint64_t elapsed)
 
virtual void onReconnectingStart (channel_id_t cid, uid_t uid)
 
virtual void onConnectionStateChange (NERtcConnectionStateType state, NERtcReasonConnectionChangedType reason)
 
virtual void onRejoinChannel (channel_id_t cid, uid_t uid, NERtcErrorCode result, uint64_t elapsed)
 
virtual void onLeaveChannel (NERtcErrorCode result)
 
virtual void onDisconnect (NERtcErrorCode reason)
 
virtual void onClientRoleChanged (NERtcClientRole oldRole, NERtcClientRole newRole)
 
virtual void onUserJoined (uid_t uid, const char *user_name)
 
virtual void onUserLeft (uid_t uid, NERtcSessionLeaveReason reason)
 
virtual void onUserAudioStart (uid_t uid)
 
virtual void onUserAudioStop (uid_t uid)
 
virtual void onUserVideoStart (uid_t uid, NERtcVideoProfileType max_profile)
 
virtual void onUserVideoStop (uid_t uid)
 

详细描述

IRtcEngineEventHandler callback interface class is used to send callback event notifications to the app from SDK. The app gets event notifications from the SDK through inheriting the interface class.

All methods in this interface class have their (empty) default implementations, and the application can inherit only some of the required events instead of all of them. When calling a callback method, the application must not implement time-consuming operations or call blocking-triggered APIs. For example, if you want to enable audio and video, the SDK may be affected in the runtime.

成员函数说明

◆ onClientRoleChanged()

virtual void nertc::IRtcEngineEventHandler::onClientRoleChanged ( NERtcClientRole  oldRole,
NERtcClientRole  newRole 
)
inlinevirtual

Occurs when a user changes the role in live streaming.

After the local user joins a room, the user can call the setClientRole to change the role. Then, the callback is triggered. For example, you can switch the role 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 is locally triggered, and the onUserLeft is remotely triggered.
  • If the role is changed from audience to host, the onClientRoleChange callback is locally triggered, and the onUserJoined is remotely triggered.
参数
oldRoleThe role before the user changes the role.
newRoleThe role after the change.

◆ onConnectionStateChange()

virtual void nertc::IRtcEngineEventHandler::onConnectionStateChange ( NERtcConnectionStateType  state,
NERtcReasonConnectionChangedType  reason 
)
inlinevirtual

Occurs when the state of network connection is changed.

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

参数
stateThe state of current network connection.
reasonThe reason why the network state changes.

◆ onDisconnect()

virtual void nertc::IRtcEngineEventHandler::onDisconnect ( NERtcErrorCode  reason)
inlinevirtual

Network connection interruption.

注解
  • The callback is triggered if the SDK fails to connect to the server three consecutive times after you successfully call the joinChannel method.
  • A client may be disconnected from the server in poor network connection. At this time, the SDK needs not automatically reconnecting until the SDK triggers the callback method.
参数
reasonindicates the reason why the network is disconnected.

◆ onError()

virtual void nertc::IRtcEngineEventHandler::onError ( int  error_code,
const char *  msg 
)
inlinevirtual

Occurs when the 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.

参数
error_codeThe error code. For more information, see NERtcDMErrorCode.
msgError description.

◆ onJoinChannel()

virtual void nertc::IRtcEngineEventHandler::onJoinChannel ( channel_id_t  cid,
uid_t  uid,
NERtcErrorCode  result,
uint64_t  elapsed 
)
inlinevirtual

Allows a user to join a room. The callback indicates that the client has already signed in.

参数
cidThe ID of the room that the client joins.
uidSpecifies the ID of a user. If you specify the uid in the joinChannel method, a specificed ID is returned at the time. If not, the ID automatically assigned by the YunXin’s server is returned.
resultIndicates the result.
elapsedThe time elapsed from calling the joinChannel method to the occurrence of this event. Unit: milliseconds.

◆ onLeaveChannel()

virtual void nertc::IRtcEngineEventHandler::onLeaveChannel ( NERtcErrorCode  result)
inlinevirtual

Occurs when a user leaves a room.

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

参数
resultindicates the result.

◆ onReconnectingStart()

virtual void nertc::IRtcEngineEventHandler::onReconnectingStart ( channel_id_t  cid,
uid_t  uid 
)
inlinevirtual

Triggers reconnection.

In some cases, a client may be disconnected from the server, the SDK starts reconnecting. The callback is triggered when the reconnection starts.

参数
cidSpecifies the ID of a room.
uidSpecifies the ID of a user.

◆ onRejoinChannel()

virtual void nertc::IRtcEngineEventHandler::onRejoinChannel ( channel_id_t  cid,
uid_t  uid,
NERtcErrorCode  result,
uint64_t  elapsed 
)
inlinevirtual

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.

参数
cidThe ID of the room that the client joins.
uidThe ID of a user.
resultThe result.
elapsedThe time elapsed from reconnection to the occurrence of this event. Unit: milliseconds.

◆ onReleasedHwResources()

virtual void nertc::IRtcEngineEventHandler::onReleasedHwResources ( NERtcErrorCode  result)
inlinevirtual

Occurs when the hardware resources are released.

The SDK prompts whether hardware resources are successfully released.

参数
resultindicates the result.

◆ onUserAudioStart()

virtual void nertc::IRtcEngineEventHandler::onUserAudioStart ( uid_t  uid)
inlinevirtual

Occurs when a remote user enables audio.

参数
uidThe ID of a remote user.

◆ onUserAudioStop()

virtual void nertc::IRtcEngineEventHandler::onUserAudioStop ( uid_t  uid)
inlinevirtual

Occurs when a remote user disables audio.

参数
uidThe ID of a remote user.

◆ onUserJoined()

virtual void nertc::IRtcEngineEventHandler::onUserJoined ( uid_t  uid,
const char *  user_name 
)
inlinevirtual

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.

参数
uidThe ID of the user that joins the room.
user_nameThe name of the remote user who joins the room.

◆ onUserLeft()

virtual void nertc::IRtcEngineEventHandler::onUserLeft ( uid_t  uid,
NERtcSessionLeaveReason  reason 
)
inlinevirtual

Occurs when a remote user leaves a room.

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

  • When a user leaves a room, remote users will receive callback notifications that users leave the room. In this way, users can be specified to leave 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.
参数
uidThe ID of the user that leaves the room.
reasonThe reason why remote user leaves.

◆ onUserVideoStart()

virtual void nertc::IRtcEngineEventHandler::onUserVideoStart ( uid_t  uid,
NERtcVideoProfileType  max_profile 
)
inlinevirtual

Occurs when a remote user enables video.

参数
uidThe ID of a remote user.
max_profileThe resolution of video encoding measures the encoding quality.

◆ onUserVideoStop()

virtual void nertc::IRtcEngineEventHandler::onUserVideoStop ( uid_t  uid)
inlinevirtual

Occurs when a remote user disables video.

参数
uidThe ID of a remote user.

◆ onWarning()

virtual void nertc::IRtcEngineEventHandler::onWarning ( int  warn_code,
const char *  msg 
)
inlinevirtual

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 app ignores the warning message and the SDK resumes running.

参数
warn_codeThe warning code. For more information, see NERtcWarnCode.
msgThe warning description.

该类的文档由以下文件生成: