This commit is contained in:
yj 2024-08-21 11:31:26 +08:00
parent 83e3a2aedc
commit b9661d6633
1 changed files with 18 additions and 25 deletions

View File

@ -139,7 +139,6 @@ const Meeting: React.FC = () => {
const msgTips = '您不是管理员或发言人,无法开启此功能!' const msgTips = '您不是管理员或发言人,无法开启此功能!'
useEffect(() => { useEffect(() => {
let time = null as any; let time = null as any;
let refreshVideoViewTime = null as any;
setUser(userInfo) setUser(userInfo)
setTimeout(() => { setTimeout(() => {
window.electron.getIsMaximized().then((res: boolean) => { window.electron.getIsMaximized().then((res: boolean) => {
@ -217,15 +216,11 @@ const Meeting: React.FC = () => {
time = setInterval(() => { time = setInterval(() => {
setCurrentSeconds(currentSeconds++) setCurrentSeconds(currentSeconds++)
}, 1000) }, 1000)
refreshVideoViewTime = setInterval(() => {
RefreshVideoView()
}, 3000)
return () => { return () => {
window.removeEventListener('customStorageChange', handleCustomStorageChange); window.removeEventListener('customStorageChange', handleCustomStorageChange);
window.removeEventListener('online', handleNetworkChange); window.removeEventListener('online', handleNetworkChange);
window.removeEventListener('offline', handleNetworkChange); window.removeEventListener('offline', handleNetworkChange);
clearInterval(time) clearInterval(time)
clearInterval(refreshVideoViewTime)
}; };
}, []); }, []);
@ -469,30 +464,28 @@ const Meeting: React.FC = () => {
item.isShow = true; item.isShow = true;
} }
}); });
RefreshVideoView(res)
return res return res
}) })
} }
// 刷新视图 // 刷新视图
const RefreshVideoView = async (): Promise<void> => { const RefreshVideoView = async (list: any): Promise<void> => {
setRoomUserList((res: any) => { list.forEach(async (item: any) => {
res.forEach(async (item: any) => { if (item.uid === userInfo.uid) {
if (item.uid === userInfo.uid) { await agora.setupLocalVideo({
await agora.setupLocalVideo({ uid: Number(item.uid),
uid: Number(item.uid), view: document.getElementById(`video-${item.uid}`),
view: document.getElementById(`video-${item.uid}`), channelId: state.channelId,
channelId: state.channelId, sourceType: VideoSourceType.VideoSourceCameraPrimary,
sourceType: VideoSourceType.VideoSourceCameraPrimary, })
}) } else {
} else { await agora.setupRemoteVideo({
await agora.setupRemoteVideo({ uid: Number(item.uid),
uid: Number(item.uid), view: document.getElementById(`video-${item.uid}`),
view: document.getElementById(`video-${item.uid}`), channelId: state.channelId,
channelId: state.channelId, })
}) }
} });
});
return res
})
} }
// 替换数据 // 替换数据
const setAllUserListData = async (key: string, item: any, callBack?: Function): Promise<void> => { const setAllUserListData = async (key: string, item: any, callBack?: Function): Promise<void> => {