leaveRoom method
@detail api
@author luomingkang
@brief 离开游戏房间。
调用此方法结束通话过程,并释放所有通话相关的资源。
@return
- 0: 调用成功。如果用户是房间内可见用户,触发以下回调:
- 远端用户收到 rtcRoom:onUserLeave:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserLeave:reason} 回调通知。
- 正在发布的流会被取消发布。远端用户收到 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason}、rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason} 和/或 rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason} 回调通知。
- < 0: 调用失败,参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。
@note
- 加入房间后,必须调用此方法结束通话,否则无法开始下一次通话。
- 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChangedWithReason:withUid:state:reason} 回调通知。你必须在收到 rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChangedWithReason:withUid:state:reason} 回调后,再销毁房间或引擎,或调用 joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo} 再次加入房间。
Implementation
FutureOr<int> leaveRoom() async {
return await nativeCall('leaveRoom', []);
}