全员结束会议、被移除提示时间延迟
This commit is contained in:
parent
fc9f72b88e
commit
85a475b19b
|
|
@ -54,7 +54,6 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
state.meetingToken.value = res.data!;
|
state.meetingToken.value = res.data!;
|
||||||
|
|
||||||
if (isInit == true) {
|
if (isInit == true) {
|
||||||
initRtc();
|
|
||||||
signalRSocket();
|
signalRSocket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -105,6 +104,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
void getMeetingRoomAllUser(List<MeetingRoomUser> meetingRoomUsers) async {
|
void getMeetingRoomAllUser(List<MeetingRoomUser> meetingRoomUsers) async {
|
||||||
state.users.value = meetingRoomUsers;
|
state.users.value = meetingRoomUsers;
|
||||||
state.cacheUsers.value = meetingRoomUsers;
|
state.cacheUsers.value = meetingRoomUsers;
|
||||||
|
update();
|
||||||
doHttpGetTvAnchor();
|
doHttpGetTvAnchor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -348,7 +348,8 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
debugPrint("wgs输出===:SignalR Socket-重连失败$error");
|
debugPrint("wgs输出===:SignalR Socket-重连失败$error");
|
||||||
ToastUtils.dismiss();
|
ToastUtils.dismiss();
|
||||||
|
|
||||||
if(state.isNormaExit.value == false && state.isShowOkAlertDialog.value == false){
|
if (state.isNormaExit.value == false &&
|
||||||
|
state.isShowOkAlertDialog.value == false) {
|
||||||
showOkAlertDialog(
|
showOkAlertDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
title: "提示",
|
title: "提示",
|
||||||
|
|
@ -428,6 +429,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
debugPrint("wgs输出===:Socket-关闭发言权限:观众");
|
debugPrint("wgs输出===:Socket-关闭发言权限:观众");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
update();
|
||||||
});
|
});
|
||||||
|
|
||||||
/// ------------------------------------------------------------------------------麦克风相关回调
|
/// ------------------------------------------------------------------------------麦克风相关回调
|
||||||
|
|
@ -443,6 +445,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
}
|
}
|
||||||
state.users.value = state.cacheUsers.value;
|
state.users.value = state.cacheUsers.value;
|
||||||
state.isOpenMicrophone.value = e?[0];
|
state.isOpenMicrophone.value = e?[0];
|
||||||
|
update();
|
||||||
});
|
});
|
||||||
|
|
||||||
/// 用户单独开闭麦回调
|
/// 用户单独开闭麦回调
|
||||||
|
|
@ -480,6 +483,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
muteLocalAudioStream(true);
|
muteLocalAudioStream(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
update();
|
||||||
});
|
});
|
||||||
|
|
||||||
/// ------------------------------------------------------------------------------会议室进出相关回调
|
/// ------------------------------------------------------------------------------会议室进出相关回调
|
||||||
|
|
@ -493,6 +497,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
.toList();
|
.toList();
|
||||||
state.cacheUsers.value.addAll(meetingRoomUsers);
|
state.cacheUsers.value.addAll(meetingRoomUsers);
|
||||||
state.users.value = state.cacheUsers.value;
|
state.users.value = state.cacheUsers.value;
|
||||||
|
update();
|
||||||
debugPrint("wgs输出===:Socket-远端用户或主播加入会议室:$jsonStr");
|
debugPrint("wgs输出===:Socket-远端用户或主播加入会议室:$jsonStr");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -509,6 +514,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.users.value = state.cacheUsers.value;
|
state.users.value = state.cacheUsers.value;
|
||||||
|
update();
|
||||||
doHttpGetTvAnchor();
|
doHttpGetTvAnchor();
|
||||||
debugPrint("wgs输出===:Socket-远端用户或主播离开会议室:$jsonStr");
|
debugPrint("wgs输出===:Socket-远端用户或主播离开会议室:$jsonStr");
|
||||||
});
|
});
|
||||||
|
|
@ -518,15 +524,21 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
// var jsonStr = const Utf8Decoder().convert(json.encode(e).runes.toList());
|
// var jsonStr = const Utf8Decoder().convert(json.encode(e).runes.toList());
|
||||||
var jsonStr = json.encode(e);
|
var jsonStr = json.encode(e);
|
||||||
debugPrint("wgs输出===:Socket-被移除会议:$jsonStr");
|
debugPrint("wgs输出===:Socket-被移除会议:$jsonStr");
|
||||||
Get.back();
|
state.isNormaExit.value = true;
|
||||||
ToastUtils.showSuccess("你已被移除会议");
|
ToastUtils.showSuccess("你已被移除会议");
|
||||||
|
Future.delayed(const Duration(seconds: 1), () {
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/// 全员结束会议回调
|
/// 全员结束会议回调
|
||||||
state.hubConnection.value?.on("AllLeave", (e) {
|
state.hubConnection.value?.on("AllLeave", (e) {
|
||||||
debugPrint("wgs输出===:Socket-全员结束会议");
|
debugPrint("wgs输出===:Socket-全员结束会议");
|
||||||
Get.back();
|
state.isNormaExit.value = true;
|
||||||
ToastUtils.showSuccess("会议已结束");
|
ToastUtils.showSuccess("会议已结束");
|
||||||
|
Future.delayed(const Duration(seconds: 1), () {
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/// ------------------------------------------------------------------------------会议室聊天相关回调
|
/// ------------------------------------------------------------------------------会议室聊天相关回调
|
||||||
|
|
@ -607,6 +619,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
update();
|
||||||
});
|
});
|
||||||
|
|
||||||
/// 设置新的全员观看视频主播回调
|
/// 设置新的全员观看视频主播回调
|
||||||
|
|
@ -620,10 +633,15 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 加入会议室
|
/// 加入会议室
|
||||||
|
/// isAgain:是否重新加入
|
||||||
Future<void> joinMeetingToSocket(bool isAgain) async {
|
Future<void> joinMeetingToSocket(bool isAgain) async {
|
||||||
await state.hubConnection.value?.invoke("joinChannel",
|
await state.hubConnection.value?.invoke("joinChannel",
|
||||||
args: [state.roomNumber.value, false, false, false]);
|
args: [state.roomNumber.value, false, false, false]);
|
||||||
mergeFetch(isAgain);
|
if(isAgain == false){
|
||||||
|
initRtc(false);
|
||||||
|
}else{
|
||||||
|
mergeFetch(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 离开会议室
|
/// 离开会议室
|
||||||
|
|
@ -654,7 +672,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
|
|
||||||
/// ------------------------------------------------------------------------------声网SDK相关
|
/// ------------------------------------------------------------------------------声网SDK相关
|
||||||
/// 初始化声网SDK
|
/// 初始化声网SDK
|
||||||
Future<void> initRtc() async {
|
Future<void> initRtc(bool isAgain) async {
|
||||||
// 请求麦克风、摄像头权限
|
// 请求麦克风、摄像头权限
|
||||||
PermissionService.requestPermissions();
|
PermissionService.requestPermissions();
|
||||||
|
|
||||||
|
|
@ -687,6 +705,8 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
RtcEngineEventHandler(
|
RtcEngineEventHandler(
|
||||||
// 成功加入会议室回调
|
// 成功加入会议室回调
|
||||||
onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
|
onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
|
||||||
|
state.isJoinSuccess.value = true;
|
||||||
|
mergeFetch(isAgain);
|
||||||
debugPrint("wgs输出===:RTC-自己加入会议室,ID:${connection.localUid}");
|
debugPrint("wgs输出===:RTC-自己加入会议室,ID:${connection.localUid}");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -712,6 +732,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
update();
|
||||||
debugPrint("wgs输出===:RTC-远端用户或主播离开会议室,用户或主机的ID:$remoteUid");
|
debugPrint("wgs输出===:RTC-远端用户或主播离开会议室,用户或主机的ID:$remoteUid");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -813,21 +834,26 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
|
|
||||||
// 网络连接状态回调
|
// 网络连接状态回调
|
||||||
onConnectionStateChanged: (RtcConnection connection,
|
onConnectionStateChanged: (RtcConnection connection,
|
||||||
ConnectionStateType stateType, ConnectionChangedReasonType reason) {
|
ConnectionStateType stateType,
|
||||||
|
ConnectionChangedReasonType reason) {
|
||||||
debugPrint("wgs输出===:RTC-网络连接状态发生改变:"
|
debugPrint("wgs输出===:RTC-网络连接状态发生改变:"
|
||||||
"会议室编号(${connection.channelId}),"
|
"会议室编号(${connection.channelId}),"
|
||||||
"网络状态($stateType-${AgoraUtil.getConnectionStateChangedType(stateType)}),"
|
"网络状态($stateType-${AgoraUtil.getConnectionStateChangedType(stateType)}),"
|
||||||
"网络改变原因($reason-${AgoraUtil.getConnectionChangedReasonType(reason)})");
|
"网络改变原因($reason-${AgoraUtil.getConnectionChangedReasonType(reason)})");
|
||||||
if (stateType == ConnectionStateType.connectionStateReconnecting) {
|
if (stateType == ConnectionStateType.connectionStateReconnecting) {
|
||||||
if (EasyLoading.isShow == false) {
|
if (EasyLoading.isShow == false) {
|
||||||
ToastUtils.showLoadingToMask("网络故障,正在重连...", EasyLoadingMaskType.black);
|
ToastUtils.showLoadingToMask(
|
||||||
|
"网络故障,正在重连...", EasyLoadingMaskType.black);
|
||||||
}
|
}
|
||||||
}else if(stateType == ConnectionStateType.connectionStateConnected && reason == ConnectionChangedReasonType.connectionChangedRejoinSuccess){
|
} else if (stateType == ConnectionStateType.connectionStateConnected &&
|
||||||
|
reason ==
|
||||||
|
ConnectionChangedReasonType.connectionChangedRejoinSuccess) {
|
||||||
ToastUtils.dismiss();
|
ToastUtils.dismiss();
|
||||||
if (EasyLoading.isShow == false) {
|
if (EasyLoading.isShow == false) {
|
||||||
ToastUtils.showSuccessToMask("重连成功!", EasyLoadingMaskType.black);
|
ToastUtils.showSuccessToMask("重连成功!", EasyLoadingMaskType.black);
|
||||||
}
|
}
|
||||||
}else if(reason == ConnectionChangedReasonType.connectionChangedLost){
|
} else if (reason ==
|
||||||
|
ConnectionChangedReasonType.connectionChangedLost) {
|
||||||
// 和服务器失去连接后,再延迟15秒(和signalR Socket一致),让SDK继续重连,如果重连不上则告知用户需要重新加入
|
// 和服务器失去连接后,再延迟15秒(和signalR Socket一致),让SDK继续重连,如果重连不上则告知用户需要重新加入
|
||||||
Future.delayed(const Duration(milliseconds: 15000), () {
|
Future.delayed(const Duration(milliseconds: 15000), () {
|
||||||
ToastUtils.dismiss();
|
ToastUtils.dismiss();
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class MeetingMainState {
|
||||||
late Rx<MeetingRoomInfo?> meetingRoomInfo = Rx(null);
|
late Rx<MeetingRoomInfo?> meetingRoomInfo = Rx(null);
|
||||||
/// 是否弹出showOkAlertDialog
|
/// 是否弹出showOkAlertDialog
|
||||||
late RxBool isShowOkAlertDialog = false.obs;
|
late RxBool isShowOkAlertDialog = false.obs;
|
||||||
/// 是否正常退出(点击仅自己退出)
|
/// 是否正常退出(点击仅自己退出、全员结束、被移除)
|
||||||
late RxBool isNormaExit = false.obs;
|
late RxBool isNormaExit = false.obs;
|
||||||
|
|
||||||
/// 会议室计时相关
|
/// 会议室计时相关
|
||||||
|
|
@ -76,6 +76,8 @@ class MeetingMainState {
|
||||||
late RxBool isOpenShare = false.obs;
|
late RxBool isOpenShare = false.obs;
|
||||||
/// 当前视频主播ID
|
/// 当前视频主播ID
|
||||||
late RxString remoteUid = "".obs;
|
late RxString remoteUid = "".obs;
|
||||||
|
/// 是否成功加入会议室
|
||||||
|
late RxBool isJoinSuccess = false.obs;
|
||||||
|
|
||||||
/// 当前谁在说话
|
/// 当前谁在说话
|
||||||
late RxString spokesman = "".obs;
|
late RxString spokesman = "".obs;
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
// 视频-共享
|
// 视频-共享
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: state.pageState.value == 1,
|
visible: state.pageState.value == 1,
|
||||||
child: null != state.rctEngine.value
|
child: state.isJoinSuccess.value == true && null != state.rctEngine.value && null != state.users.value && state.users.value.isNotEmpty
|
||||||
? Stack(
|
? Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -275,7 +275,9 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: Container()),
|
: Container(
|
||||||
|
child: Text('加载反馈:是否成功加入会议室${state.isJoinSuccess.value}-会议室对象${state.rctEngine.value}-成员列表${state.users.value.length}-全员观看ID${state.remoteUid.value}'),
|
||||||
|
)),
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
|
@ -1635,7 +1637,8 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/// gridview
|
/// gridview
|
||||||
pageList.add(Container(
|
pageList.add(GetBuilder<MeetingMainLogic>(builder: (controll){
|
||||||
|
return Container(
|
||||||
color: ColorUtil.Color_57_57_57,
|
color: ColorUtil.Color_57_57_57,
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
|
@ -1645,8 +1648,7 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
state.cacheUsers.value[index].enableCamera == true
|
state.cacheUsers.value[index].enableCamera == true
|
||||||
? state.cacheUsers.value[index].uid ==
|
? state.cacheUsers.value[index].uid == UserStore.to.userInfoEntity.value!.uid
|
||||||
UserStore.to.userInfoEntity.value!.uid
|
|
||||||
? AgoraVideoView(
|
? AgoraVideoView(
|
||||||
controller: VideoViewController(
|
controller: VideoViewController(
|
||||||
rtcEngine: state.rctEngine.value!,
|
rtcEngine: state.rctEngine.value!,
|
||||||
|
|
@ -1774,7 +1776,9 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
));
|
);
|
||||||
|
}));
|
||||||
|
|
||||||
return pageList[position];
|
return pageList[position];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue