还原配置
This commit is contained in:
parent
d397b27d49
commit
eee2c11336
|
|
@ -434,9 +434,9 @@ const Meeting: React.FC = () => {
|
|||
if (userInfo.roleId !== '1') {
|
||||
let userId = item.watchUids.find((uid: any) => uid === userInfo.uid)
|
||||
if (userId) {
|
||||
agora.updateChannelMediaOptionsEx(true)
|
||||
await agora.allJoinChannelEx()
|
||||
} else {
|
||||
agora.updateChannelMediaOptionsEx(false)
|
||||
await agora.allLeaveChannelEx()
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -567,9 +567,10 @@ const Meeting: React.FC = () => {
|
|||
screenShareId: userInfo.screenShareId,
|
||||
token: state.token,
|
||||
tokenA: state.tokenA,
|
||||
roleId: userInfo.roleId,
|
||||
})
|
||||
await agora.allJoinChannelEx(false)
|
||||
if (userInfo.roleId === '1') {
|
||||
await agora.allJoinChannelEx(true)
|
||||
}
|
||||
}
|
||||
// 状态更新
|
||||
const changeAgoraDevice = () => {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ const option: any = {
|
|||
channelId: '',
|
||||
uid: '',
|
||||
screenShareId: '',
|
||||
roleId: '2',
|
||||
}
|
||||
let rtcEngine: any = '';
|
||||
export const agora = {
|
||||
|
|
@ -239,44 +238,24 @@ export const agora = {
|
|||
);
|
||||
},
|
||||
// 所有用户加入的第二个房间
|
||||
allJoinChannelEx: async (bool: boolean) => {
|
||||
allJoinChannelEx: async (bool: boolean = false) => {
|
||||
await agora.startCameraCapture()
|
||||
await rtcEngine.joinChannelEx(
|
||||
option.tokenA,
|
||||
{ channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) },
|
||||
{
|
||||
|
||||
}
|
||||
);
|
||||
agora.updateChannelMediaOptionsEx(bool)
|
||||
},
|
||||
// 更新第二个房间配置
|
||||
updateChannelMediaOptionsEx: async (bool: boolean) => {
|
||||
let obj;
|
||||
if (bool) {
|
||||
await agora.startCameraCapture()
|
||||
obj = {
|
||||
clientRoleType: ClientRoleType.ClientRoleBroadcaster, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||
clientRoleType: bool ? ClientRoleType.ClientRoleAudience : ClientRoleType.ClientRoleBroadcaster, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||
autoSubscribeAudio: false,//设置是否自动订阅所有音频流
|
||||
autoSubscribeVideo: false,//设置是否自动订阅所有视频流
|
||||
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
||||
publishMicrophoneTrack: false,//设置是否发布麦克风采集到的音频
|
||||
publishCameraTrack: true,//设置是否发布摄像头采集的视频
|
||||
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
||||
}
|
||||
} else {
|
||||
await agora.stopCameraCapture();
|
||||
obj = {
|
||||
clientRoleType: ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||
autoSubscribeAudio: false,//设置是否自动订阅所有音频流
|
||||
autoSubscribeVideo: option.roleId === '1',//设置是否自动订阅所有视频流
|
||||
publishMicrophoneTrack: false,//设置是否发布麦克风采集到的音频
|
||||
publishCameraTrack: false,//设置是否发布摄像头采集的视频
|
||||
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
||||
}
|
||||
}
|
||||
await rtcEngine.updateChannelMediaOptionsEx(obj, { channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) })
|
||||
);
|
||||
},
|
||||
// 退出第二个房间
|
||||
allLeaveChannelEx: async () => {
|
||||
await agora.stopCameraCapture();
|
||||
await rtcEngine.leaveChannelEx({ channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) })
|
||||
},
|
||||
// ai降噪
|
||||
|
|
@ -321,7 +300,6 @@ export const agora = {
|
|||
option.channelId = data.channelId;
|
||||
option.uid = Number(data.uid);
|
||||
option.screenShareId = data.screenShareId;
|
||||
option.roleId = data.roleId;
|
||||
await agora.joinChannel()
|
||||
},
|
||||
// 桌面捕获音频和视频的媒体源的信息
|
||||
|
|
|
|||
Loading…
Reference in New Issue