From 2b2510b571267c6a4e7b194a205a0eb0411e6764 Mon Sep 17 00:00:00 2001 From: YakumoChen Date: Tue, 12 May 2026 13:40:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=961v1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/rtc/rtc_manager.dart | 58 +++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/lib/rtc/rtc_manager.dart b/lib/rtc/rtc_manager.dart index 2069004..cc7716d 100644 --- a/lib/rtc/rtc_manager.dart +++ b/lib/rtc/rtc_manager.dart @@ -260,35 +260,39 @@ class RTCManager { print('连接状态改变:$state,原因:$reason, localUid: ${connection.localUid}'); if(state == ConnectionStateType.connectionStateFailed && reason == ConnectionChangedReasonType.connectionChangedBannedByServer){ - if (Get.isRegistered()) { - final roomController = Get.find(); - // 判断不是主播(从 RoomController.currentRole 获取角色) - final isNotBroadcaster = roomController.currentRole != CurrentRole.broadcaster; - if (isNotBroadcaster) { - await roomController.leaveChannel(); - // 调用 LiveChatMessageService 处理结束直播消息 - LiveChatMessageService.instance.handleEndLiveMessage(); - } else { - if(roomController.isClose.value) return; - // 退出房间时清空RTM消息 - await roomController.leaveChannel(); - await roomController.getLiveData(); - await roomController.getLiveIncome(); - SmartDialog.dismiss(); - if (Get.isRegistered()) { - final roomController = Get.find(); - roomController.chatMessages.clear(); - } - // 如果还没有执行 pop,手动调用 Get.back() - Get.off(() => SettlementPage()); - // 等待页面关闭后再显示小窗口,确保小窗口能正确显示 - Future.delayed(const Duration(milliseconds: 200), () { - if (Get.isRegistered()) { - final overlayController = Get.find(); - overlayController.hide(); + if(type != RTCType.call){ + if (Get.isRegistered()) { + final roomController = Get.find(); + // 判断不是主播(从 RoomController.currentRole 获取角色) + final isNotBroadcaster = roomController.currentRole != CurrentRole.broadcaster; + if (isNotBroadcaster) { + await roomController.leaveChannel(); + // 调用 LiveChatMessageService 处理结束直播消息 + LiveChatMessageService.instance.handleEndLiveMessage(); + } else { + if(roomController.isClose.value) return; + // 退出房间时清空RTM消息 + await roomController.leaveChannel(); + await roomController.getLiveData(); + await roomController.getLiveIncome(); + SmartDialog.dismiss(); + if (Get.isRegistered()) { + final roomController = Get.find(); + roomController.chatMessages.clear(); } - }); + // 如果还没有执行 pop,手动调用 Get.back() + Get.off(() => SettlementPage()); + // 等待页面关闭后再显示小窗口,确保小窗口能正确显示 + Future.delayed(const Duration(milliseconds: 200), () { + if (Get.isRegistered()) { + final overlayController = Get.find(); + overlayController.hide(); + } + }); + } } + } else { + CallController.instance.hangUpCall(); } return; }