yangjie #46

Merged
yangqiang merged 15 commits from yangjie into master 2025-01-03 10:43:27 +08:00
5 changed files with 71 additions and 39 deletions
Showing only changes of commit 488724aa62 - Show all commits

View File

@ -610,10 +610,14 @@ app.on('ready', () => {
} }
} }
} else { } else {
if (childWindow[config.key].isVisible()) { if (config.bool) {
childWindow[config.key].hide() childWindow[config.key].hide()
} else { } else {
childWindow[config.key].show() if (childWindow[config.key].isVisible()) {
childWindow[config.key].hide()
} else {
childWindow[config.key].show()
}
} }
} }
}); });

View File

@ -116,8 +116,59 @@ window.electron = {
ipcRenderer.invoke('setRegistry', uuid) ipcRenderer.invoke('setRegistry', uuid)
}, },
// 创建子窗口 // 创建子窗口
createChildWindow: (config) => { createChildWindow: (str) => {
ipcRenderer.invoke('createChildWindow', config) 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) => { closeChildWindow: (key) => {

View File

@ -209,6 +209,7 @@ const Meeting: React.FC = () => {
const channel = new BroadcastChannel('meeting_channel'); const channel = new BroadcastChannel('meeting_channel');
let storeDevice: any; let storeDevice: any;
useEffect(() => { useEffect(() => {
window.electron.createChildWindow('hide')
let time: NodeJS.Timeout; let time: NodeJS.Timeout;
setUser(userInfo) setUser(userInfo)
window.electron.getIsMaximized().then((res: boolean) => { window.electron.getIsMaximized().then((res: boolean) => {
@ -485,6 +486,7 @@ const Meeting: React.FC = () => {
window.removeEventListener('wheel', handleWheelChange); window.removeEventListener('wheel', handleWheelChange);
clearInterval(time) clearInterval(time)
channel.close(); channel.close();
window.electron.closeChildWindow('shareScreenWindow')
}; };
}, []); }, []);
@ -1728,39 +1730,7 @@ const Meeting: React.FC = () => {
const isOpen = await getKeyOpenChildWindow('shareScreenWindow') const isOpen = await getKeyOpenChildWindow('shareScreenWindow')
setIsScreenCapture(true) setIsScreenCapture(true)
if (!isOpen) { if (!isOpen) {
window.electron.createChildWindow({ window.electron.createChildWindow('show')
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',
})
setKeyOpenChildWindow('shareScreenWindow', true) setKeyOpenChildWindow('shareScreenWindow', true)
window.electron.setMainWindowSize({ window.electron.setMainWindowSize({
width: 250, width: 250,
@ -1819,9 +1789,10 @@ const Meeting: React.FC = () => {
const footerListTemplate = [...footerList] const footerListTemplate = [...footerList]
await agora.leaveChannelEx(userInfo.screenShareId) await agora.leaveChannelEx(userInfo.screenShareId)
agora.stopScreenCapture() agora.stopScreenCapture()
await agora.destroyRendererByView()
footerListTemplate[1][0].title = '共享屏幕' footerListTemplate[1][0].title = '共享屏幕'
setFooterList(footerListTemplate) setFooterList(footerListTemplate)
window.electron.closeChildWindow('shareScreenWindow') window.electron.createChildWindow('stop')
setKeyOpenChildWindow('shareScreenWindow', false) setKeyOpenChildWindow('shareScreenWindow', false)
setIsScreenCapture(bool => { setIsScreenCapture(bool => {
if (bool) { if (bool) {

2
src/render.d.ts vendored
View File

@ -29,7 +29,7 @@ export interface IElectronAPI {
isVisible: () => Promise<string>; isVisible: () => Promise<string>;
setRegistry: (uuid: string) => any; setRegistry: (uuid: string) => any;
getRegistry: () => any; getRegistry: () => any;
createChildWindow: (config: any) => void; createChildWindow: (str: string) => void;
setChildWindow: (config: any) => void; setChildWindow: (config: any) => void;
setChildWindowShow: (config: any) => void; setChildWindowShow: (config: any) => void;
closeChildWindow: (key: string) => void; closeChildWindow: (key: string) => void;

View File

@ -385,6 +385,12 @@ export const agora = {
destroyRendererByConfig: async (uid: number, channelId?: string) => { destroyRendererByConfig: async (uid: number, channelId?: string) => {
await rtcEngine.destroyRendererByConfig(VideoSourceType.VideoSourceRemote, channelId, uid); await rtcEngine.destroyRendererByConfig(VideoSourceType.VideoSourceRemote, channelId, uid);
}, },
destroyRendererByView: async () => {
let dom = document.getElementById(`meetingAbsoluteVideo`);
if (dom) {
await rtcEngine.destroyRendererByView(dom);
}
},
// ai降噪 // ai降噪
setAINSMode: async (enabled: boolean, mode: AudioAinsMode) => { setAINSMode: async (enabled: boolean, mode: AudioAinsMode) => {
rtcEngine.setAINSMode(enabled, mode) rtcEngine.setAINSMode(enabled, mode)