From 652830f6f13f1590d2cd9299c59caae8137223b1 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Tue, 15 Oct 2024 17:16:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=88=86=E4=BA=AB=E5=B1=8F?= =?UTF-8?q?=E5=B9=95=E6=8F=8F=E8=BE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/Meeting/index.tsx | 38 +++++++++++++++++++------------------- src/utils/package/agora.ts | 6 +----- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index 2b32883..ce50e21 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -189,7 +189,7 @@ const Meeting: React.FC = () => { const channel = new BroadcastChannel('meeting_channel'); useEffect(() => { let time: NodeJS.Timeout; - // let getDesktopCapturerVideoTime: NodeJS.Timeout; + let getDesktopCapturerVideoTime: NodeJS.Timeout; setUser(userInfo) window.electron.getIsMaximized().then((res: boolean) => { if (!res) { @@ -358,28 +358,28 @@ const Meeting: React.FC = () => { }) } }, 10000); - // getDesktopCapturerVideoTime = setInterval(() => { - // setSharedScreenItem((i: any) => { - // if (i && i.type === 0) { - // agora.getDesktopCapturerVideo({ width: 0, height: 0 }, { width: 0, height: 0 }, false).then(res => { - // if (res.length) { - // let row = res.find((item: any) => item.sourceId === i.sourceId) - // if (!row) { - // stopScreenCapture() - // setSharedScreenItem('') - // allUserLook(userInfo.uid, userInfo.userName) - // } - // } - // }) - // } - // return i - // }) - // }, 3000) + getDesktopCapturerVideoTime = setInterval(() => { + setSharedScreenItem((i: any) => { + if (i && i.type === 0) { + agora.getDesktopCapturerVideo({ width: 0, height: 0 }, { width: 0, height: 0 }, false).then(res => { + if (res.length) { + let row = res.find((item: any) => item.sourceId === i.sourceId) + if (!row) { + stopScreenCapture() + setSharedScreenItem('') + allUserLook(userInfo.uid, userInfo.userName) + } + } + }) + } + return i + }) + }, 3000) return () => { window.removeEventListener('customStorageChange', handleCustomStorageChange); window.removeEventListener('wheel', handleWheelChange); clearInterval(time) - // clearInterval(getDesktopCapturerVideoTime) + clearInterval(getDesktopCapturerVideoTime) }; }, []); diff --git a/src/utils/package/agora.ts b/src/utils/package/agora.ts index 6f857ce..4e0a99f 100644 --- a/src/utils/package/agora.ts +++ b/src/utils/package/agora.ts @@ -388,7 +388,7 @@ export const agora = { }, // 桌面捕获音频和视频的媒体源的信息 getDesktopCapturerVideo: async (thumbSize: any, iconSize: any, includeScreen: boolean) => { - return await rtcEngine.getScreenCaptureSources(thumbSize, iconSize, includeScreen).filter((item: any) => item.type === 1) + return await rtcEngine.getScreenCaptureSources(thumbSize, iconSize, includeScreen) }, // 共享屏幕采集 setDesktopCapturerVideo: async (targetSource: any, isComputerAudio: boolean, isFluencyPriority: boolean) => { @@ -414,8 +414,6 @@ export const agora = { {}, { windowFocus: true, - enableHighLight: true, - highLightColor: 0xFF99CC00, ...data } ); @@ -425,8 +423,6 @@ export const agora = { {}, { windowFocus: true, - enableHighLight: true, - highLightColor: 0xFF99CC00, ...data } );