This commit is contained in:
yj 2024-08-19 16:12:28 +08:00
parent 3647104efc
commit a568f6dbd3
1 changed files with 68 additions and 55 deletions

View File

@ -573,15 +573,18 @@ const Meeting: React.FC = () => {
setNoViewChatList(0) setNoViewChatList(0)
break; break;
case '共享屏幕': case '共享屏幕':
if (getUserRoomInfo()) { await getUserRoomInfo().then(async (res) => {
if (res) {
getDesktopCapturerVideo() getDesktopCapturerVideo()
setIsSharedScreenModal(true) setIsSharedScreenModal(true)
} else { } else {
message.error(msgTips) message.error(msgTips)
} }
})
break; break;
case '停止共享': case '停止共享':
if (getUserRoomInfo()) { await getUserRoomInfo().then(async (res) => {
if (res) {
await agora.leaveChannelEx(userInfo.screenShareId) await agora.leaveChannelEx(userInfo.screenShareId)
agora.stopScreenCapture() agora.stopScreenCapture()
await allUserLook(userInfo.uid) await allUserLook(userInfo.uid)
@ -589,6 +592,7 @@ const Meeting: React.FC = () => {
} else { } else {
message.error(msgTips) message.error(msgTips)
} }
})
break; break;
case '静音': case '静音':
await postOpenMicr(false, user.uid) await postOpenMicr(false, user.uid)
@ -733,7 +737,9 @@ const Meeting: React.FC = () => {
}) })
setRoomUserList(res.data) setRoomUserList(res.data)
changeAgoraDevice() changeAgoraDevice()
agora.updateChannelMediaOptions(getUserRoomInfo(res.data) ? true : false) getUserRoomInfo().then(res => {
agora.updateChannelMediaOptions(res ? true : false)
})
} }
}) })
} }
@ -774,7 +780,8 @@ const Meeting: React.FC = () => {
} }
// 开关麦克风 // 开关麦克风
const postOpenMicr = async (enableMicr: boolean, uid: string, isAll?: boolean): Promise<void> => { const postOpenMicr = async (enableMicr: boolean, uid: string, isAll?: boolean): Promise<void> => {
if (getUserRoomInfo()) { await getUserRoomInfo().then(async (res) => {
if (res) {
if (!isAll) { if (!isAll) {
let msg = ''; let msg = '';
if (uid === user.uid) { if (uid === user.uid) {
@ -793,6 +800,7 @@ const Meeting: React.FC = () => {
} else { } else {
message.error(msgTips) message.error(msgTips)
} }
})
} }
// 开关麦克风 // 开关麦克风
const postOpenMicrApi = async (enableMicr: boolean, uid: string, isAll?: boolean): Promise<void> => { const postOpenMicrApi = async (enableMicr: boolean, uid: string, isAll?: boolean): Promise<void> => {
@ -812,7 +820,8 @@ const Meeting: React.FC = () => {
// 开关视频 // 开关视频
const postOpenCamera = async (enableCamera: boolean, uid: string): Promise<void> => { const postOpenCamera = async (enableCamera: boolean, uid: string): Promise<void> => {
if (getUserRoomInfo()) { await getUserRoomInfo().then(async (res) => {
if (res) {
let msg = ''; let msg = '';
if (uid === user.uid) { if (uid === user.uid) {
await agora.getVideoDeviceManager().then(res => { await agora.getVideoDeviceManager().then(res => {
@ -829,6 +838,7 @@ const Meeting: React.FC = () => {
} else { } else {
message.error(msgTips) message.error(msgTips)
} }
})
} }
// 开关视频 // 开关视频
const postOpenCameraApi = async (enableCamera: boolean, uid: string): Promise<void> => { const postOpenCameraApi = async (enableCamera: boolean, uid: string): Promise<void> => {
@ -848,13 +858,16 @@ const Meeting: React.FC = () => {
// speakerModeModalRef.current.changeSpeakerMode() // speakerModeModalRef.current.changeSpeakerMode()
// } // }
// 获取当前用户在房间的角色信息 // 获取当前用户在房间的角色信息
const getUserRoomInfo = (list?: any): any => { const getUserRoomInfo = async (): Promise<any> => {
const data = list ? list : roomUserList return new Promise((resolve, _reject) => {
let userItem = data.find((item: any) => item.uid === userInfo.uid) setRoomUserList((res: any) => {
let userItem = res.find((item: any) => item.uid === userInfo.uid)
if (userItem && (userItem.roleId === '1' || userItem.isRoomManager)) { if (userItem && (userItem.roleId === '1' || userItem.isRoomManager)) {
return userItem resolve(userItem)
} }
return '' return res
})
})
} }
// 获取当前模式样式 // 获取当前模式样式
const getMeetingContentBodyLeftModeClass = (): string => { const getMeetingContentBodyLeftModeClass = (): string => {