From ed4106d6e0b0da5f87aba11edd2daeb46c78aa58 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Fri, 30 Aug 2024 10:32:54 +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/components/UserVideo/index.tsx | 1 + src/page/Meeting/index.tsx | 2 +- src/utils/package/agora.ts | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/UserVideo/index.tsx b/src/components/UserVideo/index.tsx index 2aa60e4..157ddcd 100644 --- a/src/components/UserVideo/index.tsx +++ b/src/components/UserVideo/index.tsx @@ -77,6 +77,7 @@ const UserVideo: React.FC = () => { }; // 获取轮训用户 const getPolling = async (): Promise => { + setUserList([]) GetPolling(state.channelId?.split('1')[0] as string, from.viewPeopleValue).then((res: any) => { if (res.code === 200) { setUserList(res.data) diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index e77b48f..a3f8bfc 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -571,7 +571,7 @@ const Meeting: React.FC = () => { tokenA: state.tokenA, }) if (userInfo.roleId === '1') { - await agora.allJoinChannelEx() + await agora.allJoinChannelEx(true) } } // 状态更新 diff --git a/src/utils/package/agora.ts b/src/utils/package/agora.ts index 04f813f..1234925 100644 --- a/src/utils/package/agora.ts +++ b/src/utils/package/agora.ts @@ -236,13 +236,13 @@ export const agora = { ); }, // 所有用户加入的第二个房间 - allJoinChannelEx: async () => { + allJoinChannelEx: async (bool: boolean = false) => { await agora.startCameraCapture() await rtcEngine.joinChannelEx( option.tokenA, { channelId: option.channelId + '1', localUid: Number('1' + option.screenShareId) }, { - clientRoleType: ClientRoleType.ClientRoleBroadcaster, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众 + clientRoleType: bool ? ClientRoleType.ClientRoleAudience : ClientRoleType.ClientRoleBroadcaster , //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众 autoSubscribeAudio: false,//设置是否自动订阅所有音频流 autoSubscribeVideo: true,//设置是否自动订阅所有视频流 publishMicrophoneTrack: false,//设置是否发布麦克风采集到的音频