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