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,//设置是否发布麦克风采集到的音频