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