This commit is contained in:
parent
d2d20d3efd
commit
488724aa62
8
main.js
8
main.js
|
|
@ -610,10 +610,14 @@ app.on('ready', () => {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (childWindow[config.key].isVisible()) {
|
||||
if (config.bool) {
|
||||
childWindow[config.key].hide()
|
||||
} else {
|
||||
childWindow[config.key].show()
|
||||
if (childWindow[config.key].isVisible()) {
|
||||
childWindow[config.key].hide()
|
||||
} else {
|
||||
childWindow[config.key].show()
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
55
preload.js
55
preload.js
|
|
@ -116,8 +116,59 @@ window.electron = {
|
|||
ipcRenderer.invoke('setRegistry', uuid)
|
||||
},
|
||||
// 创建子窗口
|
||||
createChildWindow: (config) => {
|
||||
ipcRenderer.invoke('createChildWindow', config)
|
||||
createChildWindow: (str) => {
|
||||
switch (str) {
|
||||
case 'show':
|
||||
ipcRenderer.invoke('setChildWindowShow', {
|
||||
key: 'shareScreenWindow',
|
||||
})
|
||||
ipcRenderer.invoke('setChildWindowShow', {
|
||||
key: 'chatSmallWindow',
|
||||
})
|
||||
break;
|
||||
case 'hide':
|
||||
ipcRenderer.invoke('createChildWindow', {
|
||||
url: location.origin + `/#/noticeWindow`,
|
||||
width: 388,
|
||||
height: 150,
|
||||
key: 'noticeWindow',
|
||||
})
|
||||
ipcRenderer.invoke('createChildWindow', {
|
||||
url: location.origin + `/#/shareScreenWindow`,
|
||||
width: 400,
|
||||
height: 80,
|
||||
key: 'shareScreenWindow',
|
||||
})
|
||||
ipcRenderer.invoke('createChildWindow', {
|
||||
url: location.origin + `/#/chatSmallWindow`,
|
||||
width: 200,
|
||||
height: 150,
|
||||
key: 'chatSmallWindow',
|
||||
})
|
||||
ipcRenderer.invoke('createChildWindow', {
|
||||
url: location.origin + `/#/chatBigWindow`,
|
||||
width: 540,
|
||||
height: 640,
|
||||
key: 'chatBigWindow',
|
||||
})
|
||||
ipcRenderer.invoke('createChildWindow', {
|
||||
url: location.origin + `/#/userListWindow`,
|
||||
width: 440,
|
||||
height: 540,
|
||||
key: 'userListWindow',
|
||||
})
|
||||
break;
|
||||
case 'stop':
|
||||
ipcRenderer.invoke('setChildWindowShow', {
|
||||
key: 'shareScreenWindow',
|
||||
bool: true
|
||||
})
|
||||
ipcRenderer.invoke('setChildWindowShow', {
|
||||
key: 'chatSmallWindow',
|
||||
bool: true
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
// 关闭子窗口
|
||||
closeChildWindow: (key) => {
|
||||
|
|
|
|||
|
|
@ -209,6 +209,7 @@ const Meeting: React.FC = () => {
|
|||
const channel = new BroadcastChannel('meeting_channel');
|
||||
let storeDevice: any;
|
||||
useEffect(() => {
|
||||
window.electron.createChildWindow('hide')
|
||||
let time: NodeJS.Timeout;
|
||||
setUser(userInfo)
|
||||
window.electron.getIsMaximized().then((res: boolean) => {
|
||||
|
|
@ -485,6 +486,7 @@ const Meeting: React.FC = () => {
|
|||
window.removeEventListener('wheel', handleWheelChange);
|
||||
clearInterval(time)
|
||||
channel.close();
|
||||
window.electron.closeChildWindow('shareScreenWindow')
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
@ -1728,39 +1730,7 @@ const Meeting: React.FC = () => {
|
|||
const isOpen = await getKeyOpenChildWindow('shareScreenWindow')
|
||||
setIsScreenCapture(true)
|
||||
if (!isOpen) {
|
||||
window.electron.createChildWindow({
|
||||
url: location.origin + `/#/noticeWindow`,
|
||||
width: 388,
|
||||
height: 150,
|
||||
key: 'noticeWindow',
|
||||
show: true,
|
||||
})
|
||||
window.electron.createChildWindow({
|
||||
url: location.origin + `/#/shareScreenWindow`,
|
||||
width: 400,
|
||||
height: 80,
|
||||
key: 'shareScreenWindow',
|
||||
show: true,
|
||||
})
|
||||
window.electron.createChildWindow({
|
||||
url: location.origin + `/#/chatSmallWindow`,
|
||||
width: 200,
|
||||
height: 150,
|
||||
key: 'chatSmallWindow',
|
||||
show: true,
|
||||
})
|
||||
window.electron.createChildWindow({
|
||||
url: location.origin + `/#/chatBigWindow`,
|
||||
width: 540,
|
||||
height: 640,
|
||||
key: 'chatBigWindow',
|
||||
})
|
||||
window.electron.createChildWindow({
|
||||
url: location.origin + `/#/userListWindow`,
|
||||
width: 440,
|
||||
height: 540,
|
||||
key: 'userListWindow',
|
||||
})
|
||||
window.electron.createChildWindow('show')
|
||||
setKeyOpenChildWindow('shareScreenWindow', true)
|
||||
window.electron.setMainWindowSize({
|
||||
width: 250,
|
||||
|
|
@ -1819,9 +1789,10 @@ const Meeting: React.FC = () => {
|
|||
const footerListTemplate = [...footerList]
|
||||
await agora.leaveChannelEx(userInfo.screenShareId)
|
||||
agora.stopScreenCapture()
|
||||
await agora.destroyRendererByView()
|
||||
footerListTemplate[1][0].title = '共享屏幕'
|
||||
setFooterList(footerListTemplate)
|
||||
window.electron.closeChildWindow('shareScreenWindow')
|
||||
window.electron.createChildWindow('stop')
|
||||
setKeyOpenChildWindow('shareScreenWindow', false)
|
||||
setIsScreenCapture(bool => {
|
||||
if (bool) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export interface IElectronAPI {
|
|||
isVisible: () => Promise<string>;
|
||||
setRegistry: (uuid: string) => any;
|
||||
getRegistry: () => any;
|
||||
createChildWindow: (config: any) => void;
|
||||
createChildWindow: (str: string) => void;
|
||||
setChildWindow: (config: any) => void;
|
||||
setChildWindowShow: (config: any) => void;
|
||||
closeChildWindow: (key: string) => void;
|
||||
|
|
|
|||
|
|
@ -385,6 +385,12 @@ export const agora = {
|
|||
destroyRendererByConfig: async (uid: number, channelId?: string) => {
|
||||
await rtcEngine.destroyRendererByConfig(VideoSourceType.VideoSourceRemote, channelId, uid);
|
||||
},
|
||||
destroyRendererByView: async () => {
|
||||
let dom = document.getElementById(`meetingAbsoluteVideo`);
|
||||
if (dom) {
|
||||
await rtcEngine.destroyRendererByView(dom);
|
||||
}
|
||||
},
|
||||
// ai降噪
|
||||
setAINSMode: async (enabled: boolean, mode: AudioAinsMode) => {
|
||||
rtcEngine.setAINSMode(enabled, mode)
|
||||
|
|
|
|||
Loading…
Reference in New Issue