测试2
This commit is contained in:
parent
8c4ae7532a
commit
daf96cd4d5
|
|
@ -425,15 +425,15 @@ const Meeting: React.FC = () => {
|
||||||
break;
|
break;
|
||||||
// 管理员查看随机用户
|
// 管理员查看随机用户
|
||||||
case 'Watch':
|
case 'Watch':
|
||||||
// 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) {
|
||||||
// await agora.startCameraCapture()
|
await agora.startCameraCapture()
|
||||||
// } else {
|
} else {
|
||||||
// await agora.stopCameraCapture();
|
await agora.stopCameraCapture();
|
||||||
// }
|
}
|
||||||
// agora.updateChannelMediaOptionsEx(userId ? true : false)
|
agora.updateChannelMediaOptionsEx(userId ? true : false)
|
||||||
// }
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -512,6 +512,7 @@ const Meeting: React.FC = () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUserJoined: async (info: any, remoteUid: any, _elapsed: any) => {
|
onUserJoined: async (info: any, remoteUid: any, _elapsed: any) => {
|
||||||
|
console.log(info, remoteUid, '远端');
|
||||||
if (info.channelId === state.channelId) {
|
if (info.channelId === state.channelId) {
|
||||||
if (String(remoteUid).length === 9) {
|
if (String(remoteUid).length === 9) {
|
||||||
setIsShare(remoteUid)
|
setIsShare(remoteUid)
|
||||||
|
|
@ -524,15 +525,6 @@ const Meeting: React.FC = () => {
|
||||||
})
|
})
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
console.log(info, remoteUid, '远端');
|
|
||||||
setTimeout(async () => {
|
|
||||||
await agora.setupRemoteVideoJoin({
|
|
||||||
uid: Number(remoteUid),
|
|
||||||
view: document.getElementById(`video-${remoteUid}`),
|
|
||||||
channelId: info.channelId,
|
|
||||||
})
|
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUserOffline: async (info: any, remoteUid: any, _reason: any) => {
|
onUserOffline: async (info: any, remoteUid: any, _reason: any) => {
|
||||||
|
|
|
||||||
|
|
@ -226,13 +226,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: true,//设置是否自动订阅所有音频流
|
||||||
|
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
||||||
|
publishMicrophoneTrack: true,//设置是否发布麦克风采集到的音频
|
||||||
|
publishCameraTrack: true,//设置是否发布摄像头采集的视频
|
||||||
|
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
||||||
|
}
|
||||||
);
|
);
|
||||||
await agora.updateChannelMediaOptionsEx(true)
|
// await agora.updateChannelMediaOptionsEx(false)
|
||||||
},
|
},
|
||||||
updateChannelMediaOptionsEx: async (bool: boolean) => {
|
updateChannelMediaOptionsEx: async (bool: boolean) => {
|
||||||
await agora.startCameraCapture()
|
rtcEngine.updateChannelMediaOptionsEx({
|
||||||
await rtcEngine.updateChannelMediaOptionsEx({
|
|
||||||
clientRoleType: bool ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
clientRoleType: bool ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||||
autoSubscribeAudio: false,//设置是否自动订阅所有音频流
|
autoSubscribeAudio: false,//设置是否自动订阅所有音频流
|
||||||
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue