This commit is contained in:
yj 2024-08-07 10:32:51 +08:00
parent aa17766689
commit 9015bba961
2 changed files with 20 additions and 20 deletions

View File

@ -161,6 +161,14 @@ const Meeting: React.FC = () => {
})
view.setAttribute('load', 'true')
}
if (String(remoteUid).length === 9) {
console.log(String(remoteUid));
await agora.setupRemoteVideoJoin({
uid: Number(remoteUid),
view: document.getElementById(`look-video`) as HTMLElement,
channelId: info.channelId,
})
}
}, 1000);
},
onUserOffline: async (info: any, remoteUid: any, _reason: any) => {
@ -169,14 +177,6 @@ const Meeting: React.FC = () => {
view: document.getElementById(`video-${remoteUid}`) as HTMLElement,
channelId: info.channelId,
})
if (String(info.localUid).length === 9) {
await agora.setupRemoteVideo({
uid: Number(remoteUid),
view: document.getElementById(`look-video`) as HTMLElement,
channelId: info.channelId,
sourceType: VideoSourceType.VideoSourceScreen,
})
}
setTimeout(() => {
getRoomUser()
}, 1000);

View File

@ -179,18 +179,6 @@ const agora = {
// await rtcEngine.stopCameraCapture(option.sourceType)
const user = JSON.parse(storage.getItem('user') as string)
rtcEngine.destroyRendererByConfig(VideoSourceType.VideoSourceScreen, option.channelId, Number(user.screenShareId))
rtcEngine.joinChannelEx(
option.token,
{ channelId: option.channelId, localUid: Number(user.screenShareId) },
{
autoSubscribeAudio: false,
autoSubscribeVideo: false,
publishMicrophoneTrack: false,
publishCameraTrack: false,
clientRoleType: ClientRoleType.ClientRoleBroadcaster,
publishScreenTrack: true,
}
);
agora.stopScreenCapture();
if (
targetSource.type ===
@ -216,6 +204,18 @@ const agora = {
}
);
}
rtcEngine.joinChannelEx(
option.token,
{ channelId: option.channelId, localUid: Number(user.screenShareId) },
{
autoSubscribeAudio: false,
autoSubscribeVideo: false,
publishMicrophoneTrack: false,
publishCameraTrack: false,
clientRoleType: ClientRoleType.ClientRoleBroadcaster,
publishScreenTrack: true,
}
);
},
// 停止录制音视频
stopRecording: () => {