This commit is contained in:
parent
f6539d30f8
commit
5a30d69cc8
|
|
@ -174,6 +174,7 @@ const Meeting: React.FC = () => {
|
|||
const msgTips = '您不是管理员或发言人,无法开启此功能!'
|
||||
useEffect(() => {
|
||||
let time: NodeJS.Timeout;
|
||||
let getDesktopCapturerVideoTime: NodeJS.Timeout;
|
||||
setUser(userInfo)
|
||||
setTimeout(() => {
|
||||
if (location.hash.indexOf('/login') === -1) {
|
||||
|
|
@ -193,11 +194,28 @@ const Meeting: React.FC = () => {
|
|||
time = setInterval(() => {
|
||||
setCurrentSeconds(currentSeconds++)
|
||||
}, 1000)
|
||||
getDesktopCapturerVideoTime = setInterval(() => {
|
||||
setSharedScreenItem((i: any) => {
|
||||
if (i) {
|
||||
agora.getDesktopCapturerVideo({ width: 0, height: 0 }, { width: 0, height: 0 }, false).then(res => {
|
||||
if (res.length) {
|
||||
let row = res.find((item: any) => item.sourceId === i.sourceId)
|
||||
if (!row) {
|
||||
stopScreenCapture()
|
||||
setSharedScreenItem('')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
return i
|
||||
})
|
||||
}, 3000)
|
||||
return () => {
|
||||
window.removeEventListener('customStorageChange', handleCustomStorageChange);
|
||||
window.removeEventListener('online', handleNetworkChange);
|
||||
window.removeEventListener('offline', handleNetworkChange);
|
||||
clearInterval(time)
|
||||
clearInterval(getDesktopCapturerVideoTime)
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
@ -983,8 +1001,7 @@ const Meeting: React.FC = () => {
|
|||
}
|
||||
// 获取桌面可共享屏幕的引用
|
||||
const getDesktopCapturerVideo = (): void => {
|
||||
agora.getDesktopCapturerVideo().then((res: any) => {
|
||||
if (sharedScreenList.length !== res.length) {
|
||||
agora.getDesktopCapturerVideo({ width: 300, height: 300 }, { width: 300, height: 300 }, true).then((res: any) => {
|
||||
res.forEach((item: any) => {
|
||||
if (item.thumbImage.buffer) {
|
||||
item.thumbnailUrl = thumbImageBufferToBase64(item.thumbImage)
|
||||
|
|
@ -994,7 +1011,6 @@ const Meeting: React.FC = () => {
|
|||
}
|
||||
})
|
||||
setSharedScreenList(res)
|
||||
}
|
||||
})
|
||||
};
|
||||
// 设置全员看谁
|
||||
|
|
|
|||
|
|
@ -287,8 +287,8 @@ export const agora = {
|
|||
}
|
||||
},
|
||||
// 桌面捕获音频和视频的媒体源的信息
|
||||
getDesktopCapturerVideo: async () => {
|
||||
return rtcEngine.getScreenCaptureSources({ width: 300, height: 300 }, { width: 300, height: 300 }, true);
|
||||
getDesktopCapturerVideo: async (thumbSize: any, iconSize: any, includeScreen: boolean) => {
|
||||
return await rtcEngine.getScreenCaptureSources(thumbSize, iconSize, includeScreen);
|
||||
},
|
||||
// 共享屏幕采集
|
||||
setDesktopCapturerVideo: async (targetSource: any, isComputerAudio: boolean, isFluencyPriority: boolean) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue