This commit is contained in:
yj 2024-08-16 15:17:07 +08:00
parent c7644b9607
commit 98d7911918
2 changed files with 21 additions and 14 deletions

View File

@ -348,7 +348,7 @@ const Meeting: React.FC = () => {
const otherUsers = [] as any; const otherUsers = [] as any;
// 遍历原始数组 // 遍历原始数组
arr.forEach((item: any) => { arr.forEach((item: any) => {
if (item.role === '1' || item.isRoomManager) { if (item.roleId === '1' || item.isRoomManager) {
// 如果是管理员或主讲人,添加到 adminsAndSpeakers 数组 // 如果是管理员或主讲人,添加到 adminsAndSpeakers 数组
adminsAndSpeakers.push(item); adminsAndSpeakers.push(item);
} else { } else {
@ -533,14 +533,22 @@ const Meeting: React.FC = () => {
setNoViewChatList(0) setNoViewChatList(0)
break; break;
case '共享屏幕': case '共享屏幕':
getDesktopCapturerVideo() if (user.roleId === '1') {
setIsSharedScreenModal(true) getDesktopCapturerVideo()
setIsSharedScreenModal(true)
} else {
message.error(msgTips)
}
break; break;
case '停止共享': case '停止共享':
await agora.leaveChannelEx(userInfo.screenShareId) if (user.roleId === '1') {
agora.stopScreenCapture() await agora.leaveChannelEx(userInfo.screenShareId)
await allUserLook(userInfo.uid) agora.stopScreenCapture()
footerListTemplate[itemIndex][rowIndex].title = '共享屏幕' await allUserLook(userInfo.uid)
footerListTemplate[itemIndex][rowIndex].title = '共享屏幕'
} else {
message.error(msgTips)
}
break; break;
case '静音': case '静音':
await postOpenMicr(false, user.uid) await postOpenMicr(false, user.uid)

View File

@ -188,19 +188,18 @@ const agora = {
// 加入频道 // 加入频道
joinChannel: async () => { joinChannel: async () => {
await rtcEngine.enableAudioVolumeIndication(100, 1, true) await rtcEngine.enableAudioVolumeIndication(100, 1, true)
await rtcEngine.joinChannel(option.token, option.channelId, option.uid, { await rtcEngine.joinChannel(option.token, option.channelId, option.uid);
autoSubscribeAudio: true,//设置是否自动订阅所有音频流
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
publishMicrophoneTrack: true,//设置是否发布麦克风采集到的音频
publishCameraTrack: true,//设置是否发布摄像头采集的视频
publishScreenTrack: false,//设置是否发布屏幕采集的视频
});
await agora.updateChannelMediaOptions() await agora.updateChannelMediaOptions()
}, },
// 更新频道配置 // 更新频道配置
updateChannelMediaOptions: async () => { updateChannelMediaOptions: async () => {
await rtcEngine.updateChannelMediaOptions({ await rtcEngine.updateChannelMediaOptions({
clientRoleType: option.roleId === '1' ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众 clientRoleType: option.roleId === '1' ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
autoSubscribeAudio: true,//设置是否自动订阅所有音频流
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
publishMicrophoneTrack: true,//设置是否发布麦克风采集到的音频
publishCameraTrack: true,//设置是否发布摄像头采集的视频
publishScreenTrack: false,//设置是否发布屏幕采集的视频
}) })
}, },
// 共享屏幕单独用户 // 共享屏幕单独用户