This commit is contained in:
yj 2025-01-08 10:53:02 +08:00
parent d10fdd1d5c
commit 9f045f7531
2 changed files with 12 additions and 7 deletions

View File

@ -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()
}

View File

@ -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;