yangjie #47

Merged
yangqiang merged 49 commits from yangjie into master 2025-01-24 13:43:09 +08:00
2 changed files with 12 additions and 7 deletions
Showing only changes of commit 9f045f7531 - Show all commits

View File

@ -793,7 +793,11 @@ const Meeting: React.FC = () => {
if (!role.ID.includes(userInfo.roleId)) { if (!role.ID.includes(userInfo.roleId)) {
let userId = item.watchUids.find((uid: any) => uid === userInfo.uid) let userId = item.watchUids.find((uid: any) => uid === userInfo.uid)
if (userId) { if (userId) {
await agora.allJoinChannelEx() GetRoomRtcToken(state.channelId + 'a').then(async res => {
if (res.code === 200) {
await agora.allJoinChannelEx(false, res.data.token)
}
})
} else { } else {
await agora.allLeaveChannelEx() await agora.allLeaveChannelEx()
} }
@ -1176,7 +1180,6 @@ const Meeting: React.FC = () => {
uid: userInfo.uid, uid: userInfo.uid,
screenShareId: userInfo.screenShareId, screenShareId: userInfo.screenShareId,
token: state.token, token: state.token,
tokenA: state.tokenA,
}) })
} }
// 状态更新 // 状态更新
@ -1656,7 +1659,11 @@ const Meeting: React.FC = () => {
break; break;
case '会议监控': case '会议监控':
if (!statusList.userVideo) { 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 { } else {
await agora.allLeaveChannelEx() await agora.allLeaveChannelEx()
} }

View File

@ -32,7 +32,6 @@ const os = require("os");
const option: any = { const option: any = {
appId: '', appId: '',
token: '', token: '',
tokenA: '',
channelId: '', channelId: '',
uid: '', uid: '',
screenShareId: '', 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) const user = await JSON.parse(storage.getItem('user') as string)
await agora.startCameraCapture(true) await agora.startCameraCapture(true)
await rtcEngine.joinChannelEx( await rtcEngine.joinChannelEx(
option.tokenA, token,
{ channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) }, { channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) },
{ {
clientRoleType: bool ? ClientRoleType.ClientRoleAudience : ClientRoleType.ClientRoleBroadcaster, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众 clientRoleType: bool ? ClientRoleType.ClientRoleAudience : ClientRoleType.ClientRoleBroadcaster, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
@ -456,7 +455,6 @@ export const agora = {
// 加入频道 // 加入频道
setJoinChannel: async (data: any) => { setJoinChannel: async (data: any) => {
option.token = data.token; option.token = data.token;
option.tokenA = data.tokenA;
option.channelId = data.channelId; option.channelId = data.channelId;
option.uid = Number(data.uid); option.uid = Number(data.uid);
option.screenShareId = data.screenShareId; option.screenShareId = data.screenShareId;