IRTSRoomEventHandler class

@detail callback @brief IRTSRoomEventHandler Class
注意:回调函数是在 SDK 内部线程(非 UI 线程)同步抛出来的,请不要做耗时操作或直接操作 UI,否则可能导致 app 崩溃。

Constructors

IRTSRoomEventHandler({FutureOr<void> onLeaveRoom(RTCRoomStats stats)?, FutureOr<void> onRoomStateChanged(String roomId, String uid, int state, String extraInfo)?, FutureOr<void> onUserJoined(UserInfo userInfo)?, FutureOr<void> onUserLeave(String uid, int reason)?, FutureOr<void> onRoomMessageReceived(long msgid, String uid, String message)?, FutureOr<void> onRoomBinaryMessageReceived(long msgid, String uid, ByteBuffer message)?, FutureOr<void> onUserMessageReceived(long msgid, String uid, String message)?, FutureOr<void> onUserBinaryMessageReceived(long msgid, String uid, ByteBuffer message)?, FutureOr<void> onUserMessageSendResult(long msgid, int error)?, FutureOr<void> onRoomMessageSendResult(long msgid, int error)?})

Properties

hashCode int
The hash code for this object.
no setterinherited
onLeaveRoom FutureOr<void> Function(RTCRoomStats stats)?
@platform android @detail callback @brief 离开房间成功回调。
用户调用 leaveRoom{@link #RTSRoom#leaveRoom} 方法后,SDK 会停止所有的发布订阅流,并在释放所有通话相关的音视频资源后,通过此回调通知用户离开房间成功。 @param stats 保留参数,目前为空。 @note - 用户调用 leaveRoom{@link #RTSRoom#leaveRoom} 方法离开房间后,如果立即调用 destroy{@link #RTSRoom#destroy} 销毁房间实例或 destroyRTCEngine{@link #RTCEngine#destroyRTCEngine} 方法销毁 RTC 引擎,则将无法收到此回调事件。 - 离开房间后,如果 App 需要使用系统音视频设备,则建议在收到此回调后再初始化音视频设备,否则可能由于 SDK 占用音视频设备导致初始化失败。
getter/setter pair
onRoomBinaryMessageReceived FutureOr<void> Function(long msgid, String uid, ByteBuffer message)?
@platform android @detail callback @author hanchenchen.c @brief 收到房间内广播二进制消息的回调。
房间内其他用户调用 sendRoomBinaryMessage{@link #RTSRoom#sendRoomBinaryMessage} 发送广播二进制消息时,收到此回调。 @param msgid 消息编号 @param uid 消息发送者 ID @param message 收到的二进制消息内容
getter/setter pair
onRoomMessageReceived FutureOr<void> Function(long msgid, String uid, String message)?
@platform android @detail callback @author hanchenchen.c @brief 接收到房间内广播消息的回调。
房间内其他用户调用 sendRoomMessage{@link #RTSRoom#sendRoomMessage} 发送广播消息时,收到此回调。 @param msgid 消息编号 @param uid 消息发送者 ID @param message 收到的消息内容
getter/setter pair
onRoomMessageSendResult FutureOr<void> Function(long msgid, int error)?
@platform android @detail callback @brief 调用 sendRoomMessage{@link #RTSRoom#sendRoomMessage} 或 sendRoomBinaryMessage{@link #RTSRoom#sendRoomBinaryMessage} 向房间内群发文本或二进制消息后,消息发送方会收到该消息发送结果回调。 @param msgid 本条消息的 ID。 @param error 消息发送结果,详见 RoomMessageSendResult{@link #RoomMessageSendResult}
getter/setter pair
onRoomStateChanged FutureOr<void> Function(String roomId, String uid, int state, String extraInfo)?
@platform android @detail callback @brief 房间状态改变回调,加入房间、异常退出房间、发生房间相关的警告或错误时会收到此回调。 @param roomId 房间 ID。 @param uid 用户 ID。 @param state 房间状态码。
- 0: 加入房间成功。 - !0: 加入房间失败、异常退房、发生房间相关的警告或错误。具体原因参看 ErrorCode{@link #ErrorCode} 及 WarningCode{@link #WarningCode}。 @param extraInfo 额外信息,如 {"elapsed":1187,"join_type":0}
join_type 表示加入房间的类型,0为首次进房,1为重连进房。
elapsed 表示加入房间耗时,即本地用户从调用 joinRoom{@link #RTCRoom#joinRoom} 到加入房间成功所经历的时间间隔,单位为 ms。
getter/setter pair
onUserBinaryMessageReceived FutureOr<void> Function(long msgid, String uid, ByteBuffer message)?
@platform android @detail callback @author hanchenchen.c @brief 收到来自房间中其他用户通过 sendUserBinaryMessage{@link #RTSRoom#sendUserBinaryMessage} 发来的点对点二进制消息时,会收到此回调。 @param msgid 消息编号 @param uid 消息发送者的用户 ID。 @param message 收到的二进制消息内容。
getter/setter pair
onUserJoined FutureOr<void> Function(UserInfo userInfo)?
@platform android @detail callback @brief 远端可见用户加入房间,或房内不可见用户切换为可见的回调。
1.远端用户调用 setUserVisibility{@link #RTCRoom#setUserVisibility} 方法将自身设为可见后加入房间时,房间内其他用户将收到该事件。
2.远端可见用户断网后重新连入房间时,房间内其他用户将收到该事件。
3.房间内隐身远端用户调用 setUserVisibility{@link #RTCRoom#setUserVisibility} 方法切换至可见时,房间内其他用户将收到该事件。
4.新进房用户也会收到进房前已在房内的可见用户的进房回调通知。 @param userInfo 用户信息。参看 UserInfo{@link #UserInfo}。
getter/setter pair
onUserLeave FutureOr<void> Function(String uid, int reason)?
@platform android @detail callback @brief 远端用户离开房间,或切至不可见时,房间内其他用户会收到此事件 @param uid 离开房间,或切至不可见的的远端用户 ID。 @param reason 用户离开房间的原因:
- 0: 远端用户调用 leaveRoom{@link #RTSRoom#leaveRoom} 主动退出房间。 - 1: 远端用户因 Token 过期或网络原因等掉线。详细信息请参看连接状态提示 - 2: 远端用户调用 setUserVisibility{@link #RTCRoom#setUserVisibility} 切换至不可见状态。 - 3: 服务端调用 OpenAPI 将该远端用户踢出房间。
getter/setter pair
onUserMessageReceived FutureOr<void> Function(long msgid, String uid, String message)?
@platform android @detail callback @author hanchenchen.c @brief 收到来自房间中其他用户通过 sendUserMessage{@link #RTSRoom#sendUserMessage} 发来的点对点文本消息时,会收到此回调。 @param msgid 消息编号 @param uid 消息发送者的用户 ID。 @param message 收到的文本消息内容。
getter/setter pair
onUserMessageSendResult FutureOr<void> Function(long msgid, int error)?
@platform android @detail callback @brief 向房间内单个用户发送文本或二进制消息后(P2P),消息发送方会收到该消息发送结果回调。 @param msgid 本条消息的 ID。 @param error 文本或二进制消息发送结果,详见 UserMessageSendResult{@link #UserMessageSendResult} @note 调用 sendUserMessage{@link #RTSRoom#sendUserMessage} 或 sendUserBinaryMessage{@link #RTSRoom#sendUserBinaryMessage} 接口,才能收到此回调。
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited