From 85566f4a9105a73aac5e947832b970b4786d8ac7 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Wed, 21 Aug 2024 11:10:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=98=BE=E7=A4=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/Meeting/index.tsx | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index ba81ee6..e83a858 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -177,10 +177,15 @@ const Meeting: React.FC = () => { }, 1000); } }, - onUserOffline: async (_info: any, remoteUid: any, _reason: any) => { + onUserOffline: async (info: any, remoteUid: any, _reason: any) => { if (String(remoteUid).length === 9) { setIsShare(null) } + await agora.setupRemoteVideo({ + uid: Number(remoteUid), + view: null, + channelId: info.channelId, + }); setCurrentVideoId((res: any) => { if (Number(res) === remoteUid) { getShowUser(); @@ -439,8 +444,27 @@ const Meeting: React.FC = () => { return res }) } + // 刷新视图 + const RefreshVideoView = async (list: any): Promise => { + list.forEach(async (item: any) => { + if (item.uid === userInfo.uid) { + await agora.setupLocalVideo({ + uid: Number(item.uid), + view: document.getElementById(`video-${item.uid}`), + channelId: state.channelId, + sourceType: VideoSourceType.VideoSourceCameraPrimary, + }) + } else { + await agora.setupRemoteVideo({ + uid: Number(item.uid), + view: document.getElementById(`video-${item.uid}`), + channelId: state.channelId, + }) + } + }); + } // 替换数据 - const setAllUserListData = (key: string, item: any, callBack?: Function): void => { + const setAllUserListData = async (key: string, item: any, callBack?: Function): Promise => { switch (key) { case 'OperMicr': case 'OperCamera': @@ -465,6 +489,9 @@ const Meeting: React.FC = () => { setRoomUserList((res: any) => { let userItemIndex = res.findIndex((row: any) => row.uid === item.uid) res.splice(userItemIndex, 1) + setTimeout(() => { + RefreshVideoView(res) + }, 1000); return res }) break; @@ -1059,9 +1086,10 @@ const Meeting: React.FC = () => {
-
+
{roomUserList.map((item: any, index: number) => { return (index <= 19 ?
{