From 954da4a220352a40f08d684bbb7dd945e4cc7c32 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Mon, 9 Sep 2024 15:01:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/Meeting/index.tsx | 12 +++++++++++- src/utils/package/agora.ts | 37 +++++++------------------------------ 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index 7bdc843..96ad139 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -14,7 +14,7 @@ import { agora } from '@/utils/package/agora' import { onInvoke, onSignalr, offSignalr, onStart } from '@/utils/package/signalr'; import dayjs from 'dayjs'; import durationPlugin from 'dayjs/plugin/duration'; -import { VideoSourceType } from 'agora-electron-sdk'; +import { VideoSourceType, VideoStreamType } from 'agora-electron-sdk'; import Avatar from '@/components/Avatar'; import SharedFilesModel from '@/components/SharedFilesModel'; import StupWizard from '@/components/StupWizard'; @@ -248,6 +248,16 @@ const Meeting: React.FC = () => { } }, [isShare, roomUserList]); + useEffect(() => { + roomUserList.forEach(async (item: any) => { + if (item.uid === currentVideoId) { + await agora.setRemoteVideoStreamType(item.uid, VideoStreamType.VideoStreamHigh) + } else { + await agora.setRemoteVideoStreamType(item.uid, VideoStreamType.VideoStreamLow) + } + }); + }, [currentVideoId]); + useEffect(() => { onSignalr(async (item: any) => { switch (item.key) { diff --git a/src/utils/package/agora.ts b/src/utils/package/agora.ts index 99b88e4..ab36153 100644 --- a/src/utils/package/agora.ts +++ b/src/utils/package/agora.ts @@ -129,19 +129,6 @@ export const agora = { // // 用户音量提示回调。 onAudioVolumeIndication: async (_connection: any, speakers: any, _speakerNumber: any, _totalVolume: any,) => { await onAudioVolumeIndication(speakers) - }, - onVideoSizeChanged: async (connection: any, - sourceType: VideoSourceType, - uid: number, - width: number, - height: number, - rotation: number) => { - console.log(connection, - sourceType, - uid, - width, - height, - rotation); } }); }, @@ -245,23 +232,13 @@ export const agora = { publishCameraTrack: true,//设置是否发布摄像头采集的视频 publishScreenTrack: false,//设置是否发布屏幕采集的视频 }) - // if (bool) { - // setTimeout(() => { - // rtcEngine.setRemoteVideoStreamType( - // Number(option.uid), - // VideoStreamType.VideoStreamHigh, - // ) - // console.log(111111); - // setTimeout(() => { - // rtcEngine.setRemoteVideoStreamType( - // Number(option.uid), - // VideoStreamType.VideoStreamLow, - // ) - // console.log(222222); - // }, 10000); - // }, 10000); - // // VideoStreamType.VideoStreamHigh, - // } + }, + // 设置接收大小流 + setRemoteVideoStreamType: async (uid: number, type: VideoStreamType) => { + await rtcEngine.setRemoteVideoStreamType( + Number(uid), + type, + ) }, // 共享屏幕单独用户 joinChannelEx: async (uid: any) => {