共享屏幕在未观看时不接流

This commit is contained in:
yj 2024-09-10 13:50:46 +08:00
parent 0702536b3c
commit 96d17e21a0
2 changed files with 21 additions and 2 deletions

View File

@ -260,6 +260,19 @@ const Meeting: React.FC = () => {
});
}, [currentVideoId, roomUserList]);
useEffect(() => {
let item = roomUserList.find((item: any) => currentVideoId == item.uid)
if (item) {
if (isShare) {
if (Number(item.screenShareId) === Number(isShare)) {
agora.muteRemoteAudioStream(Number(isShare), false)
} else {
agora.muteRemoteAudioStream(Number(isShare), true)
}
}
}
}, [currentVideoId, isShare]);
useEffect(() => {
onSignalr(async (item: any) => {
const setting = JSON.parse(storage.getItem('setting') as string)
@ -1082,7 +1095,8 @@ const Meeting: React.FC = () => {
// 获取桌面可共享屏幕的引用
const getDesktopCapturerVideo = (): void => {
agora.getDesktopCapturerVideo({ width: 300, height: 300 }, { width: 300, height: 300 }, true).then((res: any) => {
res.forEach((item: any) => {
res.forEach((item: any, index: number) => {
item.sourceTitle = '桌面' + (index + 1)
if (item.thumbImage.buffer) {
item.thumbnailUrl = thumbImageBufferToBase64(item.thumbImage)
}

View File

@ -291,8 +291,13 @@ export const agora = {
await agora.stopCameraCapture();
await rtcEngine.leaveChannelEx({ channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) })
},
// 取消或恢复订阅指定远端用户的音频流
muteRemoteAudioStream: async (uid: number, mute: boolean) => {
rtcEngine.muteRemoteAudioStream(uid, mute)
},
// 销毁视频渲染dom
destroyRendererByConfig: async (uid: number) => {
rtcEngine.destroyRendererByConfig(VideoSourceType.VideoSourceRemote, option.channelId + 'a', uid);
await rtcEngine.destroyRendererByConfig(VideoSourceType.VideoSourceRemote, option.channelId + 'a', uid);
},
// ai降噪
setAINSMode: async (enabled: boolean, mode: AudioAinsMode) => {