优化频繁切换用户身份系统卡顿

This commit is contained in:
yj 2024-12-27 16:49:44 +08:00
parent c07de8d2a1
commit 3723873d71
1 changed files with 11 additions and 15 deletions

View File

@ -1226,22 +1226,18 @@ const Meeting: React.FC = () => {
// 刷新 // 刷新
const refreshVideoView = async (userItem: any): Promise<void> => { const refreshVideoView = async (userItem: any): Promise<void> => {
if (userItem.uid === userInfo.uid) { if (userItem.uid === userInfo.uid) {
setTimeout(async () => { await agora.setupLocalVideo({
await agora.setupLocalVideo({ uid: Number(userItem.uid),
uid: Number(userItem.uid), view: document.getElementById(`video-${userItem.uid}`),
view: document.getElementById(`video-${userItem.uid}`), channelId: state.channelId,
channelId: state.channelId, sourceType: VideoSourceType.VideoSourceCameraPrimary,
sourceType: VideoSourceType.VideoSourceCameraPrimary, })
})
}, 1500);
} else { } else {
setTimeout(async () => { await agora.setupRemoteVideoJoin({
await agora.setupRemoteVideoJoin({ uid: Number(userItem.uid),
uid: Number(userItem.uid), view: document.getElementById(`video-${userItem.uid}`),
view: document.getElementById(`video-${userItem.uid}`), channelId: state.channelId,
channelId: state.channelId, })
})
}, 1500);
} }
} }
// 替换数据 // 替换数据