leaveRoom method

FutureOr<int> leaveRoom()

@detail api @author shenpengliang @brief 离开 RTC 房间。
调用此方法结束通话过程,并释放所有通话相关的资源。 @return - 0: 调用成功。如果用户是房间内可见用户,触发以下回调: - 远端用户收到 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason} 回调通知。 - 正在发布的流会被取消发布。远端用户收到 rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason}、rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason} 回调通知。 - < 0: 调用失败,参看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。 @note - 加入房间后,必须调用此方法结束通话,否则无法开始下一次通话。 - 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo} 回调通知。你必须在收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo} 回调后,再销毁房间或引擎,或调用 joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig} 再次加入房间。 - 调用 setUserVisibility:{@link #ByteRTCRoom#setUserVisibility} 将自身设为可见的用户离开房间后,房间内其他用户会收到 rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason} 回调通知。

Implementation

FutureOr<int> leaveRoom() async {
  return await nativeCall('leaveRoom', []);
}