This commit is contained in:
yj 2024-08-16 16:35:24 +08:00
parent 5550b6e950
commit 95d3305d60
2 changed files with 5 additions and 8 deletions

View File

@ -189,7 +189,6 @@ const Meeting: React.FC = () => {
channelId: state.channelId,
uid: userInfo.uid,
token: state.token,
roleId: userInfo.roleId,
})
storage.setItem('noViewChatList', 0)
window.addEventListener('customStorageChange', handleCustomStorageChange);
@ -688,15 +687,15 @@ const Meeting: React.FC = () => {
}
// 获取房间用户
const getRoomUser = async (callback?: Function): Promise<void> => {
const getRoomUser = async (): Promise<void> => {
GetRoomUser(state.channelId).then(res => {
if (res.code === 200) {
res.data.forEach((item: any) => {
item.isShow = true;
})
setRoomUserList(res.data)
callback && callback(res.data)
changeAgoraDevice()
agora.updateChannelMediaOptions(getUserRoomInfo(res.data) ? true : false)
}
})
}
@ -804,8 +803,9 @@ const Meeting: React.FC = () => {
// speakerModeModalRef.current.changeSpeakerMode()
// }
// 获取当前用户在房间的角色信息
const getUserRoomInfo = (): any => {
let userItem = roomUserList.find((item: any) => item.uid === user.uid)
const getUserRoomInfo = (list?: any): any => {
const data = list ? list : roomUserList
let userItem = data.find((item: any) => item.uid === user.uid)
if (userItem && (userItem.roleId === '1' || userItem.isRoomManager)) {
return userItem
}

View File

@ -14,7 +14,6 @@ const option: any = {
token: '',
channelId: '',
uid: '',
roleId: ''
}
let rtcEngine: any = '';
@ -189,7 +188,6 @@ const agora = {
joinChannel: async () => {
await rtcEngine.enableAudioVolumeIndication(100, 1, true)
await rtcEngine.joinChannel(option.token, option.channelId, option.uid);
await agora.updateChannelMediaOptions(option.roleId === '1' ? true : false)
},
// 更新频道配置
updateChannelMediaOptions: async (bool: boolean) => {
@ -248,7 +246,6 @@ const agora = {
option.token = data.token;
option.channelId = data.channelId;
option.uid = Number(data.uid);
option.roleId = data.roleId;
await agora.joinChannel()
},
// 桌面捕获音频和视频的媒体源的信息