From 86724ced8f070d5cb787bdcc049ea6b98e719a40 Mon Sep 17 00:00:00 2001 From: fuenmao <980740792@qq.com> Date: Mon, 2 Dec 2024 15:17:33 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A3=B0=E7=BD=91token=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E5=A4=84=E7=90=86=202.=E5=A3=B0=E7=BD=91?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E8=A7=92=E8=89=B2=E5=9B=9E=E8=B0=83=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/pages/metting/meeting_main_logic.dart | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/wgshare/lib/pages/metting/meeting_main_logic.dart b/wgshare/lib/pages/metting/meeting_main_logic.dart index c34dcce..46dc7d0 100644 --- a/wgshare/lib/pages/metting/meeting_main_logic.dart +++ b/wgshare/lib/pages/metting/meeting_main_logic.dart @@ -28,7 +28,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{ var data = Get.arguments; state.roomNumber.value = data["roomNumber"]; - doHttpGetMeetingToken(); + doHttpGetMeetingToken(true); } @override @@ -43,12 +43,14 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{ } /// 获取会议室Token - Future doHttpGetMeetingToken() async { + Future doHttpGetMeetingToken(bool isInit) async { BaseStructureResult res = await getClient().getMeetingToken(state.roomNumber.value); state.meetingToken.value = res.data!; - initRtc(); - signalRSocket(); + if(isInit == true){ + initRtc(); + signalRSocket(); + } } /// 合并请求 @@ -492,7 +494,6 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{ } } } - } }, @@ -502,7 +503,12 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{ ClientRoleType oldRole, ClientRoleType newRole, ClientRoleOptions newRoleOptions){ - debugPrint("wgs输出===:RTC-切换用户角色"); + debugPrint("wgs输出===:RTC-切换用户角色为:${newRole == ClientRoleType.clientRoleBroadcaster ? "主播" : "观众"}"); + }, + + // token即将在30秒内过期 + onTokenPrivilegeWillExpire: (RtcConnection connection, String token){ + doHttpGetMeetingToken(false); } ), );