申请/禁止发言与打开/关闭麦克风逻辑优化

This commit is contained in:
fuenmao 2024-11-28 15:04:20 +08:00
parent 92db340c86
commit 423ad947c2
15 changed files with 66 additions and 44 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

View File

@ -139,6 +139,18 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
BaseStructureResult res = await getClient().cancelSpeak(state.meetingRoomInfo.value!.id, state.meetingRoomInfo.value!.roomNum, UserStore.to.userInfoEntity.value!.uid); BaseStructureResult res = await getClient().cancelSpeak(state.meetingRoomInfo.value!.id, state.meetingRoomInfo.value!.roomNum, UserStore.to.userInfoEntity.value!.uid);
} }
///
void setMicrophoneOpen(bool isOpen){
state.isOpenMicrophone.value = isOpen;
for(var i = 0; i < state.cacheUsers.value.length; i++){
if(state.cacheUsers.value[i].uid == UserStore.to.userInfoEntity.value!.uid){
state.cacheUsers.value[i].enableMicr = isOpen;
}
}
state.users.value = state.cacheUsers.value;
setEnableLocalAudio(isOpen);
}
/// --------------------------signalR Socket相关 /// --------------------------signalR Socket相关
/// Socket长连接 /// Socket长连接
Future<void> signalRSocket() async { Future<void> signalRSocket() async {
@ -194,6 +206,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
} }
if(UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid){ if(UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid){
state.isSpeak.value = true; state.isSpeak.value = true;
state.isOpenMicrophone.value = true;
setEnableLocalAudio(true); setEnableLocalAudio(true);
} }
}else{ }else{
@ -207,6 +220,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
} }
if(UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid){ if(UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid){
state.isSpeak.value = false; state.isSpeak.value = false;
state.isOpenMicrophone.value = false;
setEnableLocalAudio(false); setEnableLocalAudio(false);
} }
} }
@ -285,7 +299,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
)); ));
// //
state.rctEngine.value?.setDefaultAudioRouteToSpeakerphone(true); state.rctEngine.value?.setDefaultAudioRouteToSpeakerphone(false);
joinMeetingToRtc(); joinMeetingToRtc();

View File

@ -53,6 +53,8 @@ class MeetingMainState {
/// ///
late RxBool isSpeak = false.obs; late RxBool isSpeak = false.obs;
///
late RxBool isOpenMicrophone = false.obs;
/// ///
late RxList<MeetingRoomMsg> meetingRoomMsgs = RxList([]); late RxList<MeetingRoomMsg> meetingRoomMsgs = RxList([]);

View File

@ -60,7 +60,7 @@ class MeetingMainPage extends StatelessWidget {
SizedBox(width: 16.w), SizedBox(width: 16.w),
GestureDetector( GestureDetector(
child: Image.asset( child: Image.asset(
state.communicationMode.value == 1 ? 'assets/images/index_copy.png' : state.communicationMode.value == 3 ? 'assets/images/meeting_main_camera_open.png' : 'assets/images/meeting_main_audio.png', state.communicationMode.value == 1 ? 'assets/images/meeting_main_receiver.png' : 'assets/images/meeting_main_speaker.png',
width: 20.w, width: 20.w,
height: 20.h, height: 20.h,
), ),
@ -118,22 +118,42 @@ class MeetingMainPage extends StatelessWidget {
logic.changeMeetingInfoState(true); logic.changeMeetingInfoState(true);
}, },
), ),
GestureDetector( Container(
child: Container( width: 92.w,
width: 92.w, child: Row(
alignment: Alignment.centerRight, mainAxisAlignment: MainAxisAlignment.end,
child: Image.asset( children: [
'assets/images/meeting_leave.png', ///
width: 20.w, Visibility(
height: 20.h, visible: state.isSpeak.value,
), child: GestureDetector(
child: Image.asset(
'assets/images/meeting_main_hang_up.png',
width: 22.w,
height: 22.h,
),
onTap: () {
logic.doHttpCancelSpeak();
},
),
),
SizedBox(width: 16.w),
/// 退
GestureDetector(
child: Image.asset(
'assets/images/meeting_leave.png',
width: 20.w,
height: 20.h,
),
onTap: () {
Get.bottomSheet(
isScrollControlled: true,
leaveBottomSheet(context)
);
},
)
],
), ),
onTap: () {
Get.bottomSheet(
isScrollControlled: true,
leaveBottomSheet(context)
);
},
) )
], ],
), ),
@ -228,16 +248,20 @@ class MeetingMainPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
state.isSpeak.value == true ? 'assets/images/meeting_main_microphone_mute.png' : 'assets/images/meeting_main_microphone_default.png', state.isSpeak.value == false
? 'assets/images/meeting_main_sqfy.png'
: state.isOpenMicrophone.value == true
? 'assets/images/meeting_main_microphone_default.png'
: 'assets/images/meeting_main_sqfy.png',
width: 22.w, width: 22.w,
height: 22.h, height: 22.h,
), ),
SizedBox(height: 4.h), SizedBox(height: 4.h),
Text( Text(
' 静音 ', state.isSpeak.value == false ? '申请发言' : state.isOpenMicrophone.value == true ? "手动静音" : "解除静音",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
color: state.isSpeak.value == true ? ColorUtil.Color_85_117_242 : ColorUtil.Color_202_202_202), color: ColorUtil.Color_202_202_202),
) )
], ],
), ),
@ -249,7 +273,11 @@ class MeetingMainPage extends StatelessWidget {
context) context)
); );
}else{ }else{
logic.doHttpCancelSpeak(); if(state.isOpenMicrophone.value == false){
logic.setMicrophoneOpen(true);
}else{
logic.setMicrophoneOpen(false);
}
} }
}, },
), ),
@ -260,7 +288,7 @@ class MeetingMainPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
'assets/images/meeting_main_camera_default.png', 'assets/images/meeting_main_sp.png',
width: 22.w, width: 22.w,
height: 22.h, height: 22.h,
), ),
@ -328,28 +356,6 @@ class MeetingMainPage extends StatelessWidget {
); );
}, },
), ),
///
/*GestureDetector(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/images/meeting_main_more_default.png',
width: 22.w,
height: 22.h,
),
SizedBox(height: 4.h),
Text(
' 更多 ',
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_202_202_202),
)
],
),
onTap: () {},
)*/
], ],
), ),
) )