diff --git a/wgshare/lib/pages/metting/meeting_main_logic.dart b/wgshare/lib/pages/metting/meeting_main_logic.dart index 7f5a68a..526a8cf 100644 --- a/wgshare/lib/pages/metting/meeting_main_logic.dart +++ b/wgshare/lib/pages/metting/meeting_main_logic.dart @@ -372,7 +372,9 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{ mru.enableMicr = true; } } - state.isOpenMicrophone.value = true; + if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) { + state.isOpenMicrophone.value = true; + } }else{ debugPrint("wgs输出===:Socket-单独用户闭麦"); for(MeetingRoomUser mru in state.cacheUsers.value){ @@ -380,7 +382,9 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{ mru.enableMicr = false; } } - state.isOpenMicrophone.value = false; + if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) { + state.isOpenMicrophone.value = false; + } } }); @@ -397,7 +401,9 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{ mru.enableCamera = true; } } - state.isOpenCamera.value = true; + if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid){ + state.isOpenCamera.value = true; + } }else{ debugPrint("wgs输出===:Socket-单独用户闭摄像头"); for(MeetingRoomUser mru in state.cacheUsers.value){ @@ -405,7 +411,9 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{ mru.enableCamera = false; } } - state.isOpenCamera.value = false; + if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid){ + state.isOpenCamera.value = false; + } } }); @@ -533,12 +541,12 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{ for(AudioVolumeInfo avi in speakers){ for(MeetingRoomUser mru in state.cacheUsers.value){ if(avi.uid == 0){ - debugPrint("wgs输出===:RTC-用户音量提示(自己):${CountMicrophoneVolume.getVolume(avi.volume!)}"); + //debugPrint("wgs输出===:RTC-用户音量提示(自己):${CountMicrophoneVolume.getVolume(avi.volume!)}"); mru.volume = CountMicrophoneVolume.getVolume(avi.volume!); state.microphoneVolume.value = CountMicrophoneVolume.getVolume(avi.volume!); }else{ if(avi.uid.toString() == mru.uid){ - debugPrint("wgs输出===:RTC-用户音量提示(远端用户):${speakers[0].uid}--${speakers[0].volume}"); + //debugPrint("wgs输出===:RTC-用户音量提示(远端用户):${speakers[0].uid}--${speakers[0].volume}"); mru.volume = CountMicrophoneVolume.getVolume(avi.volume!); } } diff --git a/wgshare/lib/pages/metting/meeting_main_view.dart b/wgshare/lib/pages/metting/meeting_main_view.dart index 8626248..aba1e68 100644 --- a/wgshare/lib/pages/metting/meeting_main_view.dart +++ b/wgshare/lib/pages/metting/meeting_main_view.dart @@ -190,6 +190,7 @@ class MeetingMainPage extends StatelessWidget { channelId: state.roomNumber.value, isOpenCamera: state.isOpenCamera.value, remoteUid: state.remoteUid.value, + users: state.cacheUsers.value.where((user) => user.enableCamera == true).toList(), onHangUpTap: (){ logic.hangUpVideo(); }, diff --git a/wgshare/lib/pages/metting/video/meeting_main_video_view.dart b/wgshare/lib/pages/metting/video/meeting_main_video_view.dart index 5cdb25f..f1c1251 100644 --- a/wgshare/lib/pages/metting/video/meeting_main_video_view.dart +++ b/wgshare/lib/pages/metting/video/meeting_main_video_view.dart @@ -2,26 +2,36 @@ import 'package:agora_rtc_engine/agora_rtc_engine.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:liquid_progress_indicator_v2/liquid_progress_indicator.dart'; import 'package:wgshare/common/store/user_store.dart'; +import '../../../common/models/meeting_room_user.dart'; import '../../../utils/color_util.dart'; +import '../../../view/view_svg_path.dart'; import 'meeting_main_video_logic.dart'; import 'meeting_main_video_state.dart'; -class MeetingMainVideoComponent extends StatelessWidget { - MeetingMainVideoComponent( - {super.key, - required this.rtcEngine, - required this.channelId, - required this.isOpenCamera, - required this.remoteUid, - required this.onHangUpTap}); +class MeetingMainVideoComponent extends StatefulWidget { + MeetingMainVideoComponent({super.key, + required this.rtcEngine, + required this.channelId, + required this.isOpenCamera, + required this.remoteUid, + required this.onHangUpTap, + required this.users}); - final RtcEngine rtcEngine; - final String channelId; - final String remoteUid; - final bool isOpenCamera; - final Function onHangUpTap; + RtcEngine rtcEngine; + String channelId; + String remoteUid; + bool isOpenCamera; + List users; + Function onHangUpTap; + + @override + State createState() => _MeetingMainVideoComponentState(); +} + +class _MeetingMainVideoComponentState extends State with AutomaticKeepAliveClientMixin { final MeetingMainVideoLogic logic = Get.put(MeetingMainVideoLogic()); final MeetingMainVideoState state = Get.find().state; @@ -49,14 +59,14 @@ class MeetingMainVideoComponent extends StatelessWidget { Stack( alignment: Alignment.center, children: [ - remoteUid != "" + widget.remoteUid != "" ? AgoraVideoView( - controller: VideoViewController.remote( - rtcEngine: rtcEngine, - canvas: VideoCanvas(uid: int.tryParse(remoteUid)), - connection: RtcConnection(channelId: channelId), - ), - ) + controller: VideoViewController.remote( + rtcEngine: widget.rtcEngine, + canvas: VideoCanvas(uid: int.tryParse(widget.remoteUid)), + connection: RtcConnection(channelId: widget.channelId), + ), + ) : const CircularProgressIndicator(), Positioned( bottom: 110, @@ -66,8 +76,8 @@ class MeetingMainVideoComponent extends StatelessWidget { width: 50.w, height: 50.h, ), - onTap: (){ - onHangUpTap(); + onTap: () { + widget.onHangUpTap(); }, ), ), @@ -106,7 +116,7 @@ class MeetingMainVideoComponent extends StatelessWidget { /// 右上角小窗 Visibility( - visible: isOpenCamera, + visible: widget.isOpenCamera, child: Positioned( top: 58, right: 13, @@ -116,13 +126,13 @@ class MeetingMainVideoComponent extends StatelessWidget { width: 120, height: 150, child: Center( - child: isOpenCamera + child: widget.isOpenCamera ? AgoraVideoView( - controller: VideoViewController( - rtcEngine: rtcEngine, - canvas: const VideoCanvas(uid: 0), - ), - ) + controller: VideoViewController( + rtcEngine: widget.rtcEngine, + canvas: const VideoCanvas(uid: 0), + ), + ) : const CircularProgressIndicator(), ), ), @@ -140,7 +150,7 @@ class MeetingMainVideoComponent extends StatelessWidget { height: 15, margin: const EdgeInsets.only(left: 4), padding: - const EdgeInsets.only(left: 4, right: 4), + const EdgeInsets.only(left: 4, right: 4), decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), color: ColorUtil.Color_0_0_0_96), @@ -174,24 +184,31 @@ class MeetingMainVideoComponent extends StatelessWidget { Container( color: ColorUtil.Color_57_57_57, child: GridView.builder( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, childAspectRatio: 0.8, crossAxisSpacing: 0), - itemCount: 5, + itemCount: widget.users.length, itemBuilder: (BuildContext ctx, index) { return Stack( children: [ - Container( - padding: const EdgeInsets.only(left: 12, right: 12), - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: NetworkImage( - "https://tse1-mm.cn.bing.net/th/id/OIP-C.hdhK40Dw3yN_2mjNQNqFCgAAAA?w=186&h=186&c=7&r=0&o=5&pid=1.7", - ), - ), - )), + widget.users[index].uid == + UserStore.to.userInfoEntity.value!.uid + ? AgoraVideoView( + controller: VideoViewController( + rtcEngine: widget.rtcEngine, + canvas: const VideoCanvas(uid: 0), + ), + ) + : AgoraVideoView( + controller: VideoViewController.remote( + rtcEngine: widget.rtcEngine, + canvas: VideoCanvas( + uid: int.tryParse(widget.users[index].uid)), + connection: + RtcConnection(channelId: widget.channelId), + ), + ), Positioned( left: 4, bottom: 4, @@ -199,30 +216,55 @@ class MeetingMainVideoComponent extends StatelessWidget { children: [ Image.asset( 'assets/images/meeting_main_own.png', - width: 20.w, - height: 15.h, + width: 24.w, + height: 24 .h, ), Container( - height: 15, + height: 20, margin: const EdgeInsets.only(left: 4), padding: - const EdgeInsets.only(left: 4, right: 4), + const EdgeInsets.only(left: 4, right: 4), decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), color: ColorUtil.Color_0_0_0_96), - child: Row( + child: widget.users[index].enableMicr == true + ? Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: 20.w, + height: 20.h, + child: LiquidCustomProgressIndicator( + value: widget.users[index].volume ?? 0.0, + valueColor: const AlwaysStoppedAnimation(ColorUtil.Color_2_177_136), + backgroundColor: ColorUtil.Color_255_255_255, + direction: Axis.vertical, + shapePath: ViewSvgPath.getMicrpphonePath() + ), + ), + Text( + widget.users[index].userName, + style: TextStyle( + fontSize: 12.sp, + color: ColorUtil.Color_255_255_255), + ) + ], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( 'assets/images/meeting_main_microphone_open.png', - width: 13.w, - height: 14.h, + width: 20.w, + height: 20.h, ), - SizedBox(width: 4.w), Text( - '晓晓', + widget.users[index].userName, style: TextStyle( - fontSize: 10.sp, - color: ColorUtil.Color_185_184_184), + fontSize: 12.sp, + color: ColorUtil.Color_255_255_255), ) ], ), @@ -262,4 +304,8 @@ class MeetingMainVideoComponent extends StatelessWidget { ], ); } + + @override + bool get wantKeepAlive => true; } +