优化声音视频

This commit is contained in:
yj 2024-08-12 10:34:52 +08:00
parent 2a82ab22ee
commit 6ed15fff6c
1 changed files with 16 additions and 17 deletions

View File

@ -201,22 +201,6 @@ const Meeting: React.FC = () => {
}; };
}, []); }, []);
useEffect(() => {
console.log(111);
roomUserList.forEach((item: any) => {
if (item.uid === user.uid) {
const footerListTemplate = [...footerList]
footerListTemplate[0][0].title = item.enableMicr ? '关闭声音' : '开启声音'
footerListTemplate[0][0].active = !item.enableMicr
footerListTemplate[0][1].title = item.enableCamera ? '关闭视频' : '开启视频'
footerListTemplate[0][1].active = !item.enableCamera
setFooterList(footerListTemplate)
}
agora.muteLocalAudioStream(!item.enableMicr)
agora.muteLocalVideoStream(!item.enableCamera)
});
}, [roomUserList]);
useEffect(() => { useEffect(() => {
const connection = (navigator as any).connection const connection = (navigator as any).connection
if (connection.downlink === 0) { if (connection.downlink === 0) {
@ -354,6 +338,21 @@ const Meeting: React.FC = () => {
}; };
}, [recorder]) }, [recorder])
const changeAgoraDevice = () => {
console.log(roomUserList);
roomUserList.forEach((item: any) => {
if (item.uid === user.uid) {
const footerListTemplate = [...footerList]
footerListTemplate[0][0].title = item.enableMicr ? '关闭声音' : '开启声音'
footerListTemplate[0][0].active = !item.enableMicr
footerListTemplate[0][1].title = item.enableCamera ? '关闭视频' : '开启视频'
footerListTemplate[0][1].active = !item.enableCamera
setFooterList(footerListTemplate)
}
agora.muteLocalAudioStream(!item.enableMicr)
agora.muteLocalVideoStream(!item.enableCamera)
});
}
// 替换数据 // 替换数据
const setAllUserListData = (key: string, item: any): void => { const setAllUserListData = (key: string, item: any): void => {
switch (key) { switch (key) {
@ -393,7 +392,7 @@ const Meeting: React.FC = () => {
}) })
break; break;
} }
changeAgoraDevice()
} }
// 网络 // 网络
const handleNetworkChange = (): void => { const handleNetworkChange = (): void => {