This commit is contained in:
yj 2024-08-28 10:10:25 +08:00
parent d17646cd61
commit 1a5a0ada94
1 changed files with 44 additions and 66 deletions

View File

@ -85,13 +85,13 @@ const Meeting: React.FC = () => {
active: false,
select: false,
},
{
title: '会议监控',
icon: ImageUrl.icon48,
iconSelect: ImageUrl.icon48Select,
active: false,
select: false,
},
// {
// title: '会议监控',
// icon: ImageUrl.icon48,
// iconSelect: ImageUrl.icon48Select,
// active: false,
// select: false,
// },
{
title: '录制',
icon: ImageUrl.icon27,
@ -188,54 +188,48 @@ const Meeting: React.FC = () => {
agora.init(true)
agora.registerEventHandler({
onJoinChannelSuccess: async (info: any, _elapsed: any) => {
if (info.channelId === state.channelId) {
if (String(info.localUid).length !== 9) {
await getJoin(state.enableMicr, state.enableCamera)
setTimeout(async () => {
await agora.setupLocalVideo({
uid: Number(info.localUid),
view: document.getElementById(`video-${info.localUid}`),
channelId: info.channelId,
sourceType: VideoSourceType.VideoSourceCameraPrimary,
})
getShowUser();
}, 1000);
}
if (String(info.localUid).length !== 9) {
await getJoin(state.enableMicr, state.enableCamera)
setTimeout(async () => {
await agora.setupLocalVideo({
uid: Number(info.localUid),
view: document.getElementById(`video-${info.localUid}`),
channelId: info.channelId,
sourceType: VideoSourceType.VideoSourceCameraPrimary,
})
getShowUser();
}, 1000);
}
},
onUserJoined: async (info: any, remoteUid: any, _elapsed: any) => {
if (info.channelId === state.channelId) {
if (String(remoteUid).length === 9) {
setIsShare(remoteUid)
} else {
setTimeout(async () => {
await agora.setupRemoteVideoJoin({
uid: Number(remoteUid),
view: document.getElementById(`video-${remoteUid}`),
channelId: info.channelId,
})
}, 1000);
}
if (String(remoteUid).length === 9) {
setIsShare(remoteUid)
} else {
setTimeout(async () => {
await agora.setupRemoteVideoJoin({
uid: Number(remoteUid),
view: document.getElementById(`video-${remoteUid}`),
channelId: info.channelId,
})
}, 1000);
}
},
onUserOffline: async (info: any, remoteUid: any, _reason: any) => {
if (info.channelId === state.channelId) {
if (String(remoteUid).length === 9) {
setIsShare(null)
renderVideo()
}
await agora.setupRemoteVideo({
uid: Number(remoteUid),
view: null,
channelId: info.channelId,
});
setCurrentVideoId((res: any) => {
if (Number(res) === remoteUid) {
getShowUser();
}
return res
})
if (String(remoteUid).length === 9) {
setIsShare(null)
renderVideo()
}
await agora.setupRemoteVideo({
uid: Number(remoteUid),
view: null,
channelId: info.channelId,
});
setCurrentVideoId((res: any) => {
if (Number(res) === remoteUid) {
getShowUser();
}
return res
})
},
onAudioVolumeIndication: async (speakers: any) => {
speakers.forEach((item: any) => {
@ -247,15 +241,11 @@ const Meeting: React.FC = () => {
});
}
})
if (state.enableCamera) {
agora.startCameraCapture()
}
agora.startCameraCapture()
agora.setJoinChannel({
channelId: state.channelId,
uid: userInfo.uid,
screenShareId: userInfo.screenShareId,
token: state.token,
tokenA: state.tokenA,
})
storage.setItem('noViewChatList', 0)
window.addEventListener('customStorageChange', handleCustomStorageChange);
@ -475,18 +465,6 @@ const Meeting: React.FC = () => {
pauseOnHover: false,
});
break;
// 管理员查看随机用户
case 'Watch':
if (userInfo.roleId !== '1') {
let userId = item.watchUids.find((uid: any) => uid === userInfo.uid)
if (userId) {
await agora.startCameraCapture()
} else {
await agora.stopCameraCapture();
}
agora.updateChannelMediaOptionsEx(userId ? true : false)
}
break;
}
})
return () => {
@ -937,7 +915,7 @@ const Meeting: React.FC = () => {
break;
case '会议监控':
window.electron.oepnWindow({
url: location.origin + `/#/userVideo?channelId=${state.channelId + '1'}&token=${state.tokenA}`
url: location.origin + '/#/userVideo'
})
break;
}