parent
7ba1f90b9c
commit
f7c39f5110
|
|
@ -17,7 +17,7 @@ import '../../utils/permission/PermissionService.dart';
|
|||
import '../../utils/toast_utils.dart';
|
||||
import 'meeting_main_state.dart';
|
||||
|
||||
class MeetingMainLogic extends GetxController with RequestToolMixin{
|
||||
class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||
final MeetingMainState state = MeetingMainState();
|
||||
|
||||
@override
|
||||
|
|
@ -45,10 +45,11 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
|
||||
/// 获取会议室Token
|
||||
Future<void> doHttpGetMeetingToken(bool isInit) async {
|
||||
BaseStructureResult<String> res = await getClient().getMeetingToken(state.roomNumber.value);
|
||||
BaseStructureResult<String> res =
|
||||
await getClient().getMeetingToken(state.roomNumber.value);
|
||||
state.meetingToken.value = res.data!;
|
||||
|
||||
if(isInit == true){
|
||||
if (isInit == true) {
|
||||
initRtc();
|
||||
signalRSocket();
|
||||
}
|
||||
|
|
@ -58,32 +59,33 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
/// 1.获取会议室信息
|
||||
/// 2.获取会议室所有用户
|
||||
Future<void> mergeFetch() async {
|
||||
try{
|
||||
try {
|
||||
ToastUtils.showLoading();
|
||||
|
||||
var results = await Future.wait([
|
||||
getClient().getMeetingRoomInfo(state.roomNumber.value),
|
||||
getClient().getMeetingRoomAllUser(state.roomNumber.value)]);
|
||||
getClient().getMeetingRoomAllUser(state.roomNumber.value)
|
||||
]);
|
||||
|
||||
getMeetingRoomInfo(results[0].data as MeetingRoomInfo);
|
||||
getMeetingRoomAllUser(results[1].data as List<MeetingRoomUser>);
|
||||
}finally{
|
||||
} finally {
|
||||
ToastUtils.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
/// 改变会议信息浮层显示状态
|
||||
void changeMeetingInfoState(bool isShow){
|
||||
void changeMeetingInfoState(bool isShow) {
|
||||
state.isShowMeetingInfoFloatingLayer.value = isShow;
|
||||
}
|
||||
|
||||
/// 改变音频选择浮层显示状态
|
||||
void changeMeetingAudioState(bool isShow){
|
||||
void changeMeetingAudioState(bool isShow) {
|
||||
state.isShowMeetingAudioFloatingLayer.value = isShow;
|
||||
}
|
||||
|
||||
/// 改变当前页面状态
|
||||
void changePageState(int pageState){
|
||||
void changePageState(int pageState) {
|
||||
state.pageState.value = pageState;
|
||||
}
|
||||
|
||||
|
|
@ -101,16 +103,17 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
}
|
||||
|
||||
/// 启动计时
|
||||
void startTime(){
|
||||
void startTime() {
|
||||
state.stopwatch.value.start();
|
||||
state.timer.value = Timer.periodic(const Duration(milliseconds: 100), upTime);
|
||||
state.timer.value =
|
||||
Timer.periodic(const Duration(milliseconds: 100), upTime);
|
||||
}
|
||||
|
||||
/// 更新计时
|
||||
void upTime(Timer t) {
|
||||
if(state.stopwatch.value.isRunning){
|
||||
if (state.stopwatch.value.isRunning) {
|
||||
state.duration.value =
|
||||
"${state.stopwatch.value.elapsed.inHours.toString().padLeft(2, "0")}"
|
||||
"${state.stopwatch.value.elapsed.inHours.toString().padLeft(2, "0")}"
|
||||
":${(state.stopwatch.value.elapsed.inMinutes % 60).toString().padLeft(2, "0")}"
|
||||
":${(state.stopwatch.value.elapsed.inSeconds % 60).toString().padLeft(2, "0")}";
|
||||
}
|
||||
|
|
@ -123,16 +126,16 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
}
|
||||
|
||||
/// 搜索成员
|
||||
void searchMember(String value){
|
||||
if(value.isNotEmpty){
|
||||
void searchMember(String value) {
|
||||
if (value.isNotEmpty) {
|
||||
List<MeetingRoomUser> memberSearchList = [];
|
||||
for(var i = 0; i < state.cacheUsers.value.length; i++){
|
||||
if(state.cacheUsers.value[i].userName.contains(value)){
|
||||
for (var i = 0; i < state.cacheUsers.value.length; i++) {
|
||||
if (state.cacheUsers.value[i].userName.contains(value)) {
|
||||
memberSearchList.add(state.cacheUsers.value[i]);
|
||||
}
|
||||
}
|
||||
state.users.value = memberSearchList;
|
||||
}else{
|
||||
} else {
|
||||
state.users.value = state.cacheUsers.value;
|
||||
}
|
||||
}
|
||||
|
|
@ -145,128 +148,106 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
|
||||
/// 关闭发言权限
|
||||
Future<void> doHttpCancelSpeak() async {
|
||||
await getClient().cancelSpeak(state.meetingRoomInfo.value!.id, state.meetingRoomInfo.value!.roomNum, UserStore.to.userInfoEntity.value!.uid);
|
||||
await getClient().cancelSpeak(
|
||||
state.meetingRoomInfo.value!.id,
|
||||
state.meetingRoomInfo.value!.roomNum,
|
||||
UserStore.to.userInfoEntity.value!.uid);
|
||||
}
|
||||
|
||||
/// 关闭发言权限合并请求
|
||||
Future<void> cancelSpeak() async {
|
||||
try {
|
||||
ToastUtils.showLoading();
|
||||
|
||||
await Future.wait(
|
||||
[doHttpCancelSpeak(), doHttpSetMicr(false), doHttpSetCamer(false)]);
|
||||
} finally {
|
||||
ToastUtils.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
/// ------------------------------------------------------------------------------麦克风相关(操作)
|
||||
/// 用户开闭麦
|
||||
Future<void> doHttpSetMicr(bool isOpenMicrophone) async {
|
||||
await getClient().setMicr(state.roomNumber.value, isOpenMicrophone, UserStore.to.userInfoEntity.value!.uid);
|
||||
await getClient().setMicr(state.roomNumber.value, isOpenMicrophone,
|
||||
UserStore.to.userInfoEntity.value!.uid);
|
||||
}
|
||||
|
||||
/// ------------------------------------------------------------------------------视频-屏幕相关(操作)
|
||||
/// 用户开闭摄像头
|
||||
Future<void> doHttpSetCamer(bool isOpenCamera) async {
|
||||
await getClient().setCamera(state.roomNumber.value, isOpenCamera, UserStore.to.userInfoEntity.value!.uid);
|
||||
await getClient().setCamera(state.roomNumber.value, isOpenCamera,
|
||||
UserStore.to.userInfoEntity.value!.uid);
|
||||
}
|
||||
|
||||
/// 设置视频是否开启
|
||||
void setCameraOpen(bool isOpen){
|
||||
void setCameraOpen(bool isOpen) {
|
||||
state.isOpenCamera.value = isOpen;
|
||||
}
|
||||
|
||||
/// 获取当前全员观看主播
|
||||
Future<void> doHttpGetTvAnchor() async {
|
||||
BaseStructureResult res = await getClient().getTvAnchor(state.roomNumber.value);
|
||||
BaseStructureResult res =
|
||||
await getClient().getTvAnchor(state.roomNumber.value);
|
||||
state.remoteUid.value = res.data!.toString();
|
||||
debugPrint("wgs输出===:获取当前全员观看主播${res.data}");
|
||||
|
||||
if(res.data!.toString().length != 9){
|
||||
if (res.data!.toString().length != 9) {
|
||||
// 摄像头
|
||||
// 判断自己是不是全员观看主播
|
||||
if(state.remoteUid.value == UserStore.to.userInfoEntity.value!.uid) {
|
||||
state.isSelf.value = true;
|
||||
}else{
|
||||
state.isSelf.value = false;
|
||||
}
|
||||
|
||||
if(state.isSelf.value == true){
|
||||
// 如果自己是全员观看主播
|
||||
if(state.isOpenCamera.value == true){
|
||||
// 有发言权限且开了摄像头的时候才切换页面到视频状态
|
||||
changePageState(1);
|
||||
state.floating.value?.close();
|
||||
}else{
|
||||
// 否则切换页面到语音状态
|
||||
changePageState(0);
|
||||
}
|
||||
}else{
|
||||
// 如果自己不是全员观看主播
|
||||
var isCurrentUserIsCamera = false;
|
||||
// 遍历当前会议室用户列表获取对应用户判断
|
||||
for(var i = 0; i < state.cacheUsers.value.length; i++){
|
||||
if(state.remoteUid.value == state.cacheUsers.value[i].uid && state.cacheUsers.value[i].enableCamera == true){
|
||||
isCurrentUserIsCamera = true;
|
||||
}
|
||||
}
|
||||
if(isCurrentUserIsCamera == true){
|
||||
changePageState(1);
|
||||
}else{
|
||||
changePageState(0);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// 共享屏幕
|
||||
// 判断是不是自己在共享
|
||||
if(state.remoteUid.value != UserStore.to.userInfoEntity.value!.screenShareId){
|
||||
state.isSelf.value = false;
|
||||
}else{
|
||||
state.isSelf.value = true;
|
||||
}
|
||||
|
||||
// 不是自己在共享才切换页面状态
|
||||
if(state.isSelf.value == false){
|
||||
changePageState(1);
|
||||
}
|
||||
}
|
||||
/*if(res.data!.toString().length != 9){
|
||||
if(state.remoteUid.value != UserStore.to.userInfoEntity.value!.uid) {
|
||||
state.isSelf.value = false;
|
||||
}else{
|
||||
state.isSelf.value = true;
|
||||
}
|
||||
if(state.isSelf.value == true){
|
||||
if(state.isOpenCamera.value == true){
|
||||
changePageState(1);
|
||||
}else{
|
||||
changePageState(0);
|
||||
}
|
||||
if (state.remoteUid.value == UserStore.to.userInfoEntity.value!.uid) {
|
||||
// 全员观看主播是自己
|
||||
// 设置主播ID为0(自己)
|
||||
state.remoteUid.value = "0";
|
||||
// 关闭右上角悬浮窗
|
||||
state.floating.value?.close();
|
||||
}else{
|
||||
|
||||
if (state.isSpeak.value == true && state.isOpenCamera.value == true) {
|
||||
// 有发言权限且开启了摄像头时,切换页面到视频状态
|
||||
changePageState(1);
|
||||
} else {
|
||||
// 没有发言权限或没开启摄像头时,切换页面到语音状态
|
||||
changePageState(0);
|
||||
}
|
||||
} else {
|
||||
// 全员观看主播不是自己
|
||||
// 判断当前会议室是否存在全员观看主播
|
||||
var isCurrentUserIsCamera = false;
|
||||
for(var i = 0; i < state.cacheUsers.value.length; i++){
|
||||
if(state.remoteUid.value == state.cacheUsers.value[i].uid && state.cacheUsers.value[i].enableCamera == true){
|
||||
for (var i = 0; i < state.cacheUsers.value.length; i++) {
|
||||
if (state.remoteUid.value == state.cacheUsers.value[i].uid &&
|
||||
state.cacheUsers.value[i].enableCamera == true) {
|
||||
isCurrentUserIsCamera = true;
|
||||
}
|
||||
}
|
||||
if(isCurrentUserIsCamera == true){
|
||||
|
||||
if (isCurrentUserIsCamera == true) {
|
||||
// 当前会议室存在全员观看主播时,切换页面到视频状态
|
||||
debugPrint("wgs输出===:当前会议室存在全员观看主播时,切换页面到视频状态");
|
||||
changePageState(1);
|
||||
} else {
|
||||
// 当前会议室不存在全员观看主播时,设置主播ID为空并切换页面到视频状态
|
||||
debugPrint("wgs输出===:当前会议室不存在全员观看主播时,设置主播ID为空并切换页面到视频状态");
|
||||
state.remoteUid.value = "";
|
||||
changePageState(1);
|
||||
}else{
|
||||
changePageState(0);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(state.remoteUid.value != UserStore.to.userInfoEntity.value!.screenShareId){
|
||||
state.isSelf.value = false;
|
||||
} else {
|
||||
// 共享屏幕(此版本不做)
|
||||
/*if(state.remoteUid.value == UserStore.to.userInfoEntity.value!.screenShareId){
|
||||
// 如果是自己在共享
|
||||
}else{
|
||||
state.isSelf.value = true;
|
||||
}
|
||||
|
||||
if(state.isSelf.value == false){
|
||||
// 如果是别人在共享,切换页面到视频状态
|
||||
changePageState(1);
|
||||
}
|
||||
}*/
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/// 设置当前全员观看主播
|
||||
Future<void> doHttpSetTvAnchor(String id) async {
|
||||
await getClient().setTvAnchor(
|
||||
state.roomNumber.value,
|
||||
id,
|
||||
UserStore.to.userInfoEntity.value!.userName
|
||||
);
|
||||
await getClient().setTvAnchor(state.roomNumber.value, id,
|
||||
UserStore.to.userInfoEntity.value!.userName);
|
||||
}
|
||||
|
||||
/// 启动共享屏幕
|
||||
/// 启动共享屏幕(此版本不做)
|
||||
/*Future<void> startScreenCapture() async {
|
||||
debugPrint("wgs输出===:RTC-启动屏幕共享");
|
||||
state.isOpenShare.value = true;
|
||||
|
|
@ -290,7 +271,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
doHttpSetTvAnchor(UserStore.to.userInfoEntity.value!.screenShareId);
|
||||
}*/
|
||||
|
||||
/// 停止共享屏幕
|
||||
/// 停止共享屏幕(此版本不做)
|
||||
/*Future<void> stopScreenCapture() async {
|
||||
debugPrint("wgs输出===:RTC-停止屏幕共享");
|
||||
state.isOpenShare.value = false;
|
||||
|
|
@ -308,16 +289,19 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
doHttpSetTvAnchor(UserStore.to.userInfoEntity.value!.uid);
|
||||
}*/
|
||||
|
||||
|
||||
/// ------------------------------------------------------------------------------signalR Socket相关
|
||||
/// Socket长连接
|
||||
Future<void> signalRSocket() async {
|
||||
state.hubConnection.value = HubConnectionBuilder()
|
||||
.withUrl('${RequestConfig().baseUrl}/session-manage', HttpConnectionOptions(
|
||||
transport: HttpTransportType.webSockets,
|
||||
accessTokenFactory: () async => await Future.value(UserStore.to.token),
|
||||
logging: (level, message) => debugPrint("wgs输出===:SignalR Socket-$message"),
|
||||
))
|
||||
.withUrl(
|
||||
'${RequestConfig().baseUrl}/session-manage',
|
||||
HttpConnectionOptions(
|
||||
transport: HttpTransportType.webSockets,
|
||||
accessTokenFactory: () async =>
|
||||
await Future.value(UserStore.to.token),
|
||||
logging: (level, message) =>
|
||||
debugPrint("wgs输出===:SignalR Socket-$message"),
|
||||
))
|
||||
// 配置断线重连策略:默认重连4次,分别间隔10秒 4秒 10秒 10秒
|
||||
.withAutomaticReconnect([10000, 4000, 10000, 10000]).build();
|
||||
|
||||
|
|
@ -327,37 +311,37 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
|
||||
/// ------------------------------------------------------------------------------发言权限相关回调
|
||||
/// 开启关闭发言权限
|
||||
state.hubConnection.value?.on("ManagerRefresh", (e){
|
||||
state.hubConnection.value?.on("ManagerRefresh", (e) {
|
||||
// var jsonStr = const Utf8Decoder().convert(json.encode(e?[0]).runes.toList());
|
||||
var jsonStr = json.encode(e?[0]);
|
||||
var listDynamic = jsonDecode(jsonStr);
|
||||
MeetingRoomUser meetingRoomUser = MeetingRoomUser.fromJson(listDynamic);
|
||||
if(meetingRoomUser.isRoomManager == true){
|
||||
if (meetingRoomUser.isRoomManager == true) {
|
||||
debugPrint("wgs输出===:Socket-开启发言权限:${e?[0]}--${e?[1]}");
|
||||
for(MeetingRoomUser mru in state.cacheUsers.value){
|
||||
if(mru.uid == meetingRoomUser.uid){
|
||||
for (MeetingRoomUser mru in state.cacheUsers.value) {
|
||||
if (mru.uid == meetingRoomUser.uid) {
|
||||
mru.roleId = meetingRoomUser.roleId;
|
||||
mru.enableMicr = true;
|
||||
mru.isRoomManager = meetingRoomUser.isRoomManager;
|
||||
}
|
||||
}
|
||||
if(UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid){
|
||||
if (UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid) {
|
||||
state.isSpeak.value = true;
|
||||
state.isOpenMicrophone.value = true;
|
||||
// 设置声网SDK角色为主播
|
||||
setClientRole("主播");
|
||||
debugPrint("wgs输出===:Socket-开启发言权限:主播");
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
debugPrint("wgs输出===:Socket-关闭发言权限:${e?[0]}--${e?[1]}");
|
||||
for(MeetingRoomUser mru in state.cacheUsers.value){
|
||||
if(mru.uid == meetingRoomUser.uid){
|
||||
for (MeetingRoomUser mru in state.cacheUsers.value) {
|
||||
if (mru.uid == meetingRoomUser.uid) {
|
||||
mru.roleId = meetingRoomUser.roleId;
|
||||
mru.enableMicr = false;
|
||||
mru.isRoomManager = meetingRoomUser.isRoomManager;
|
||||
}
|
||||
}
|
||||
if(UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid){
|
||||
if (UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid) {
|
||||
state.isSpeak.value = false;
|
||||
state.isOpenMicrophone.value = false;
|
||||
state.isOpenCamera.value = false;
|
||||
|
|
@ -375,10 +359,9 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
state.floating.value?.close();
|
||||
// 切换页面状态
|
||||
changePageState(0);
|
||||
// 停止共享屏幕
|
||||
// 停止共享屏幕(此版本不做)
|
||||
// stopScreenCapture();
|
||||
|
||||
|
||||
debugPrint("wgs输出===:Socket-关闭发言权限:观众");
|
||||
}
|
||||
}
|
||||
|
|
@ -386,13 +369,13 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
|
||||
/// ------------------------------------------------------------------------------麦克风相关回调
|
||||
/// 所有用户开闭麦回调
|
||||
state.hubConnection.value?.on("OperAllMicr", (e){
|
||||
if(e?[0] == true){
|
||||
state.hubConnection.value?.on("OperAllMicr", (e) {
|
||||
if (e?[0] == true) {
|
||||
debugPrint("wgs输出===:Socket-全员开麦");
|
||||
}else{
|
||||
} else {
|
||||
debugPrint("wgs输出===:Socket-全员闭麦");
|
||||
}
|
||||
for(var i = 0; i < state.cacheUsers.value.length; i++){
|
||||
for (var i = 0; i < state.cacheUsers.value.length; i++) {
|
||||
state.cacheUsers.value[i].enableMicr = e?[0];
|
||||
}
|
||||
state.users.value = state.cacheUsers.value;
|
||||
|
|
@ -400,32 +383,34 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
});
|
||||
|
||||
/// 用户单独开闭麦回调
|
||||
state.hubConnection.value?.on("OperMicr", (e){
|
||||
state.hubConnection.value?.on("OperMicr", (e) {
|
||||
// var jsonStr = const Utf8Decoder().convert(json.encode(e?[0]).runes.toList());
|
||||
var jsonStr = json.encode(e?[0]);
|
||||
var listDynamic = jsonDecode(jsonStr);
|
||||
MeetingRoomUser meetingRoomUser = MeetingRoomUser.fromJson(listDynamic);
|
||||
if(meetingRoomUser.enableMicr == true){
|
||||
debugPrint("wgs输出===:Socket-用户单独开麦${meetingRoomUser.uid}-${meetingRoomUser.userName}");
|
||||
for(MeetingRoomUser mru in state.cacheUsers.value){
|
||||
if(mru.uid == meetingRoomUser.uid){
|
||||
if (meetingRoomUser.enableMicr == true) {
|
||||
debugPrint(
|
||||
"wgs输出===:Socket-用户单独开麦${meetingRoomUser.uid}-${meetingRoomUser.userName}");
|
||||
for (MeetingRoomUser mru in state.cacheUsers.value) {
|
||||
if (mru.uid == meetingRoomUser.uid) {
|
||||
mru.enableMicr = true;
|
||||
}
|
||||
}
|
||||
if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) {
|
||||
if (meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) {
|
||||
state.isOpenMicrophone.value = true;
|
||||
|
||||
// 恢复发布音频流
|
||||
muteLocalAudioStream(false);
|
||||
}
|
||||
}else{
|
||||
debugPrint("wgs输出===:Socket-用户单独闭麦${meetingRoomUser.uid}-${meetingRoomUser.userName}");
|
||||
for(MeetingRoomUser mru in state.cacheUsers.value){
|
||||
if(mru.uid == meetingRoomUser.uid){
|
||||
} else {
|
||||
debugPrint(
|
||||
"wgs输出===:Socket-用户单独闭麦${meetingRoomUser.uid}-${meetingRoomUser.userName}");
|
||||
for (MeetingRoomUser mru in state.cacheUsers.value) {
|
||||
if (mru.uid == meetingRoomUser.uid) {
|
||||
mru.enableMicr = false;
|
||||
}
|
||||
}
|
||||
if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) {
|
||||
if (meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) {
|
||||
state.isOpenMicrophone.value = false;
|
||||
|
||||
// 取消发布音频流
|
||||
|
|
@ -436,26 +421,27 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
|
||||
/// ------------------------------------------------------------------------------会议室进出相关回调
|
||||
/// 远端用户或主播加入会议室回调
|
||||
state.hubConnection.value?.on("UserJoined", (e){
|
||||
state.hubConnection.value?.on("UserJoined", (e) {
|
||||
// var jsonStr = const Utf8Decoder().convert(json.encode(user).runes.toList());
|
||||
var jsonStr = json.encode(e);
|
||||
var listDynamic = jsonDecode(jsonStr);
|
||||
List<MeetingRoomUser> meetingRoomUsers = (listDynamic as List<dynamic>).map((e) => MeetingRoomUser.fromJson((e as Map<String,dynamic>))).toList();
|
||||
List<MeetingRoomUser> meetingRoomUsers = (listDynamic as List<dynamic>)
|
||||
.map((e) => MeetingRoomUser.fromJson((e as Map<String, dynamic>)))
|
||||
.toList();
|
||||
state.cacheUsers.value.addAll(meetingRoomUsers);
|
||||
state.users.value = state.cacheUsers.value;
|
||||
debugPrint("wgs输出===:Socket-远端用户或主播加入会议室:$jsonStr");
|
||||
});
|
||||
|
||||
/// 远端用户或主播离开会议室回调
|
||||
state.hubConnection.value?.on("UserLeave", (e){
|
||||
state.hubConnection.value?.on("UserLeave", (e) {
|
||||
// var jsonStr = const Utf8Decoder().convert(json.encode(uid).runes.toList());
|
||||
var jsonStr = json.encode(e);
|
||||
List listDynamic = jsonDecode(jsonStr);
|
||||
for(String uidStr in listDynamic){
|
||||
for(var j = 0; j < state.cacheUsers.value.length; j++){
|
||||
if(state.cacheUsers.value[j].uid == uidStr){
|
||||
for (String uidStr in listDynamic) {
|
||||
for (var j = 0; j < state.cacheUsers.value.length; j++) {
|
||||
if (state.cacheUsers.value[j].uid == uidStr) {
|
||||
state.cacheUsers.value.removeAt(j);
|
||||
doHttpGetTvAnchor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -464,7 +450,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
});
|
||||
|
||||
/// 被移除会议回调
|
||||
state.hubConnection.value?.on("ForceExitRoom", (e){
|
||||
state.hubConnection.value?.on("ForceExitRoom", (e) {
|
||||
// var jsonStr = const Utf8Decoder().convert(json.encode(e).runes.toList());
|
||||
var jsonStr = json.encode(e);
|
||||
debugPrint("wgs输出===:Socket-被移除会议:$jsonStr");
|
||||
|
|
@ -473,7 +459,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
});
|
||||
|
||||
/// 全员结束会议回调
|
||||
state.hubConnection.value?.on("AllLeave", (e){
|
||||
state.hubConnection.value?.on("AllLeave", (e) {
|
||||
debugPrint("wgs输出===:Socket-全员结束会议");
|
||||
Get.back();
|
||||
ToastUtils.showSuccess("会议已结束");
|
||||
|
|
@ -481,87 +467,88 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
|
||||
/// ------------------------------------------------------------------------------会议室聊天相关回调
|
||||
/// 会议室接收消息回调
|
||||
state.hubConnection.value?.on("ReceiveMessage", (e){
|
||||
state.hubConnection.value?.on("ReceiveMessage", (e) {
|
||||
// var jsonStr = const Utf8Decoder().convert(json.encode(e).runes.toList());
|
||||
var jsonStr = json.encode(e);
|
||||
List list = json.decode(jsonStr);
|
||||
MeetingRoomMsg meetingRoomMsg = MeetingRoomMsg(list[0],list[1],list[2],0);
|
||||
MeetingRoomMsg meetingRoomMsg =
|
||||
MeetingRoomMsg(list[0], list[1], list[2], 0);
|
||||
state.meetingRoomMsgs.value.add(meetingRoomMsg);
|
||||
update();
|
||||
Future.delayed(const Duration(milliseconds: 100), () {
|
||||
state.chatController.jumpTo(state.chatController.position.maxScrollExtent);
|
||||
state.chatController
|
||||
.jumpTo(state.chatController.position.maxScrollExtent);
|
||||
});
|
||||
debugPrint("wgs输出===:Socket-会议室接收消息:$jsonStr");
|
||||
});
|
||||
|
||||
/// ------------------------------------------------------------------------------摄像头或者屏幕相关回调
|
||||
/// 用户单独开闭摄像头回调
|
||||
state.hubConnection.value?.on("OperCamera", (e){
|
||||
state.hubConnection.value?.on("OperCamera", (e) {
|
||||
// var jsonStr = const Utf8Decoder().convert(json.encode(e?[0]).runes.toList());
|
||||
var jsonStr = json.encode(e?[0]);
|
||||
var listDynamic = jsonDecode(jsonStr);
|
||||
MeetingRoomUser meetingRoomUser = MeetingRoomUser.fromJson(listDynamic);
|
||||
if(meetingRoomUser.enableCamera == true){
|
||||
if (meetingRoomUser.enableCamera == true) {
|
||||
debugPrint("wgs输出===:Socket-用户单独开摄像头");
|
||||
for(MeetingRoomUser mru in state.cacheUsers.value){
|
||||
if(mru.uid == meetingRoomUser.uid){
|
||||
|
||||
// 遍历会议室用户列表,更改摄像头状态
|
||||
for (MeetingRoomUser mru in state.cacheUsers.value) {
|
||||
if (mru.uid == meetingRoomUser.uid) {
|
||||
mru.enableCamera = true;
|
||||
}
|
||||
}
|
||||
if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid){
|
||||
|
||||
if (meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) {
|
||||
// 开启摄像头的用户是自己时
|
||||
// 更改自己摄像头状态为开启
|
||||
state.isOpenCamera.value = true;
|
||||
// 恢复发布视频流
|
||||
muteLocalVideoStream(false);
|
||||
// 开始本地预览
|
||||
startPreview();
|
||||
// 只有在视频大屏,并且全员观看不是自己的时候
|
||||
if(state.pageIndex.value == 0 && state.isSelf.value == false){
|
||||
// 打开本地预览悬浮窗
|
||||
// 切换页面到视频状态
|
||||
changePageState(1);
|
||||
// 只有在视频大屏并且全员观看主播不是自己的时候,才打开右上角悬浮窗
|
||||
if (state.pageIndex.value == 0 && state.remoteUid.value != "0") {
|
||||
state.floating.value?.open(state.context.value!);
|
||||
}
|
||||
changePageState(1);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
debugPrint("wgs输出===:Socket-用户单独闭摄像头");
|
||||
for(MeetingRoomUser mru in state.cacheUsers.value){
|
||||
if(mru.uid == meetingRoomUser.uid){
|
||||
|
||||
// 遍历会议室用户列表,更改摄像头状态
|
||||
for (MeetingRoomUser mru in state.cacheUsers.value) {
|
||||
if (mru.uid == meetingRoomUser.uid) {
|
||||
mru.enableCamera = false;
|
||||
}
|
||||
}
|
||||
if(meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid){
|
||||
|
||||
if (meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) {
|
||||
// 关闭摄像头的用户是自己时
|
||||
// 更改自己摄像头状态为关闭
|
||||
state.isOpenCamera.value = false;
|
||||
|
||||
// 当前全员观看是自己时
|
||||
if(state.isSelf.value == true){
|
||||
changePageState(0);
|
||||
state.isSelf.value = false;
|
||||
}
|
||||
|
||||
// 取消发布视频流
|
||||
muteLocalVideoStream(true);
|
||||
// 停止本地预览
|
||||
stopPreview();
|
||||
// 当前全员观看主播是自己时
|
||||
if (state.remoteUid.value == "0") {
|
||||
changePageState(0);
|
||||
}
|
||||
// 关闭本地预览悬浮窗
|
||||
state.floating.value?.close();
|
||||
}else{
|
||||
if(meetingRoomUser.uid == state.remoteUid.value || meetingRoomUser.screenShareId == state.remoteUid.value){
|
||||
if(state.isOpenCamera.value == true){
|
||||
state.remoteUid.value = "";
|
||||
changePageState(0);
|
||||
}
|
||||
if (state.floating.value?.isShowing == true) {
|
||||
state.floating.value?.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/// 设置新的全员观看视频主播回调
|
||||
state.hubConnection.value?.on("ShowUser", (e){
|
||||
state.hubConnection.value?.on("ShowUser", (e) {
|
||||
// var jsonStr = const Utf8Decoder().convert(json.encode(e).runes.toList());
|
||||
var jsonStr = json.encode(e);
|
||||
List list = json.decode(jsonStr);
|
||||
/*if(list[0].toString().length != 9){
|
||||
state.remoteUid.value = list[0].toString();
|
||||
}*/
|
||||
doHttpGetTvAnchor();
|
||||
debugPrint("wgs输出===:Socket-设置新的全员观看视频主播:${list[0]}");
|
||||
});
|
||||
|
|
@ -569,13 +556,15 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
|
||||
/// 加入会议室
|
||||
Future<void> joinMeetingToSocket() async {
|
||||
await state.hubConnection.value?.invoke("joinChannel", args: [state.roomNumber.value, false, false, false]);
|
||||
await state.hubConnection.value?.invoke("joinChannel",
|
||||
args: [state.roomNumber.value, false, false, false]);
|
||||
mergeFetch();
|
||||
}
|
||||
|
||||
/// 离开会议室
|
||||
Future<void> leaveMeetingToSocket() async {
|
||||
await state.hubConnection.value?.invoke("levelChannel", args: [state.roomNumber.value]);
|
||||
await state.hubConnection.value
|
||||
?.invoke("levelChannel", args: [state.roomNumber.value]);
|
||||
state.hubConnection.value?.stop();
|
||||
}
|
||||
|
||||
|
|
@ -584,13 +573,16 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
MeetingRoomMsg meetingRoomMsg = MeetingRoomMsg(
|
||||
UserStore.to.userInfoEntity.value!.uid,
|
||||
UserStore.to.userInfoEntity.value!.userName,
|
||||
msg,1);
|
||||
msg,
|
||||
1);
|
||||
state.meetingRoomMsgs.value.add(meetingRoomMsg);
|
||||
update();
|
||||
Future.delayed(const Duration(milliseconds: 100), () {
|
||||
state.chatController.jumpTo(state.chatController.position.maxScrollExtent);
|
||||
state.chatController
|
||||
.jumpTo(state.chatController.position.maxScrollExtent);
|
||||
});
|
||||
await state.hubConnection.value?.invoke("sendChannelMsg", args: [state.roomNumber.value, msg]);
|
||||
await state.hubConnection.value
|
||||
?.invoke("sendChannelMsg", args: [state.roomNumber.value, msg]);
|
||||
}
|
||||
|
||||
/// ------------------------------------------------------------------------------声网SDK相关
|
||||
|
|
@ -615,119 +607,134 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
// 设置默认音频路由为听筒
|
||||
await state.rctEngine.value?.setDefaultAudioRouteToSpeakerphone(false);
|
||||
// 打开用户音量回调
|
||||
await state.rctEngine.value?.enableAudioVolumeIndication(interval: 200, smooth: 3, reportVad: true);
|
||||
await state.rctEngine.value?.enableAudioVolumeIndication(
|
||||
interval: 200, smooth: 3, reportVad: true);
|
||||
|
||||
joinMeetingToRtc();
|
||||
|
||||
// 回调
|
||||
state.rctEngine.value?.registerEventHandler(
|
||||
RtcEngineEventHandler(
|
||||
// 成功加入会议室回调
|
||||
onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
|
||||
debugPrint("wgs输出===:RTC-自己加入会议室,ID:${connection.localUid}");
|
||||
},
|
||||
|
||||
// 成功加入会议室回调
|
||||
onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
|
||||
debugPrint("wgs输出===:RTC-自己加入会议室,ID:${connection.localUid}");
|
||||
},
|
||||
// 成功离开会议室回调
|
||||
onLeaveChannel: (RtcConnection connection, RtcStats stats) {
|
||||
debugPrint("wgs输出===:RTC-自己离开会议室,ID:${connection.localUid}");
|
||||
},
|
||||
|
||||
// 成功离开会议室回调
|
||||
onLeaveChannel: (RtcConnection connection, RtcStats stats){
|
||||
debugPrint("wgs输出===:RTC-自己离开会议室,ID:${connection.localUid}");
|
||||
},
|
||||
// 远端用户或主播加入当前会议室回调-主播角色才能接收该回调
|
||||
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
|
||||
debugPrint("wgs输出===:RTC-远端用户或主播加入会议室,用户或主机的ID:$remoteUid");
|
||||
},
|
||||
|
||||
// 远端用户或主播加入当前会议室回调-主播角色才能接收该回调
|
||||
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
|
||||
debugPrint("wgs输出===:RTC-远端用户或主播加入会议室,用户或主机的ID:$remoteUid");
|
||||
},
|
||||
// 远端用户或主播离开当前会议室回调-主播角色才能接收该回调
|
||||
onUserOffline: (RtcConnection connection, int remoteUid,
|
||||
UserOfflineReasonType reason) async {
|
||||
debugPrint("wgs输出===:RTC-远端用户或主播离开会议室,用户或主机的ID:$remoteUid");
|
||||
},
|
||||
|
||||
// 远端用户或主播离开当前会议室回调-主播角色才能接收该回调
|
||||
onUserOffline: (RtcConnection connection, int remoteUid, UserOfflineReasonType reason) async {
|
||||
debugPrint("wgs输出===:RTC-远端用户或主播离开会议室,用户或主机的ID:$remoteUid");
|
||||
},
|
||||
// 音频路由发生变化回调
|
||||
onAudioRoutingChanged: (int routing) {
|
||||
debugPrint("wgs输出===:RTC-音频路由切换:$routing");
|
||||
state.communicationMode.value = routing;
|
||||
if (routing == 1) {
|
||||
debugPrint("wgs输出===:RTC-音频路由切换为听筒");
|
||||
} else if (routing == 3) {
|
||||
debugPrint("wgs输出===:RTC-音频路由切换为扬声器");
|
||||
} else {
|
||||
debugPrint("wgs输出===:RTC-音频路由切换为外接设备");
|
||||
}
|
||||
},
|
||||
|
||||
// 音频路由发生变化回调
|
||||
onAudioRoutingChanged: (int routing){
|
||||
debugPrint("wgs输出===:RTC-音频路由切换:$routing");
|
||||
state.communicationMode.value = routing;
|
||||
if(routing == 1){
|
||||
debugPrint("wgs输出===:RTC-音频路由切换为听筒");
|
||||
}else if(routing == 3){
|
||||
debugPrint("wgs输出===:RTC-音频路由切换为扬声器");
|
||||
}else{
|
||||
debugPrint("wgs输出===:RTC-音频路由切换为外接设备");
|
||||
// 音频采集开关回调
|
||||
onLocalAudioStateChanged: (RtcConnection connection,
|
||||
LocalAudioStreamState state, LocalAudioStreamReason reason) {
|
||||
debugPrint("wgs输出===:RTC-音频采集开关:$state");
|
||||
},
|
||||
|
||||
// 远端视频状态发生改变回调
|
||||
onRemoteVideoStateChanged: (RtcConnection connection,
|
||||
int remoteUid,
|
||||
RemoteVideoState remoteVideoState,
|
||||
RemoteVideoStateReason remoteVideoStateReason,
|
||||
int elapsed) {
|
||||
debugPrint(
|
||||
"wgs输出===:RTC-远端视频状态发生改变:ID-$remoteUid-状态-$remoteVideoStateReason");
|
||||
if (remoteVideoStateReason ==
|
||||
RemoteVideoStateReason.remoteVideoStateReasonRemoteMuted) {
|
||||
// 远端用户停止发送视频流或远端用户禁用视频模块
|
||||
if (remoteUid.toString().length != 9) {
|
||||
// 摄像头
|
||||
if (remoteUid.toString() == state.remoteUid.value) {
|
||||
// 如果停止发送视频流或禁用视频模块的远端用户是当前全员观看主播
|
||||
doHttpGetTvAnchor();
|
||||
}
|
||||
} else {
|
||||
// 共享屏幕(此版本不做)
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
// 音频采集开关回调
|
||||
onLocalAudioStateChanged: (RtcConnection connection, LocalAudioStreamState state, LocalAudioStreamReason reason){
|
||||
debugPrint("wgs输出===:RTC-音频采集开关:$state");
|
||||
},
|
||||
|
||||
// 远端视频状态发生改变回调
|
||||
onRemoteVideoStateChanged: (RtcConnection connection,
|
||||
int remoteUid,
|
||||
RemoteVideoState state,
|
||||
RemoteVideoStateReason reason,
|
||||
int elapsed){
|
||||
debugPrint("wgs输出===:RTC-远端视频状态发生改变:$state");
|
||||
},
|
||||
|
||||
// 用户音量提示回调
|
||||
onAudioVolumeIndication: (
|
||||
RtcConnection connection,
|
||||
List<AudioVolumeInfo> speakers,
|
||||
int speakerNumber,
|
||||
int totalVolume){
|
||||
if(speakers.isNotEmpty){
|
||||
for(AudioVolumeInfo avi in speakers){
|
||||
for(MeetingRoomUser mru in state.cacheUsers.value){
|
||||
// 用于更改语音布局里的用户列表麦克风
|
||||
if(avi.uid == 0){
|
||||
//debugPrint("wgs输出===:RTC-用户音量提示(自己):${CountMicrophoneVolume.getVolume(avi.volume!)}");
|
||||
// 用户音量提示回调
|
||||
onAudioVolumeIndication: (RtcConnection connection,
|
||||
List<AudioVolumeInfo> speakers,
|
||||
int speakerNumber,
|
||||
int totalVolume) {
|
||||
if (speakers.isNotEmpty) {
|
||||
for (AudioVolumeInfo avi in speakers) {
|
||||
for (MeetingRoomUser mru in state.cacheUsers.value) {
|
||||
// 用于更改语音布局里的用户列表麦克风
|
||||
if (avi.uid == 0) {
|
||||
//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}");
|
||||
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}");
|
||||
mru.volume = CountMicrophoneVolume.getVolume(avi.volume!);
|
||||
|
||||
if(avi.volume != 0){
|
||||
state.spokesman.value = mru.userName;
|
||||
state.spokesmanVolume.value = CountMicrophoneVolume.getVolume(avi.volume!);
|
||||
}else{
|
||||
state.spokesman.value = "";
|
||||
state.spokesmanVolume.value = 0;
|
||||
}
|
||||
if (avi.volume != 0) {
|
||||
state.spokesman.value = mru.userName;
|
||||
state.spokesmanVolume.value =
|
||||
CountMicrophoneVolume.getVolume(avi.volume!);
|
||||
} else {
|
||||
state.spokesman.value = "";
|
||||
state.spokesmanVolume.value = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
// 切换用户角色回调
|
||||
onClientRoleChanged: (
|
||||
RtcConnection connection,
|
||||
ClientRoleType oldRole,
|
||||
ClientRoleType newRole,
|
||||
ClientRoleOptions newRoleOptions){
|
||||
debugPrint("wgs输出===:RTC-切换用户角色为:${newRole == ClientRoleType.clientRoleBroadcaster ? "主播" : "观众"}");
|
||||
},
|
||||
// 切换用户角色回调
|
||||
onClientRoleChanged: (RtcConnection connection, ClientRoleType oldRole,
|
||||
ClientRoleType newRole, ClientRoleOptions newRoleOptions) {
|
||||
debugPrint(
|
||||
"wgs输出===:RTC-切换用户角色为:${newRole == ClientRoleType.clientRoleBroadcaster ? "主播" : "观众"}");
|
||||
},
|
||||
|
||||
// token即将在30秒内过期回调
|
||||
onTokenPrivilegeWillExpire: (RtcConnection connection, String token){
|
||||
doHttpGetMeetingToken(false);
|
||||
},
|
||||
// token即将在30秒内过期回调
|
||||
onTokenPrivilegeWillExpire: (RtcConnection connection, String token) {
|
||||
doHttpGetMeetingToken(false);
|
||||
},
|
||||
|
||||
// 本地视频状态发生改变回调
|
||||
onLocalVideoStateChanged: (VideoSourceType source, LocalVideoStreamState state, LocalVideoStreamReason reason){
|
||||
debugPrint("wgs输出===:RTC-本地视频状态发生改变:$source--$state--$reason");
|
||||
},
|
||||
// 本地视频状态发生改变回调
|
||||
onLocalVideoStateChanged: (VideoSourceType source,
|
||||
LocalVideoStreamState state, LocalVideoStreamReason reason) {
|
||||
debugPrint("wgs输出===:RTC-本地视频状态发生改变:$source--$state--$reason");
|
||||
},
|
||||
|
||||
// 获取设备权限出错回调
|
||||
/*onPermissionError: (PermissionType permissionType){
|
||||
// 获取设备权限出错回调
|
||||
/*onPermissionError: (PermissionType permissionType){
|
||||
debugPrint("wgs输出===:RTC-获取设备权限出错:$permissionType");
|
||||
if(permissionType == PermissionType.screenCapture){
|
||||
// 获取共享屏幕出错
|
||||
// 获取共享屏幕出错(此版本不做)
|
||||
state.isOpenShare.value = false;
|
||||
stopScreenCapture();
|
||||
}
|
||||
|
|
@ -743,19 +750,19 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
channelId: state.roomNumber.value,
|
||||
uid: int.parse(UserStore.to.userInfoEntity.value!.uid),
|
||||
options: const ChannelMediaOptions(
|
||||
// 自动订阅所有视频流
|
||||
autoSubscribeVideo: true,
|
||||
// 自动订阅所有音频流
|
||||
autoSubscribeAudio: true,
|
||||
// 发布摄像头采集的视频
|
||||
publishCameraTrack: true,
|
||||
// 发布麦克风采集的音频
|
||||
publishMicrophoneTrack: true,
|
||||
// 设置用户角色为 clientRoleBroadcaster(主播)或 clientRoleAudience(观众)
|
||||
// 这里设置角色为clientRoleBroadcaster(主播)
|
||||
// 主播:可以在频道内发布音视频,同时也可以订阅其他主播发布的音视频
|
||||
// 观众:可以在频道内订阅音视频,不具备发布音视频权限
|
||||
clientRoleType: ClientRoleType.clientRoleAudience),
|
||||
// 自动订阅所有视频流
|
||||
autoSubscribeVideo: true,
|
||||
// 自动订阅所有音频流
|
||||
autoSubscribeAudio: true,
|
||||
// 发布摄像头采集的视频
|
||||
publishCameraTrack: true,
|
||||
// 发布麦克风采集的音频
|
||||
publishMicrophoneTrack: true,
|
||||
// 设置用户角色为 clientRoleBroadcaster(主播)或 clientRoleAudience(观众)
|
||||
// 这里设置角色为clientRoleBroadcaster(主播)
|
||||
// 主播:可以在频道内发布音视频,同时也可以订阅其他主播发布的音视频
|
||||
// 观众:可以在频道内订阅音视频,不具备发布音视频权限
|
||||
clientRoleType: ClientRoleType.clientRoleAudience),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -769,17 +776,20 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
|
||||
/// 设置用户角色
|
||||
Future<void> setClientRole(String roleStr) async {
|
||||
if(roleStr == "主播"){
|
||||
await state.rctEngine.value?.setClientRole(role: ClientRoleType.clientRoleBroadcaster);
|
||||
}else{
|
||||
await state.rctEngine.value?.setClientRole(role: ClientRoleType.clientRoleAudience);
|
||||
if (roleStr == "主播") {
|
||||
await state.rctEngine.value
|
||||
?.setClientRole(role: ClientRoleType.clientRoleBroadcaster);
|
||||
} else {
|
||||
await state.rctEngine.value
|
||||
?.setClientRole(role: ClientRoleType.clientRoleAudience);
|
||||
}
|
||||
}
|
||||
|
||||
/// 设置音频输出路由(没有外接设备时生效)
|
||||
Future<void> setEnableSpeakerphone(int mode) async {
|
||||
state.communicationMode.value = mode;
|
||||
await state.rctEngine.value?.setEnableSpeakerphone(mode == 1 ? false : true);
|
||||
await state.rctEngine.value
|
||||
?.setEnableSpeakerphone(mode == 1 ? false : true);
|
||||
}
|
||||
|
||||
/// 设置启用视频模块
|
||||
|
|
@ -789,7 +799,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
|
|||
|
||||
/// 取消或恢复发布本地音频流
|
||||
Future<void> muteLocalAudioStream(bool mute) async {
|
||||
await state.rctEngine.value?.muteLocalAudioStream(mute);
|
||||
await state.rctEngine.value?.muteLocalAudioStream(mute);
|
||||
}
|
||||
|
||||
/// 取消或恢复发布本地视频流
|
||||
|
|
|
|||
|
|
@ -10,11 +10,8 @@ import 'package:get/get.dart';
|
|||
import 'package:liquid_progress_indicator_v2/liquid_progress_indicator.dart';
|
||||
import 'package:preload_page_view/preload_page_view.dart';
|
||||
import 'package:wgshare/common/store/user_store.dart';
|
||||
import 'package:wgshare/pages/metting/share/meeting_main_share_view.dart';
|
||||
import 'package:wgshare/pages/metting/video/meeting_main_video_view.dart';
|
||||
import 'package:wgshare/utils/toast_utils.dart';
|
||||
|
||||
import '../../common/models/meeting_room_user.dart';
|
||||
import '../../utils/color_util.dart';
|
||||
import '../../utils/cus_behavior.dart';
|
||||
import '../../view/view_svg_path.dart';
|
||||
|
|
@ -87,8 +84,7 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
width: 20.w,
|
||||
height: 20.h,
|
||||
),
|
||||
onTap: () {
|
||||
},
|
||||
onTap: () {},
|
||||
),
|
||||
SizedBox(width: 16.w),
|
||||
GestureDetector(
|
||||
|
|
@ -178,7 +174,7 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
height: 22.h,
|
||||
),
|
||||
onTap: () {
|
||||
logic.doHttpCancelSpeak();
|
||||
logic.cancelSpeak();
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
@ -215,109 +211,81 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
child: MeetingMainVoiceComponent(
|
||||
users: state.cacheUsers.value)),
|
||||
|
||||
// 视频-别人是主播时
|
||||
// 视频-共享
|
||||
Visibility(
|
||||
visible: state.pageState.value == 1 && state.isSelf.value == false,
|
||||
visible: state.pageState.value == 1,
|
||||
child: null != state.rctEngine.value
|
||||
? Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
PreloadPageView.builder(
|
||||
preloadPagesCount: 2,
|
||||
itemCount: 2,
|
||||
itemBuilder: (BuildContext context, int position) => returnPageToOther(position),
|
||||
controller: PreloadPageController(initialPage: 0),
|
||||
onPageChanged: (int position) {
|
||||
state.pageIndex.value = position;
|
||||
if(state.isSpeak.value == true && state.isOpenCamera.value == true && state.isSelf.value == false){
|
||||
if(position == 0){
|
||||
state.floating.value?.open(context);
|
||||
}else{
|
||||
state.floating.value?.close();
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
/// pageview 指示器
|
||||
Positioned(
|
||||
bottom: 16,
|
||||
child: Row(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 8.w,
|
||||
height: 8.h,
|
||||
margin: const EdgeInsets.only(right: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: state.pageIndex.value == 0
|
||||
? ColorUtil.Color_255_255_255
|
||||
: ColorUtil.Color_108_108_108),
|
||||
PreloadPageView.builder(
|
||||
preloadPagesCount: 2,
|
||||
itemCount: 2,
|
||||
itemBuilder: (BuildContext context,
|
||||
int position) =>
|
||||
returnPage(position),
|
||||
controller: PreloadPageController(
|
||||
initialPage: 0),
|
||||
onPageChanged: (int position) {
|
||||
state.pageIndex.value = position;
|
||||
if (state.isSpeak.value == true &&
|
||||
state.isOpenCamera.value ==
|
||||
true &&
|
||||
state.remoteUid.value != "0") {
|
||||
if (position == 0) {
|
||||
state.floating.value
|
||||
?.open(context);
|
||||
} else {
|
||||
state.floating.value?.close();
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
Container(
|
||||
width: 8.w,
|
||||
height: 8.h,
|
||||
margin: const EdgeInsets.only(left: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: state.pageIndex.value == 1
|
||||
? ColorUtil.Color_255_255_255
|
||||
: ColorUtil.Color_108_108_108),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container()),
|
||||
|
||||
// 视频-自己时主播时
|
||||
Visibility(
|
||||
visible: state.pageState.value == 1 && state.isSelf.value == true,
|
||||
child: null != state.rctEngine.value
|
||||
? Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
PreloadPageView.builder(
|
||||
preloadPagesCount: 2,
|
||||
itemCount: 2,
|
||||
itemBuilder: (BuildContext context, int position) => returnPageSelf(position),
|
||||
controller: PreloadPageController(initialPage: 0),
|
||||
onPageChanged: (int position) {
|
||||
state.pageIndex.value = position;
|
||||
},
|
||||
),
|
||||
|
||||
/// pageview 指示器
|
||||
Positioned(
|
||||
bottom: 16,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 8.w,
|
||||
height: 8.h,
|
||||
margin: const EdgeInsets.only(right: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: state.pageIndex.value == 0
|
||||
? ColorUtil.Color_255_255_255
|
||||
: ColorUtil.Color_108_108_108),
|
||||
/// pageview 指示器
|
||||
Positioned(
|
||||
bottom: 16,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 8.w,
|
||||
height: 8.h,
|
||||
margin: const EdgeInsets.only(
|
||||
right: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8),
|
||||
color: state.pageIndex
|
||||
.value ==
|
||||
0
|
||||
? ColorUtil
|
||||
.Color_255_255_255
|
||||
: ColorUtil
|
||||
.Color_108_108_108),
|
||||
),
|
||||
Container(
|
||||
width: 8.w,
|
||||
height: 8.h,
|
||||
margin: const EdgeInsets.only(
|
||||
left: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8),
|
||||
color: state.pageIndex
|
||||
.value ==
|
||||
1
|
||||
? ColorUtil
|
||||
.Color_255_255_255
|
||||
: ColorUtil
|
||||
.Color_108_108_108),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 8.w,
|
||||
height: 8.h,
|
||||
margin: const EdgeInsets.only(left: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: state.pageIndex.value == 1
|
||||
? ColorUtil.Color_255_255_255
|
||||
: ColorUtil.Color_108_108_108),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
)
|
||||
: Container()),
|
||||
|
||||
GestureDetector(
|
||||
|
|
@ -482,7 +450,7 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
},
|
||||
),
|
||||
|
||||
/// 共享
|
||||
/// 共享(此版本不做)
|
||||
/*GestureDetector(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
|
@ -799,7 +767,7 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
padding: const EdgeInsets.only(top: 16, bottom: 16),
|
||||
margin: const EdgeInsets.only(left: 40, right: 40),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(6)),
|
||||
border: Border.all(color: ColorUtil.Color_0_0_0_0),
|
||||
color: ColorUtil.Color_35_35_35,
|
||||
),
|
||||
|
|
@ -1459,7 +1427,9 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
? AgoraVideoView(
|
||||
controller: VideoViewController(
|
||||
rtcEngine: state.rctEngine.value!,
|
||||
canvas: const VideoCanvas(uid: 0, setupMode: VideoViewSetupMode.videoViewSetupAdd),
|
||||
canvas: const VideoCanvas(
|
||||
uid: 0,
|
||||
setupMode: VideoViewSetupMode.videoViewSetupAdd),
|
||||
),
|
||||
)
|
||||
: const CircularProgressIndicator(),
|
||||
|
|
@ -1482,20 +1452,10 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
color: ColorUtil.Color_0_0_0_96),
|
||||
child: Row(
|
||||
children: [
|
||||
/*Image.asset(
|
||||
'assets/images/meeting_main_microphone_open.png',
|
||||
width: 13.w,
|
||||
height: 14.h,
|
||||
),
|
||||
SizedBox(width: 4.w),*/
|
||||
Text(
|
||||
UserStore.to.userInfoEntity.value!.userName,
|
||||
style: TextStyle(
|
||||
fontSize: 10.sp, color: ColorUtil.Color_185_184_184),
|
||||
)
|
||||
],
|
||||
child: Text(
|
||||
UserStore.to.userInfoEntity.value!.userName,
|
||||
style: TextStyle(
|
||||
fontSize: 10.sp, color: ColorUtil.Color_185_184_184),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
|
@ -1505,240 +1465,43 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
);
|
||||
}
|
||||
|
||||
/// 对应页数的界面-全员观看是别人时
|
||||
Widget returnPageToOther(int position){
|
||||
debugPrint("wgs输出===:全员观看是别人时布局");
|
||||
/// pageview对应页数的界面
|
||||
Widget returnPage(int position) {
|
||||
var pageList = [];
|
||||
|
||||
/// 大屏
|
||||
pageList.add(Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
state.remoteUid.value != ""
|
||||
? AgoraVideoView(
|
||||
controller: VideoViewController(
|
||||
rtcEngine: state.rctEngine.value!,
|
||||
canvas: VideoCanvas(uid: int.tryParse(state.remoteUid.value), setupMode: VideoViewSetupMode.videoViewSetupAdd)
|
||||
),
|
||||
)
|
||||
: const CircularProgressIndicator(),
|
||||
/*Positioned(
|
||||
bottom: 110,
|
||||
child: GestureDetector(
|
||||
child: Image.asset(
|
||||
'assets/images/meeting_main_hang_up.png',
|
||||
width: 50.w,
|
||||
height: 50.h,
|
||||
),
|
||||
onTap: () {
|
||||
},
|
||||
),
|
||||
),*/
|
||||
Positioned(
|
||||
top: 16,
|
||||
right: 16,
|
||||
child: Container(
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: ColorUtil.Color_0_0_0_96),
|
||||
padding: const EdgeInsets.only(left: 12, right: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'正在讲话:',
|
||||
style: TextStyle(
|
||||
fontSize: 10.sp,
|
||||
color: ColorUtil.Color_185_184_184),
|
||||
controller: VideoViewController(
|
||||
rtcEngine: state.rctEngine.value!,
|
||||
canvas: VideoCanvas(
|
||||
uid: int.tryParse(state.remoteUid.value),
|
||||
setupMode: VideoViewSetupMode.videoViewSetupAdd),
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
height: 20.h,
|
||||
child: LiquidCustomProgressIndicator(
|
||||
value:
|
||||
state.spokesmanVolume.value,
|
||||
valueColor:
|
||||
const AlwaysStoppedAnimation(
|
||||
ColorUtil
|
||||
.Color_2_177_136),
|
||||
backgroundColor:
|
||||
ColorUtil.Color_255_255_255,
|
||||
direction: Axis.vertical,
|
||||
shapePath: ViewSvgPath
|
||||
.getMicrpphonePath()),
|
||||
),
|
||||
Text(
|
||||
state.spokesman.value,
|
||||
style: TextStyle(
|
||||
fontSize: 10.sp,
|
||||
color: ColorUtil.Color_185_184_184),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
));
|
||||
/// gridview
|
||||
pageList.add(Container(
|
||||
color: ColorUtil.Color_57_57_57,
|
||||
child: GridView.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
childAspectRatio: 0.8,
|
||||
crossAxisSpacing: 0),
|
||||
itemCount: state.cacheUsers.value.length,
|
||||
itemBuilder: (BuildContext ctx, index) {
|
||||
return Stack(
|
||||
children: [
|
||||
state.cacheUsers.value[index].enableCamera == true ? state.cacheUsers.value[index].uid ==
|
||||
UserStore.to.userInfoEntity.value!.uid
|
||||
? AgoraVideoView(
|
||||
controller: VideoViewController(
|
||||
rtcEngine: state.rctEngine.value!,
|
||||
canvas: const VideoCanvas(uid: 0, setupMode: VideoViewSetupMode.videoViewSetupAdd)
|
||||
),
|
||||
)
|
||||
: AgoraVideoView(
|
||||
controller: VideoViewController.remote(
|
||||
rtcEngine: state.rctEngine.value!,
|
||||
canvas: VideoCanvas(
|
||||
uid: int.tryParse(
|
||||
state.cacheUsers.value[index].uid), setupMode: VideoViewSetupMode.videoViewSetupAdd),
|
||||
connection: RtcConnection(
|
||||
channelId: state.roomNumber.value),
|
||||
),
|
||||
)
|
||||
:
|
||||
Container(
|
||||
color: ColorUtil.Color_16_19_13,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/metting_main_no_person.png',
|
||||
width: 78.w,
|
||||
height: 84.h,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'该用户未开启摄像头...',
|
||||
style: TextStyle(
|
||||
color: ColorUtil.Color_255_255_255,
|
||||
fontSize: 10.sp
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
: Container(
|
||||
width: double.infinity,
|
||||
color: ColorUtil.Color_57_57_57,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/metting_main_no_person.png',
|
||||
width: 138.w,
|
||||
height: 144.h,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'主持人正在赶来的路上...',
|
||||
style: TextStyle(
|
||||
color: ColorUtil.Color_255_255_255, fontSize: 14.sp),
|
||||
)
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
left: 4,
|
||||
bottom: 4,
|
||||
child: Row(
|
||||
children: [
|
||||
Visibility(
|
||||
visible: state.cacheUsers.value[index].uid == UserStore.to.userInfoEntity.value!.uid,
|
||||
child: Image.asset(
|
||||
'assets/images/meeting_main_own.png',
|
||||
width: 24.w,
|
||||
height: 24.h,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 20,
|
||||
margin: const EdgeInsets.only(left: 4),
|
||||
padding:
|
||||
const EdgeInsets.only(left: 4, right: 4),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
color: ColorUtil.Color_0_0_0_96),
|
||||
child: state.cacheUsers.value[index].enableMicr == true
|
||||
? Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
height: 20.h,
|
||||
child: LiquidCustomProgressIndicator(
|
||||
value:
|
||||
state.cacheUsers.value[index]
|
||||
.volume ??
|
||||
0.0,
|
||||
valueColor:
|
||||
const AlwaysStoppedAnimation(
|
||||
ColorUtil
|
||||
.Color_2_177_136),
|
||||
backgroundColor:
|
||||
ColorUtil.Color_255_255_255,
|
||||
direction: Axis.vertical,
|
||||
shapePath: ViewSvgPath
|
||||
.getMicrpphonePath()),
|
||||
),
|
||||
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/meeting_main_microphone_open.png',
|
||||
width: 20.w,
|
||||
height: 20.h,
|
||||
),
|
||||
Text(
|
||||
state.cacheUsers.value[index].userName,
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
color: ColorUtil
|
||||
.Color_255_255_255),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
));
|
||||
return pageList[position];
|
||||
}
|
||||
|
||||
/// 对应页数的界面-全员观看是自己时
|
||||
Widget returnPageSelf(int position){
|
||||
debugPrint("wgs输出===:全员观看是自己时布局");
|
||||
var pageList = [];
|
||||
/// 大屏
|
||||
pageList.add(Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
AgoraVideoView(
|
||||
controller: VideoViewController(
|
||||
rtcEngine: state.rctEngine.value!,
|
||||
canvas: const VideoCanvas(uid: 0, setupMode: VideoViewSetupMode.videoViewSetupAdd),
|
||||
),
|
||||
),
|
||||
/*Positioned(
|
||||
bottom: 110,
|
||||
child: GestureDetector(
|
||||
child: Image.asset(
|
||||
'assets/images/meeting_main_hang_up.png',
|
||||
width: 50.w,
|
||||
height: 50.h,
|
||||
),
|
||||
onTap: () {
|
||||
},
|
||||
),
|
||||
),*/
|
||||
),
|
||||
Positioned(
|
||||
top: 16,
|
||||
right: 16,
|
||||
|
|
@ -1753,30 +1516,23 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
Text(
|
||||
'正在讲话:',
|
||||
style: TextStyle(
|
||||
fontSize: 10.sp,
|
||||
color: ColorUtil.Color_185_184_184),
|
||||
fontSize: 10.sp, color: ColorUtil.Color_185_184_184),
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
height: 20.h,
|
||||
child: LiquidCustomProgressIndicator(
|
||||
value:
|
||||
state.spokesmanVolume.value,
|
||||
valueColor:
|
||||
const AlwaysStoppedAnimation(
|
||||
ColorUtil
|
||||
.Color_2_177_136),
|
||||
backgroundColor:
|
||||
ColorUtil.Color_255_255_255,
|
||||
value: state.spokesmanVolume.value,
|
||||
valueColor: const AlwaysStoppedAnimation(
|
||||
ColorUtil.Color_2_177_136),
|
||||
backgroundColor: ColorUtil.Color_255_255_255,
|
||||
direction: Axis.vertical,
|
||||
shapePath: ViewSvgPath
|
||||
.getMicrpphonePath()),
|
||||
shapePath: ViewSvgPath.getMicrpphonePath()),
|
||||
),
|
||||
Text(
|
||||
state.spokesman.value,
|
||||
style: TextStyle(
|
||||
fontSize: 10.sp,
|
||||
color: ColorUtil.Color_185_184_184),
|
||||
fontSize: 10.sp, color: ColorUtil.Color_185_184_184),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
@ -1784,68 +1540,71 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
),
|
||||
],
|
||||
));
|
||||
|
||||
/// gridview
|
||||
pageList.add(Container(
|
||||
color: ColorUtil.Color_57_57_57,
|
||||
child: GridView.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
childAspectRatio: 0.8,
|
||||
crossAxisSpacing: 0),
|
||||
crossAxisCount: 2, childAspectRatio: 0.8, crossAxisSpacing: 0),
|
||||
itemCount: state.cacheUsers.value.length,
|
||||
itemBuilder: (BuildContext ctx, index) {
|
||||
return Stack(
|
||||
children: [
|
||||
state.cacheUsers.value[index].enableCamera == true ? state.cacheUsers.value[index].uid ==
|
||||
UserStore.to.userInfoEntity.value!.uid
|
||||
? AgoraVideoView(
|
||||
controller: VideoViewController(
|
||||
rtcEngine: state.rctEngine.value!,
|
||||
canvas: const VideoCanvas(uid: 0, setupMode: VideoViewSetupMode.videoViewSetupAdd)
|
||||
),
|
||||
)
|
||||
: AgoraVideoView(
|
||||
controller: VideoViewController.remote(
|
||||
rtcEngine: state.rctEngine.value!,
|
||||
canvas: VideoCanvas(
|
||||
uid: int.tryParse(
|
||||
state.cacheUsers.value[index].uid), setupMode: VideoViewSetupMode.videoViewSetupAdd),
|
||||
connection: RtcConnection(
|
||||
channelId: state.roomNumber.value),
|
||||
),
|
||||
)
|
||||
:
|
||||
Container(
|
||||
color: ColorUtil.Color_16_19_13,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/metting_main_no_person.png',
|
||||
width: 78.w,
|
||||
height: 84.h,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'该用户未开启摄像头...',
|
||||
style: TextStyle(
|
||||
color: ColorUtil.Color_255_255_255,
|
||||
fontSize: 10.sp
|
||||
state.cacheUsers.value[index].enableCamera == true
|
||||
? state.cacheUsers.value[index].uid ==
|
||||
UserStore.to.userInfoEntity.value!.uid
|
||||
? AgoraVideoView(
|
||||
controller: VideoViewController(
|
||||
rtcEngine: state.rctEngine.value!,
|
||||
canvas: const VideoCanvas(
|
||||
uid: 0,
|
||||
setupMode:
|
||||
VideoViewSetupMode.videoViewSetupAdd)),
|
||||
)
|
||||
: AgoraVideoView(
|
||||
controller: VideoViewController.remote(
|
||||
rtcEngine: state.rctEngine.value!,
|
||||
canvas: VideoCanvas(
|
||||
uid: int.tryParse(
|
||||
state.cacheUsers.value[index].uid),
|
||||
setupMode:
|
||||
VideoViewSetupMode.videoViewSetupAdd),
|
||||
connection: RtcConnection(
|
||||
channelId: state.roomNumber.value),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
color: ColorUtil.Color_16_19_13,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/metting_main_no_person.png',
|
||||
width: 78.w,
|
||||
height: 84.h,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'该用户未开启摄像头...',
|
||||
style: TextStyle(
|
||||
color: ColorUtil.Color_255_255_255,
|
||||
fontSize: 10.sp),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 4,
|
||||
bottom: 4,
|
||||
child: Row(
|
||||
children: [
|
||||
Visibility(
|
||||
visible: state.cacheUsers.value[index].uid == UserStore.to.userInfoEntity.value!.uid,
|
||||
visible: state.cacheUsers.value[index].uid ==
|
||||
UserStore.to.userInfoEntity.value!.uid,
|
||||
child: Image.asset(
|
||||
'assets/images/meeting_main_own.png',
|
||||
width: 24.w,
|
||||
|
|
@ -1855,65 +1614,56 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
Container(
|
||||
height: 20,
|
||||
margin: const EdgeInsets.only(left: 4),
|
||||
padding:
|
||||
const EdgeInsets.only(left: 4, right: 4),
|
||||
padding: const EdgeInsets.only(left: 4, right: 4),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
color: ColorUtil.Color_0_0_0_96),
|
||||
child: state.cacheUsers.value[index].enableMicr == true
|
||||
? Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
height: 20.h,
|
||||
child: LiquidCustomProgressIndicator(
|
||||
value:
|
||||
state.cacheUsers.value[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(
|
||||
state.cacheUsers.value[index].userName,
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
color: ColorUtil
|
||||
.Color_255_255_255),
|
||||
)
|
||||
],
|
||||
)
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
height: 20.h,
|
||||
child: LiquidCustomProgressIndicator(
|
||||
value: state.cacheUsers.value[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(
|
||||
state.cacheUsers.value[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: 20.w,
|
||||
height: 20.h,
|
||||
),
|
||||
Text(
|
||||
state.cacheUsers.value[index].userName,
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
color: ColorUtil
|
||||
.Color_255_255_255),
|
||||
)
|
||||
],
|
||||
),
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/meeting_main_microphone_open.png',
|
||||
width: 20.w,
|
||||
height: 20.h,
|
||||
),
|
||||
Text(
|
||||
state.cacheUsers.value[index].userName,
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
color: ColorUtil.Color_255_255_255),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
@ -1924,5 +1674,4 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
|||
));
|
||||
return pageList[position];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue