This commit is contained in:
parent
d1dad93ecd
commit
712b3cfed6
|
|
@ -62,10 +62,10 @@ const UserVideo: React.FC = () => {
|
|||
|
||||
useEffect(() => {
|
||||
userList.forEach((item: any) => {
|
||||
agora.setupRemoteVideoJoin({
|
||||
agora.setupRemoteVideoEx({
|
||||
uid: Number('1' + item.screenShareId),
|
||||
view: document.getElementById(`video-${item.screenShareId}`),
|
||||
channelId: state.channelId,
|
||||
channelId: state.channelId + '1',
|
||||
})
|
||||
})
|
||||
}, [userList])
|
||||
|
|
|
|||
|
|
@ -163,6 +163,20 @@ export const agora = {
|
|||
);
|
||||
}
|
||||
},
|
||||
setupRemoteVideoEx: async (item: any) => {
|
||||
if (item.view?.childNodes.length === 1) {
|
||||
await rtcEngine.setupRemoteVideoEx(
|
||||
{
|
||||
renderMode: agora.getRrenderMode(item.uid),
|
||||
sourceType: VideoSourceType.VideoSourceRemote,
|
||||
uid: item.uid,
|
||||
view: item.view,
|
||||
setupMode: VideoViewSetupMode.VideoViewSetupAdd,
|
||||
},
|
||||
{ channelId: item.channelId },
|
||||
);
|
||||
}
|
||||
},
|
||||
// 退出
|
||||
setupRemoteVideo: async (item: any) => {
|
||||
await rtcEngine.setupRemoteVideo(
|
||||
|
|
@ -231,6 +245,7 @@ export const agora = {
|
|||
await agora.updateChannelMediaOptionsEx(false)
|
||||
},
|
||||
updateChannelMediaOptionsEx: async (bool: boolean) => {
|
||||
bool ? agora.startCameraCapture() : agora.stopCameraCapture();
|
||||
rtcEngine.updateChannelMediaOptionsEx({
|
||||
clientRoleType: bool ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||
autoSubscribeAudio: false,//设置是否自动订阅所有音频流
|
||||
|
|
|
|||
Loading…
Reference in New Issue