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

View File

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