1.视频左右切换显示功能完成,但存在卡住问题
This commit is contained in:
parent
3cd40b9f9f
commit
19c46516f3
|
|
@ -372,7 +372,9 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
||||||
mru.enableMicr = true;
|
mru.enableMicr = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) {
|
||||||
state.isOpenMicrophone.value = true;
|
state.isOpenMicrophone.value = true;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
debugPrint("wgs输出===:Socket-单独用户闭麦");
|
debugPrint("wgs输出===:Socket-单独用户闭麦");
|
||||||
for(MeetingRoomUser mru in state.cacheUsers.value){
|
for(MeetingRoomUser mru in state.cacheUsers.value){
|
||||||
|
|
@ -380,8 +382,10 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
||||||
mru.enableMicr = false;
|
mru.enableMicr = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) {
|
||||||
state.isOpenMicrophone.value = false;
|
state.isOpenMicrophone.value = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/// 单独用户开闭摄像头回调
|
/// 单独用户开闭摄像头回调
|
||||||
|
|
@ -397,7 +401,9 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
||||||
mru.enableCamera = true;
|
mru.enableCamera = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid){
|
||||||
state.isOpenCamera.value = true;
|
state.isOpenCamera.value = true;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
debugPrint("wgs输出===:Socket-单独用户闭摄像头");
|
debugPrint("wgs输出===:Socket-单独用户闭摄像头");
|
||||||
for(MeetingRoomUser mru in state.cacheUsers.value){
|
for(MeetingRoomUser mru in state.cacheUsers.value){
|
||||||
|
|
@ -405,8 +411,10 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
||||||
mru.enableCamera = false;
|
mru.enableCamera = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid){
|
||||||
state.isOpenCamera.value = false;
|
state.isOpenCamera.value = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/// 设置新的全员观看视频主播回调
|
/// 设置新的全员观看视频主播回调
|
||||||
|
|
@ -533,12 +541,12 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
||||||
for(AudioVolumeInfo avi in speakers){
|
for(AudioVolumeInfo avi in speakers){
|
||||||
for(MeetingRoomUser mru in state.cacheUsers.value){
|
for(MeetingRoomUser mru in state.cacheUsers.value){
|
||||||
if(avi.uid == 0){
|
if(avi.uid == 0){
|
||||||
debugPrint("wgs输出===:RTC-用户音量提示(自己):${CountMicrophoneVolume.getVolume(avi.volume!)}");
|
//debugPrint("wgs输出===:RTC-用户音量提示(自己):${CountMicrophoneVolume.getVolume(avi.volume!)}");
|
||||||
mru.volume = CountMicrophoneVolume.getVolume(avi.volume!);
|
mru.volume = CountMicrophoneVolume.getVolume(avi.volume!);
|
||||||
state.microphoneVolume.value = CountMicrophoneVolume.getVolume(avi.volume!);
|
state.microphoneVolume.value = CountMicrophoneVolume.getVolume(avi.volume!);
|
||||||
}else{
|
}else{
|
||||||
if(avi.uid.toString() == mru.uid){
|
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!);
|
mru.volume = CountMicrophoneVolume.getVolume(avi.volume!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,7 @@ class MeetingMainPage extends StatelessWidget {
|
||||||
channelId: state.roomNumber.value,
|
channelId: state.roomNumber.value,
|
||||||
isOpenCamera: state.isOpenCamera.value,
|
isOpenCamera: state.isOpenCamera.value,
|
||||||
remoteUid: state.remoteUid.value,
|
remoteUid: state.remoteUid.value,
|
||||||
|
users: state.cacheUsers.value.where((user) => user.enableCamera == true).toList(),
|
||||||
onHangUpTap: (){
|
onHangUpTap: (){
|
||||||
logic.hangUpVideo();
|
logic.hangUpVideo();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,26 +2,36 @@ import 'package:agora_rtc_engine/agora_rtc_engine.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.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 'package:wgshare/common/store/user_store.dart';
|
||||||
|
|
||||||
|
import '../../../common/models/meeting_room_user.dart';
|
||||||
import '../../../utils/color_util.dart';
|
import '../../../utils/color_util.dart';
|
||||||
|
import '../../../view/view_svg_path.dart';
|
||||||
import 'meeting_main_video_logic.dart';
|
import 'meeting_main_video_logic.dart';
|
||||||
import 'meeting_main_video_state.dart';
|
import 'meeting_main_video_state.dart';
|
||||||
|
|
||||||
class MeetingMainVideoComponent extends StatelessWidget {
|
class MeetingMainVideoComponent extends StatefulWidget {
|
||||||
MeetingMainVideoComponent(
|
MeetingMainVideoComponent({super.key,
|
||||||
{super.key,
|
|
||||||
required this.rtcEngine,
|
required this.rtcEngine,
|
||||||
required this.channelId,
|
required this.channelId,
|
||||||
required this.isOpenCamera,
|
required this.isOpenCamera,
|
||||||
required this.remoteUid,
|
required this.remoteUid,
|
||||||
required this.onHangUpTap});
|
required this.onHangUpTap,
|
||||||
|
required this.users});
|
||||||
|
|
||||||
final RtcEngine rtcEngine;
|
RtcEngine rtcEngine;
|
||||||
final String channelId;
|
String channelId;
|
||||||
final String remoteUid;
|
String remoteUid;
|
||||||
final bool isOpenCamera;
|
bool isOpenCamera;
|
||||||
final Function onHangUpTap;
|
List<MeetingRoomUser> users;
|
||||||
|
Function onHangUpTap;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MeetingMainVideoComponent> createState() => _MeetingMainVideoComponentState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MeetingMainVideoComponentState extends State<MeetingMainVideoComponent> with AutomaticKeepAliveClientMixin {
|
||||||
|
|
||||||
final MeetingMainVideoLogic logic = Get.put(MeetingMainVideoLogic());
|
final MeetingMainVideoLogic logic = Get.put(MeetingMainVideoLogic());
|
||||||
final MeetingMainVideoState state = Get.find<MeetingMainVideoLogic>().state;
|
final MeetingMainVideoState state = Get.find<MeetingMainVideoLogic>().state;
|
||||||
|
|
@ -49,12 +59,12 @@ class MeetingMainVideoComponent extends StatelessWidget {
|
||||||
Stack(
|
Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
remoteUid != ""
|
widget.remoteUid != ""
|
||||||
? AgoraVideoView(
|
? AgoraVideoView(
|
||||||
controller: VideoViewController.remote(
|
controller: VideoViewController.remote(
|
||||||
rtcEngine: rtcEngine,
|
rtcEngine: widget.rtcEngine,
|
||||||
canvas: VideoCanvas(uid: int.tryParse(remoteUid)),
|
canvas: VideoCanvas(uid: int.tryParse(widget.remoteUid)),
|
||||||
connection: RtcConnection(channelId: channelId),
|
connection: RtcConnection(channelId: widget.channelId),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: const CircularProgressIndicator(),
|
: const CircularProgressIndicator(),
|
||||||
|
|
@ -66,8 +76,8 @@ class MeetingMainVideoComponent extends StatelessWidget {
|
||||||
width: 50.w,
|
width: 50.w,
|
||||||
height: 50.h,
|
height: 50.h,
|
||||||
),
|
),
|
||||||
onTap: (){
|
onTap: () {
|
||||||
onHangUpTap();
|
widget.onHangUpTap();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -106,7 +116,7 @@ class MeetingMainVideoComponent extends StatelessWidget {
|
||||||
|
|
||||||
/// 右上角小窗
|
/// 右上角小窗
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: isOpenCamera,
|
visible: widget.isOpenCamera,
|
||||||
child: Positioned(
|
child: Positioned(
|
||||||
top: 58,
|
top: 58,
|
||||||
right: 13,
|
right: 13,
|
||||||
|
|
@ -116,10 +126,10 @@ class MeetingMainVideoComponent extends StatelessWidget {
|
||||||
width: 120,
|
width: 120,
|
||||||
height: 150,
|
height: 150,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: isOpenCamera
|
child: widget.isOpenCamera
|
||||||
? AgoraVideoView(
|
? AgoraVideoView(
|
||||||
controller: VideoViewController(
|
controller: VideoViewController(
|
||||||
rtcEngine: rtcEngine,
|
rtcEngine: widget.rtcEngine,
|
||||||
canvas: const VideoCanvas(uid: 0),
|
canvas: const VideoCanvas(uid: 0),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
@ -174,24 +184,31 @@ class MeetingMainVideoComponent extends StatelessWidget {
|
||||||
Container(
|
Container(
|
||||||
color: ColorUtil.Color_57_57_57,
|
color: ColorUtil.Color_57_57_57,
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
childAspectRatio: 0.8,
|
childAspectRatio: 0.8,
|
||||||
crossAxisSpacing: 0),
|
crossAxisSpacing: 0),
|
||||||
itemCount: 5,
|
itemCount: widget.users.length,
|
||||||
itemBuilder: (BuildContext ctx, index) {
|
itemBuilder: (BuildContext ctx, index) {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
widget.users[index].uid ==
|
||||||
padding: const EdgeInsets.only(left: 12, right: 12),
|
UserStore.to.userInfoEntity.value!.uid
|
||||||
decoration: BoxDecoration(
|
? AgoraVideoView(
|
||||||
image: DecorationImage(
|
controller: VideoViewController(
|
||||||
fit: BoxFit.fill,
|
rtcEngine: widget.rtcEngine,
|
||||||
image: NetworkImage(
|
canvas: const VideoCanvas(uid: 0),
|
||||||
"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",
|
),
|
||||||
|
)
|
||||||
|
: AgoraVideoView(
|
||||||
|
controller: VideoViewController.remote(
|
||||||
|
rtcEngine: widget.rtcEngine,
|
||||||
|
canvas: VideoCanvas(
|
||||||
|
uid: int.tryParse(widget.users[index].uid)),
|
||||||
|
connection:
|
||||||
|
RtcConnection(channelId: widget.channelId),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 4,
|
left: 4,
|
||||||
bottom: 4,
|
bottom: 4,
|
||||||
|
|
@ -199,30 +216,55 @@ class MeetingMainVideoComponent extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/images/meeting_main_own.png',
|
'assets/images/meeting_main_own.png',
|
||||||
width: 20.w,
|
width: 24.w,
|
||||||
height: 15.h,
|
height: 24 .h,
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 15,
|
height: 20,
|
||||||
margin: const EdgeInsets.only(left: 4),
|
margin: const EdgeInsets.only(left: 4),
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.only(left: 4, right: 4),
|
const EdgeInsets.only(left: 4, right: 4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(2),
|
borderRadius: BorderRadius.circular(2),
|
||||||
color: ColorUtil.Color_0_0_0_96),
|
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: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/images/meeting_main_microphone_open.png',
|
'assets/images/meeting_main_microphone_open.png',
|
||||||
width: 13.w,
|
width: 20.w,
|
||||||
height: 14.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
SizedBox(width: 4.w),
|
|
||||||
Text(
|
Text(
|
||||||
'晓晓',
|
widget.users[index].userName,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 10.sp,
|
fontSize: 12.sp,
|
||||||
color: ColorUtil.Color_185_184_184),
|
color: ColorUtil.Color_255_255_255),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -262,4 +304,8 @@ class MeetingMainVideoComponent extends StatelessWidget {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get wantKeepAlive => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue