ByteRTCRTSRoom class

Inheritance
  • Object
  • NativeClass
  • ByteRTCRTSRoom

Constructors

ByteRTCRTSRoom([NativeClassOptions? options])

Properties

$resource → NativeResource
no setterinherited
delegateRts FutureOr<ByteRTCRTSRoomDelegate?>
@detail callback
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
ready Future<void>
Whether the instance is initialized
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

destroy() FutureOr<void>
@detail api @brief 退出并销毁调用 createRTSRoom:{@link #ByteRTCEngine#createRTSRoom} 所创建的 RTS 房间实例。
override
joinRTSRoom(NSString token, ByteRTCUserInfo userInfo) FutureOr<int>
@detail api @brief 加入 RTS 房间。
调用 createRTSRoom:{@link #ByteRTCEngine#createRTSRoom} 创建房间后,调用此方法加入房间,同房间内其他用户进行音视频通话。 @param token 动态密钥,用于对进房用户进行鉴权验证。
进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token。Token 有效期及生成方式参看使用 Token 完成鉴权
使用不同 AppID 的 App 是不能互通的。
请务必保证生成 Token 使用的 AppID 和创建引擎时使用的 AppID 相同,否则会导致加入房间失败。 @param userInfo 用户信息。参看 ByteRTCUserInfo{@link #ByteRTCUserInfo}。 @return 方法调用结果。
- 0: 成功。触发以下回调: - 本端收到房间状态通知 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo} 回调。 - -1: 参数无效 - -2: 已经在房间内。接口调用成功后,只要收到返回值为 0 ,且未调用 leaveRoom{@link #ByteRTCRoom#leaveRoom} 成功,则再次调用进房接口时,无论填写的房间 ID 和用户 ID 是否重复,均触发此返回值。 调用失败时,具体失败原因会通过 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo} 回调告知。 @note - 同一个 AppID 的同一个房间内,每个用户的用户 ID 必须是唯一的。如果两个用户的用户 ID 相同,则后加入房间的用户会将先加入房间的用户踢出房间,并且先加入房间的用户会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo} 回调通知,错误类型为重复登录 ByteRTCErrorCodeDuplicateLogin。 - 本地用户调用此方法加入房间成功后,会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo} 回调通知。若本地用户同时为可见用户,加入房间时远端用户会收到 rtsRoom:onUserJoined:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserJoined} 回调通知。 - 用户加入房间成功后,在本地网络状况不佳的情况下,SDK 可能会与服务器失去连接,并触发 rtcEngine:onConnectionStateChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onConnectionStateChanged} 回调。此时 SDK 会自动重试,直到成功重连。重连成功后,本地会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo}。
leaveRoom() FutureOr<int>
@detail api @brief 离开房间。
用户调用此方法离开房间,结束实时消息通信,释放所有通信相关的资源。 @return 方法调用结果。
+ 0: 方法调用成功
+ < 0: 方法调用失败
@note
+ 可见的用户离开房间后,房间内其他用户会收到 rtsRoom:onUserLeave:reason:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserLeave:reason} 回调通知;
+ 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 rtsRoom:OnLeaveRoom:{@link #ByteRTCRTSRoomDelegate#rtsRoom:OnLeaveRoom} 回调通知。
+ 如果调用此方法后立即销毁引擎,SDK 将无法触发 rtsRoom:OnLeaveRoom:{@link #ByteRTCRTSRoomDelegate#rtsRoom:OnLeaveRoom} 回调。
nativeCall<T>(String method, [List? args, NativeMethodMeta? meta]) Future<T>
Call instance method
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendInstanceGet<T>(String property) Future<T>
Get instance property
inherited
sendInstancePropertiesGet(dynamic nativeClass) Future<Map<String, dynamic>>
Get instance properties
inherited
sendInstanceSet(String property, dynamic value) Future<void>
Set instance property
inherited
sendRoomBinaryMessage(NSData message) FutureOr<int64_t>
@detail api @brief 给房间内的所有其他用户发送二进制消息。 @param message
用户发送的二进制广播消息
消息不超过 64KB。 @return 这次发送消息的编号,从 1 开始递增。 @note
+ 在房间内广播二进制消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo} 加入房间。
+ 调用该函数后会收到一次 rtsRoom:onRoomMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomMessageSendResult:error} 回调,通知消息发送方发送成功或失败;
+ 若二进制消息发送成功,则房间内所有用户会收到 rtsRoom:onRoomBinaryMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomBinaryMessageReceived:message} 回调。
sendRoomMessage(NSString message) FutureOr<int64_t>
@detail api @brief 给房间内的所有其他用户发送文本消息。 @param message
发送的文本消息内容。
消息不超过 64KB。 @return 这次发送消息的编号,从 1 开始递增。 @note
+ 在发送房间内文本消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo} 加入房间。
+ 调用该函数后会收到一次 rtsRoom:onRoomMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomMessageSendResult:error} 回调,通知消息发送方发送成功或失败;
+ 若文本消息发送成功,则房间内远端用户会收到 rtsRoom:onRoomMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomMessageReceived:message} 回调。
sendUserBinaryMessage(NSString uid, NSData message, ByteRTCMessageConfig config) FutureOr<int64_t>
@detail api @brief 给房间内指定的用户发送点对点二进制消息(P2P)。 @param uid
消息接收用户的 ID @param message
发送的二进制消息内容
消息不超过 64KB。 @param config
消息发送的可靠/有序类型,参看 ByteRTCMessageConfig{@link #ByteRTCMessageConfig}。 @return 这次发送消息的编号,从 1 开始递增。 @note - 在发送房间内二进制消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo} 加入房间。 - 调用该函数后会收到一次 rtsRoom:onUserMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserMessageSendResult:error} 回调,通知消息发送方发送成功或失败; - 若二进制消息发送成功,则 uid 所指定的用户会收到 rtsRoom:onUserBinaryMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserBinaryMessageReceived:message} 回调。
sendUserMessage(NSString userId, NSString message, ByteRTCMessageConfig config) FutureOr<int64_t>
@detail api @brief 给房间内指定的用户发送点对点文本消息(P2P)。 @param userId
消息接收用户的 ID @param message
发送的文本消息内容。
消息不超过 64 KB。 @param config
消息发送的可靠/有序类型,参看 ByteRTCMessageConfig{@link #ByteRTCMessageConfig} @return 这次发送消息的编号,从 1 开始递增。 @note - 在发送房间内文本消息前,必须先调用 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo} 加入房间。 - 调用该函数后会收到一次 rtsRoom:onUserMessageSendResult:error:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserMessageSendResult:error} 回调,通知消息发送方发送成功或失败。 - 若文本消息发送成功,则 uid 所指定的用户会收到 rtsRoom:onUserMessageReceived:message:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserMessageReceived:message} 回调。
setRTCRoomDelegateRts(id<ByteRTCRTSRoomDelegate> roomDelegate) FutureOr<int>
@detail api @brief 通过设置 ByteRTCRTSRoomDelegate{@link #ByteRTCRTSRoomDelegate}代理,可以监听此 ByteRTCRTSRoom 对象对应的回调事件。 @param roomDelegate 参见 ByteRTCRTSRoomDelegate{@link #ByteRTCRTSRoomDelegate}。 @return
+ 0: 调用成功。 + < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明
toString() String
A string representation of this object.
inherited
updateResource(NativeResource resource) → void
inherited
updateToken(NSString token) FutureOr<int>
@detail api @brief 更新 Token。
收到 onTokenWillExpire:{@link #ByteRTCRoomDelegate#onTokenWillExpire},onPublishPrivilegeTokenWillExpire:{@link #ByteRTCRoomDelegate#onPublishPrivilegeTokenWillExpire},或 onSubscribePrivilegeTokenWillExpire:{@link #ByteRTCRoomDelegate#onSubscribePrivilegeTokenWillExpire} 时,你必须重新获取 Token,并调用此方法更新 Token,以保证通话的正常进行。 @param token 重新获取的有效 Token。
如果 Token 无效,你会收到 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo},错误码是 -1010。 @return - 0:成功; - !0:失败。 @note 请勿同时调用 updateToken:{@link #ByteRTCRTSRoom#updateToken} 和 joinRTSRoom:userInfo:{@link #ByteRTCRTSRoom#joinRTSRoom:userInfo} 重新加入房间。

Operators

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

Static Properties

codegen_$namespace → dynamic
no setter