This commit is contained in:
parent
7093367904
commit
37c06ca19f
|
|
@ -159,8 +159,8 @@ const Meeting: React.FC = () => {
|
|||
itemIndex: 0,
|
||||
rowIndex: 0,
|
||||
});
|
||||
const [audioStatus, setAudioStatus] = useState<StreamPublishState>(1);
|
||||
const [videoStatus, setVideoStatus] = useState<StreamPublishState>(1);
|
||||
const [_audioStatus, setAudioStatus] = useState<StreamPublishState>(1);
|
||||
const [_videoStatus, setVideoStatus] = useState<StreamPublishState>(1);
|
||||
const [roomUserList, setRoomUserList] = useState<any>([])
|
||||
const [_speackUid, setSpeackUid] = useState<any>([])
|
||||
const [currentSpeakUser, setCurrentSpeakUser] = useState<any>([])
|
||||
|
|
@ -1160,60 +1160,60 @@ const Meeting: React.FC = () => {
|
|||
return () => clearTimeout(timer);
|
||||
}, [isClickedMediaSteam]);
|
||||
|
||||
useEffect(() => {
|
||||
let timer: NodeJS.Timeout | string = '';
|
||||
if (audioStatus === 1 && videoStatus === 1) {
|
||||
if (timer) {
|
||||
clearTimeout(timer)
|
||||
timer = ''
|
||||
}
|
||||
timer = setTimeout(() => {
|
||||
setIsShare((req: any) => {
|
||||
if (!req) {
|
||||
setRoomUserList((res: any) => {
|
||||
let userItem = res.find((item: any) => item.uid === userInfo.uid)
|
||||
if (!role.ID.includes(userInfo.roleId) && userItem && userItem.isRoomManager) {
|
||||
DeleteRoomManager({
|
||||
roomId: state.roomId,
|
||||
roomNum: state.channelId,
|
||||
userId: userInfo.uid
|
||||
})
|
||||
confirm({
|
||||
title: '提示',
|
||||
icon: <ExclamationCircleFilled />,
|
||||
content: `由于您长时间未发言,已自动取消发言权限,是否重新申请发言?`,
|
||||
centered: true,
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
async onOk() {
|
||||
GetApplySpeak(state.channelId).then(res => {
|
||||
if (res.code === 200) {
|
||||
setIsClicked(true);
|
||||
message.success('申请发言成功')
|
||||
}
|
||||
})
|
||||
},
|
||||
onCancel() {
|
||||
// useEffect(() => {
|
||||
// let timer: NodeJS.Timeout | string = '';
|
||||
// if (audioStatus === 1 && videoStatus === 1) {
|
||||
// if (timer) {
|
||||
// clearTimeout(timer)
|
||||
// timer = ''
|
||||
// }
|
||||
// timer = setTimeout(() => {
|
||||
// setIsShare((req: any) => {
|
||||
// if (!req) {
|
||||
// setRoomUserList((res: any) => {
|
||||
// let userItem = res.find((item: any) => item.uid === userInfo.uid)
|
||||
// if (!role.ID.includes(userInfo.roleId) && userItem && userItem.isRoomManager) {
|
||||
// DeleteRoomManager({
|
||||
// roomId: state.roomId,
|
||||
// roomNum: state.channelId,
|
||||
// userId: userInfo.uid
|
||||
// })
|
||||
// confirm({
|
||||
// title: '提示',
|
||||
// icon: <ExclamationCircleFilled />,
|
||||
// content: `由于您长时间未发言,已自动取消发言权限,是否重新申请发言?`,
|
||||
// centered: true,
|
||||
// okText: '确定',
|
||||
// cancelText: '取消',
|
||||
// async onOk() {
|
||||
// GetApplySpeak(state.channelId).then(res => {
|
||||
// if (res.code === 200) {
|
||||
// setIsClicked(true);
|
||||
// message.success('申请发言成功')
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
// onCancel() {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
clearTimeout(timer)
|
||||
timer = ''
|
||||
return res
|
||||
})
|
||||
}
|
||||
return req
|
||||
})
|
||||
}, 1000 * 60 * 5);
|
||||
} else {
|
||||
if (timer) {
|
||||
clearTimeout(timer)
|
||||
timer = ''
|
||||
}
|
||||
}
|
||||
return () => timer ? clearTimeout(timer) : '';
|
||||
}, [audioStatus, videoStatus]);
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// clearTimeout(timer)
|
||||
// timer = ''
|
||||
// return res
|
||||
// })
|
||||
// }
|
||||
// return req
|
||||
// })
|
||||
// }, 1000 * 60 * 5);
|
||||
// } else {
|
||||
// if (timer) {
|
||||
// clearTimeout(timer)
|
||||
// timer = ''
|
||||
// }
|
||||
// }
|
||||
// return () => timer ? clearTimeout(timer) : '';
|
||||
// }, [audioStatus, videoStatus]);
|
||||
|
||||
useEffect(() => {
|
||||
let timer: NodeJS.Timeout | undefined;
|
||||
|
|
@ -1348,7 +1348,27 @@ const Meeting: React.FC = () => {
|
|||
})
|
||||
setCurrentVideoId((res: any) => {
|
||||
if (res === String(remoteUid)) {
|
||||
renderVideo(String(remoteUid))
|
||||
let dom: any;
|
||||
setCurrentLookUserStatus(req => {
|
||||
switch (req) {
|
||||
case 1:
|
||||
dom = document.getElementById(`video-source-camera-primary`) as HTMLElement
|
||||
break;
|
||||
case 2:
|
||||
dom = document.getElementById(`video-source-screen`) as HTMLElement;
|
||||
break;
|
||||
case 3:
|
||||
dom = document.getElementById(`video-source-remote-screen`) as HTMLElement
|
||||
break;
|
||||
case 4:
|
||||
dom = document.getElementById(`video-source-remote-camera`) as HTMLElement
|
||||
break;
|
||||
}
|
||||
if (dom && dom.childNodes.length === 1) {
|
||||
renderVideo(String(remoteUid))
|
||||
}
|
||||
return req
|
||||
})
|
||||
}
|
||||
return res
|
||||
})
|
||||
|
|
@ -2172,7 +2192,25 @@ const Meeting: React.FC = () => {
|
|||
item.isRoom = true;
|
||||
item.isAdmin = role.ID.includes(item.roleId) || item.isRoomManager
|
||||
})
|
||||
setRoomUserList(res.data)
|
||||
setRoomUserList((req: any) => {
|
||||
if (req.length) {
|
||||
let arr: any = []
|
||||
res.data.forEach((item: any) => {
|
||||
let userItem = req.find((row: any) => row.uid == item.uid);
|
||||
if (userItem) {
|
||||
userItem.enableCamera = item.enableCamera;
|
||||
userItem.enableMicr = item.enableMicr;
|
||||
userItem.isRoomManager = item.isRoomManager;
|
||||
userItem.isAdmin = role.ID.includes(item.roleId) || item.isRoomManager;
|
||||
} else {
|
||||
arr.push(item)
|
||||
}
|
||||
});
|
||||
return [...req, ...arr]
|
||||
} else {
|
||||
return res.data
|
||||
}
|
||||
})
|
||||
getUserRoomInfo().then(async (res) => {
|
||||
await agora.updateChannelMediaOptions(res ? true : false)
|
||||
changeAgoraDevice()
|
||||
|
|
|
|||
Loading…
Reference in New Issue