From 170ff9b12232e754b25123e58e7a184d67adcea6 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Fri, 18 Oct 2024 14:21:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Meeting/CurrentSpeakUserWindow/index.tsx | 9 ++-- src/page/Meeting/NoticeWindow/index.tsx | 5 +-- src/page/Meeting/index.tsx | 44 +++++++++---------- src/utils/package/agora.ts | 2 +- 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/src/page/Meeting/CurrentSpeakUserWindow/index.tsx b/src/page/Meeting/CurrentSpeakUserWindow/index.tsx index 622e3e5..c4c1893 100644 --- a/src/page/Meeting/CurrentSpeakUserWindow/index.tsx +++ b/src/page/Meeting/CurrentSpeakUserWindow/index.tsx @@ -14,12 +14,11 @@ const CurrentSpeakUserWindow: React.FC = () => { switch (type) { case 'currentSpeakUser': if (currentSpeakUser.length) { - setInputValue(currentSpeakUser.join('; ')) - setIsMeSpeack(uidArr.find((item: any) => item === 0) ? true : false) + setInputValue(currentSpeakUser.join(';')) } else { setInputValue('') - setIsMeSpeack(false) } + setIsMeSpeack(uidArr.find((item: any) => item === 0) === 0 ? true : false) break; } } @@ -29,8 +28,8 @@ const CurrentSpeakUserWindow: React.FC = () => { return ( <>
-
- {`正在说话:${isMeSpeack ? user.userName : ''} ${inputValue}`} +
+ {`正在说话:${isMeSpeack ? user.userName + ';' : ''} ${inputValue}`}
diff --git a/src/page/Meeting/NoticeWindow/index.tsx b/src/page/Meeting/NoticeWindow/index.tsx index fb0fa36..a2dac73 100644 --- a/src/page/Meeting/NoticeWindow/index.tsx +++ b/src/page/Meeting/NoticeWindow/index.tsx @@ -1,5 +1,4 @@ import styles from '@/page/Meeting/NoticeWindow/index.module.scss' -import { setKeyOpenChildWindow } from '@/utils/package/public'; import { Button, notification } from 'antd'; import { useEffect } from "react"; @@ -80,8 +79,8 @@ const NoticeWindow: React.FC = () => { const dom = document.getElementsByClassName('ant-notification') if (dom.length === 0) { window.electron.setChildWindow({ - height: 0, - window: 0, + height: 1, + width: 1, key: 'noticeWindow', }) } diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index ad030a8..02da424 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -916,24 +916,27 @@ const Meeting: React.FC = () => { } }, onAudioVolumeIndication: async (speakers: AudioVolumeInfo[]) => { - async function checkUidsInUsers(uids: number[]): Promise { - return new Promise(resolve => { - const usernames: string[] = []; + function checkUidsInUsers(uids: number[]): string[] { + const usernames: string[] = []; + setRoomUserList((res: any) => { uids.forEach(uid => { - setRoomUserList((res: any) => { - const user = res.find((item: any) => item.uid == uid); - if (user) { - usernames.push(user.userName); - } - return res - }) - }); - if (uids.length === usernames.length) { - resolve(usernames) - } - }) + const user = res.find((item: any) => item.uid == uid); + if (user) { + usernames.push(user.userName); + } + }) + return res + }); + return usernames } if (speakers.length) { + const uidArr = (speakers.filter((item: any) => item.volume)).map(item => item.uid) as number[]; + const currentSpeakUser = checkUidsInUsers(uidArr) + channel.postMessage({ + type: 'currentSpeakUser', + currentSpeakUser, + uidArr + }); speakers.forEach((item: any) => { let domMe = document.getElementById(`micr-item-${userInfo.uid}`); let dom = document.getElementById(`micr-${item.uid ? item.uid : userInfo.uid}`); @@ -950,13 +953,6 @@ const Meeting: React.FC = () => { }); } }); - const uidArr = (speakers.filter((item: any) => item.volume)) as number[]; - const currentSpeakUser = await checkUidsInUsers(uidArr) - channel.postMessage({ - type: 'currentSpeakUser', - currentSpeakUser, - uidArr - }); } }, onNetworkQuality: async (_connection: RtcConnection, remoteUid: number, _txQuality: QualityType, rxQuality: QualityType) => { @@ -1535,8 +1531,8 @@ const Meeting: React.FC = () => { }) window.electron.createChildWindow({ url: location.origin + `/#/noticeWindow`, - width: 388, - height: 150, + width: 1, + height: 1, key: 'noticeWindow', }) setKeyOpenChildWindow('shareScreenWindow', true) diff --git a/src/utils/package/agora.ts b/src/utils/package/agora.ts index 4c45306..abaf32e 100644 --- a/src/utils/package/agora.ts +++ b/src/utils/package/agora.ts @@ -238,7 +238,7 @@ export const agora = { }, // 加入频道 joinChannel: async () => { - await rtcEngine.enableAudioVolumeIndication(100, 3, true) + await rtcEngine.enableAudioVolumeIndication(1000, 3, true) await rtcEngine.joinChannel(option.token, option.channelId, option.uid); await rtcEngine.setDualStreamModeEx( SimulcastStreamMode.EnableSimulcastStream,