leaveRoom method
@detail api
@author luomingkang
@brief 离开游戏房间。
调用此方法结束通话过程,并释放所有通话相关的资源。
@return
- 0:调用成功。如果用户是房间内可见用户,触发以下回调:
- 远端用户收到 onUserLeave{@link #IRTCRoomEventHandler#onUserLeave} 回调通知。
- 正在发布的流会被取消发布。远端用户收到 onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} 回调通知。
- < 0:调用失败,参看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。
@note
- 加入游戏房间后,必须调用此方法结束通话,否则无法开始下一次通话。
- 此方法是异步操作,调用返回时并没有真正退出房间。真正退出房间后,本地会收到 onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged} 回调通知。你必须在收到 onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged} 回调后,再销毁房间或引擎,或调用 joinRoom{@link #RTCRoom#joinRoom} 再次加入房间。
- 调用 setUserVisibility{@link #RTCRoom#setUserVisibility} 将自身设为可见的用户离开房间后,房间内其他用户会收到 onUserLeave{@link #IRTCRoomEventHandler#onUserLeave} 回调通知。
Implementation
Future<int?> leaveRoom() async {
$a() => ($instance as $p_a.RTCRoom).leaveRoom();
$i() => ($instance as $p_i.ByteRTCRoom).leaveRoom();
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}