This commit is contained in:
parent
1d857aa7cc
commit
af97c97f6a
|
|
@ -429,10 +429,11 @@ const Meeting: React.FC = () => {
|
||||||
let userId = item.watchUids.find((uid: any) => uid === userInfo.uid)
|
let userId = item.watchUids.find((uid: any) => uid === userInfo.uid)
|
||||||
if (userId) {
|
if (userId) {
|
||||||
await agora.startCameraCapture()
|
await agora.startCameraCapture()
|
||||||
|
await agora.allJoinChannelEx()
|
||||||
} else {
|
} else {
|
||||||
await agora.stopCameraCapture();
|
await agora.stopCameraCapture();
|
||||||
|
await agora.allLeaveChannelEx()
|
||||||
}
|
}
|
||||||
agora.updateChannelMediaOptionsEx(userId ? true : false)
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -240,22 +240,19 @@ export const agora = {
|
||||||
await rtcEngine.joinChannelEx(
|
await rtcEngine.joinChannelEx(
|
||||||
option.tokenA,
|
option.tokenA,
|
||||||
{ channelId: option.channelId + '1', localUid: Number('1' + option.screenShareId) },
|
{ channelId: option.channelId + '1', localUid: Number('1' + option.screenShareId) },
|
||||||
{}
|
{
|
||||||
|
clientRoleType: ClientRoleType.ClientRoleBroadcaster, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||||
|
autoSubscribeAudio: false,//设置是否自动订阅所有音频流
|
||||||
|
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
||||||
|
publishMicrophoneTrack: false,//设置是否发布麦克风采集到的音频
|
||||||
|
publishCameraTrack: true,//设置是否发布摄像头采集的视频
|
||||||
|
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
||||||
|
}
|
||||||
);
|
);
|
||||||
await agora.updateChannelMediaOptionsEx(false)
|
|
||||||
},
|
},
|
||||||
updateChannelMediaOptionsEx: async (bool: boolean) => {
|
// 退出第二个房间
|
||||||
rtcEngine.updateChannelMediaOptionsEx({
|
allLeaveChannelEx: async () => {
|
||||||
clientRoleType: bool ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
await rtcEngine.leaveChannelEx({ channelId: option.channelId + '1', localUid: Number('1' + option.screenShareId) })
|
||||||
autoSubscribeAudio: false,//设置是否自动订阅所有音频流
|
|
||||||
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
|
||||||
publishMicrophoneTrack: false,//设置是否发布麦克风采集到的音频
|
|
||||||
publishCameraTrack: true,//设置是否发布摄像头采集的视频
|
|
||||||
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
|
||||||
}, {
|
|
||||||
channelId: option.channelId + '1',
|
|
||||||
localUid: Number('1' + option.screenShareId)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 离开共享屏幕频道
|
// 离开共享屏幕频道
|
||||||
leaveChannelEx: async (uid: any) => {
|
leaveChannelEx: async (uid: any) => {
|
||||||
|
|
@ -276,6 +273,7 @@ export const agora = {
|
||||||
},
|
},
|
||||||
// 摄像头采集
|
// 摄像头采集
|
||||||
startCameraCapture: async () => {
|
startCameraCapture: async () => {
|
||||||
|
console.log(1);
|
||||||
await rtcEngine.startCameraCapture(VideoSourceType.VideoSourceCamera, {
|
await rtcEngine.startCameraCapture(VideoSourceType.VideoSourceCamera, {
|
||||||
format: {
|
format: {
|
||||||
width: 640,
|
width: 640,
|
||||||
|
|
@ -286,6 +284,7 @@ export const agora = {
|
||||||
},
|
},
|
||||||
// 停止采集摄像头
|
// 停止采集摄像头
|
||||||
stopCameraCapture: async () => {
|
stopCameraCapture: async () => {
|
||||||
|
console.log(2);
|
||||||
await rtcEngine.stopCameraCapture()
|
await rtcEngine.stopCameraCapture()
|
||||||
},
|
},
|
||||||
// 加入频道
|
// 加入频道
|
||||||
|
|
@ -296,9 +295,6 @@ export const agora = {
|
||||||
option.uid = Number(data.uid);
|
option.uid = Number(data.uid);
|
||||||
option.screenShareId = data.screenShareId;
|
option.screenShareId = data.screenShareId;
|
||||||
await agora.joinChannel()
|
await agora.joinChannel()
|
||||||
if (data.tokenA) {
|
|
||||||
await agora.allJoinChannelEx()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
// 桌面捕获音频和视频的媒体源的信息
|
// 桌面捕获音频和视频的媒体源的信息
|
||||||
getDesktopCapturerVideo: async (thumbSize: any, iconSize: any, includeScreen: boolean) => {
|
getDesktopCapturerVideo: async (thumbSize: any, iconSize: any, includeScreen: boolean) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue