yangjie #22

Merged
yangqiang merged 99 commits from yangjie into master 2024-10-22 16:11:46 +08:00
4 changed files with 27 additions and 33 deletions
Showing only changes of commit 170ff9b122 - Show all commits

View File

@ -14,12 +14,11 @@ const CurrentSpeakUserWindow: React.FC = () => {
switch (type) { switch (type) {
case 'currentSpeakUser': case 'currentSpeakUser':
if (currentSpeakUser.length) { if (currentSpeakUser.length) {
setInputValue(currentSpeakUser.join('; ')) setInputValue(currentSpeakUser.join(';'))
setIsMeSpeack(uidArr.find((item: any) => item === 0) ? true : false)
} else { } else {
setInputValue('') setInputValue('')
setIsMeSpeack(false)
} }
setIsMeSpeack(uidArr.find((item: any) => item === 0) === 0 ? true : false)
break; break;
} }
} }
@ -29,8 +28,8 @@ const CurrentSpeakUserWindow: React.FC = () => {
return ( return (
<> <>
<div className={styles.currentSpeakUserWindow}> <div className={styles.currentSpeakUserWindow}>
<div title={`正在说话:${isMeSpeack ? user.userName : ''} ${inputValue}`}> <div title={`正在说话:${isMeSpeack ? user.userName + ';' : ''} ${inputValue}`}>
{`正在说话:${isMeSpeack ? user.userName : ''} ${inputValue}`} {`正在说话:${isMeSpeack ? user.userName + ';' : ''} ${inputValue}`}
</div> </div>
</div > </div >
</> </>

View File

@ -1,5 +1,4 @@
import styles from '@/page/Meeting/NoticeWindow/index.module.scss' import styles from '@/page/Meeting/NoticeWindow/index.module.scss'
import { setKeyOpenChildWindow } from '@/utils/package/public';
import { Button, notification } from 'antd'; import { Button, notification } from 'antd';
import { useEffect } from "react"; import { useEffect } from "react";
@ -80,8 +79,8 @@ const NoticeWindow: React.FC = () => {
const dom = document.getElementsByClassName('ant-notification') const dom = document.getElementsByClassName('ant-notification')
if (dom.length === 0) { if (dom.length === 0) {
window.electron.setChildWindow({ window.electron.setChildWindow({
height: 0, height: 1,
window: 0, width: 1,
key: 'noticeWindow', key: 'noticeWindow',
}) })
} }

View File

@ -916,24 +916,27 @@ const Meeting: React.FC = () => {
} }
}, },
onAudioVolumeIndication: async (speakers: AudioVolumeInfo[]) => { onAudioVolumeIndication: async (speakers: AudioVolumeInfo[]) => {
async function checkUidsInUsers(uids: number[]): Promise<string[]> { function checkUidsInUsers(uids: number[]): string[] {
return new Promise<string[]>(resolve => { const usernames: string[] = [];
const usernames: string[] = []; setRoomUserList((res: any) => {
uids.forEach(uid => { uids.forEach(uid => {
setRoomUserList((res: any) => { const user = res.find((item: any) => item.uid == uid);
const user = res.find((item: any) => item.uid == uid); if (user) {
if (user) { usernames.push(user.userName);
usernames.push(user.userName); }
} })
return res return res
}) });
}); return usernames
if (uids.length === usernames.length) {
resolve(usernames)
}
})
} }
if (speakers.length) { 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) => { speakers.forEach((item: any) => {
let domMe = document.getElementById(`micr-item-${userInfo.uid}`); let domMe = document.getElementById(`micr-item-${userInfo.uid}`);
let dom = document.getElementById(`micr-${item.uid ? item.uid : 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) => { onNetworkQuality: async (_connection: RtcConnection, remoteUid: number, _txQuality: QualityType, rxQuality: QualityType) => {
@ -1535,8 +1531,8 @@ const Meeting: React.FC = () => {
}) })
window.electron.createChildWindow({ window.electron.createChildWindow({
url: location.origin + `/#/noticeWindow`, url: location.origin + `/#/noticeWindow`,
width: 388, width: 1,
height: 150, height: 1,
key: 'noticeWindow', key: 'noticeWindow',
}) })
setKeyOpenChildWindow('shareScreenWindow', true) setKeyOpenChildWindow('shareScreenWindow', true)

View File

@ -238,7 +238,7 @@ export const agora = {
}, },
// 加入频道 // 加入频道
joinChannel: async () => { 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.joinChannel(option.token, option.channelId, option.uid);
await rtcEngine.setDualStreamModeEx( await rtcEngine.setDualStreamModeEx(
SimulcastStreamMode.EnableSimulcastStream, SimulcastStreamMode.EnableSimulcastStream,