diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index c9b2575..fcce7c9 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -793,7 +793,11 @@ const Meeting: React.FC = () => { if (!role.ID.includes(userInfo.roleId)) { let userId = item.watchUids.find((uid: any) => uid === userInfo.uid) if (userId) { - await agora.allJoinChannelEx() + GetRoomRtcToken(state.channelId + 'a').then(async res => { + if (res.code === 200) { + await agora.allJoinChannelEx(false, res.data.token) + } + }) } else { await agora.allLeaveChannelEx() } @@ -1176,7 +1180,6 @@ const Meeting: React.FC = () => { uid: userInfo.uid, screenShareId: userInfo.screenShareId, token: state.token, - tokenA: state.tokenA, }) } // 状态更新 @@ -1656,7 +1659,11 @@ const Meeting: React.FC = () => { break; case '会议监控': if (!statusList.userVideo) { - await agora.allJoinChannelEx(true) + GetRoomRtcToken(state.channelId + 'a').then(async res => { + if (res.code === 200) { + await agora.allJoinChannelEx(true, res.data.token) + } + }) } else { await agora.allLeaveChannelEx() } diff --git a/src/utils/package/agora.ts b/src/utils/package/agora.ts index 7a39177..6702fdb 100644 --- a/src/utils/package/agora.ts +++ b/src/utils/package/agora.ts @@ -32,7 +32,6 @@ const os = require("os"); const option: any = { appId: '', token: '', - tokenA: '', channelId: '', uid: '', screenShareId: '', @@ -346,11 +345,11 @@ export const agora = { ); }, // 所有用户加入的第二个房间 - allJoinChannelEx: async (bool: boolean = false) => { + allJoinChannelEx: async (bool: boolean = false, token: string) => { const user = await JSON.parse(storage.getItem('user') as string) await agora.startCameraCapture(true) await rtcEngine.joinChannelEx( - option.tokenA, + token, { channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) }, { clientRoleType: bool ? ClientRoleType.ClientRoleAudience : ClientRoleType.ClientRoleBroadcaster, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众 @@ -456,7 +455,6 @@ export const agora = { // 加入频道 setJoinChannel: async (data: any) => { option.token = data.token; - option.tokenA = data.tokenA; option.channelId = data.channelId; option.uid = Number(data.uid); option.screenShareId = data.screenShareId;