yangjie #22
20
main.js
20
main.js
|
|
@ -52,26 +52,6 @@ class AppWindow extends BrowserWindow {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
function showWindow() {
|
||||
// 如果主窗口已经存在但被最小化了,则恢复显示
|
||||
if (mainWindow && mainWindow.isMinimized()) {
|
||||
mainWindow.show();
|
||||
console.log(3);
|
||||
}
|
||||
// 如果主窗口已存在但不是焦点窗口,则将其置为焦点
|
||||
if (mainWindow && !mainWindow.isFocused()) {
|
||||
console.log(2);
|
||||
mainWindow.show();
|
||||
mainWindow.focus();
|
||||
}
|
||||
// 如果主窗口还没有被创建,则创建它
|
||||
if (!mainWindow) {
|
||||
console.log(1);
|
||||
createWindow();
|
||||
}
|
||||
}
|
||||
|
||||
function quit() {
|
||||
app.quit()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import { agora } from '@/utils/package/agora'
|
|||
import { onInvoke, onSignalr, offSignalr } from '@/utils/package/signalr';
|
||||
import dayjs from 'dayjs';
|
||||
import durationPlugin from 'dayjs/plugin/duration';
|
||||
import { AudioVolumeInfo, ConnectionChangedReasonType, ConnectionStateType, QualityType, RtcConnection, RtcStats, UserOfflineReasonType, VideoSourceType, VideoStreamType } from 'agora-electron-sdk';
|
||||
import { AudioVolumeInfo, ConnectionChangedReasonType, ConnectionStateType, LocalVideoStreamReason, LocalVideoStreamState, QualityType, RtcConnection, RtcStats, UserOfflineReasonType, VideoSourceType, VideoStreamType } from 'agora-electron-sdk';
|
||||
import Avatar from '@/components/Avatar';
|
||||
import SharedFilesModel from '@/components/SharedFilesModel';
|
||||
import StupWizard from '@/components/StupWizard';
|
||||
|
|
@ -190,7 +190,6 @@ const Meeting: React.FC = () => {
|
|||
const channel = new BroadcastChannel('meeting_channel');
|
||||
useEffect(() => {
|
||||
let time: NodeJS.Timeout;
|
||||
let getDesktopCapturerVideoTime: NodeJS.Timeout;
|
||||
setUser(userInfo)
|
||||
window.electron.getIsMaximized().then((res: boolean) => {
|
||||
if (!res) {
|
||||
|
|
@ -227,7 +226,7 @@ const Meeting: React.FC = () => {
|
|||
} = event.data;
|
||||
switch (type) {
|
||||
case 'shareScreenWindowGetTime':
|
||||
setCurrentSeconds((res=>{
|
||||
setCurrentSeconds((res => {
|
||||
channel.postMessage({
|
||||
type: 'time',
|
||||
time: res,
|
||||
|
|
@ -395,28 +394,10 @@ const Meeting: React.FC = () => {
|
|||
})
|
||||
}
|
||||
}, 10000);
|
||||
getDesktopCapturerVideoTime = setInterval(() => {
|
||||
setSharedScreenItem((i: any) => {
|
||||
if (i && i.type === 0) {
|
||||
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('')
|
||||
allUserLook(userInfo.uid, userInfo.userName)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
return i
|
||||
})
|
||||
}, 3000)
|
||||
return () => {
|
||||
window.removeEventListener('customStorageChange', handleCustomStorageChange);
|
||||
window.removeEventListener('wheel', handleWheelChange);
|
||||
clearInterval(time)
|
||||
clearInterval(getDesktopCapturerVideoTime)
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
@ -1023,6 +1004,13 @@ const Meeting: React.FC = () => {
|
|||
message.error('网络断开,请检查网络')
|
||||
}
|
||||
},
|
||||
onLocalVideoStateChanged: async (source: VideoSourceType, _state: LocalVideoStreamState, reason: LocalVideoStreamReason) => {
|
||||
if (source === 2 && reason === 12) {
|
||||
stopScreenCapture()
|
||||
setSharedScreenItem('')
|
||||
allUserLook(userInfo.uid, userInfo.userName)
|
||||
}
|
||||
}
|
||||
})
|
||||
if (state.enableCamera) {
|
||||
await agora.startCameraCapture()
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ import {
|
|||
AudioVolumeInfo,
|
||||
UserOfflineReasonType,
|
||||
ConnectionStateType,
|
||||
ConnectionChangedReasonType
|
||||
ConnectionChangedReasonType,
|
||||
LocalVideoStreamReason,
|
||||
LocalVideoStreamState
|
||||
} from "agora-electron-sdk";
|
||||
import { GetRoomRtcToken, GetAgoraConf } from "@/api/Home/Index";
|
||||
import { storage } from '@/utils';
|
||||
|
|
@ -111,7 +113,7 @@ export const agora = {
|
|||
}, 1000);
|
||||
},
|
||||
// 事件回调
|
||||
registerEventHandler: ({ onJoinChannelSuccess, onUserJoined, onUserOffline, onAudioVolumeIndication, onNetworkQuality, onRtcStats, onConnectionStateChanged }: any) => {
|
||||
registerEventHandler: ({ onJoinChannelSuccess, onUserJoined, onUserOffline, onAudioVolumeIndication, onNetworkQuality, onRtcStats, onConnectionStateChanged, onLocalVideoStateChanged }: any) => {
|
||||
rtcEngine.registerEventHandler({
|
||||
// 监听本地用户加入频道事件
|
||||
onJoinChannelSuccess: async (connection: RtcConnection, elapsed: number) => {
|
||||
|
|
@ -153,6 +155,10 @@ export const agora = {
|
|||
onConnectionStateChanged: async (connection: RtcConnection, state: ConnectionStateType, reason: ConnectionChangedReasonType) => {
|
||||
await onConnectionStateChanged?.(connection, state, reason)
|
||||
},
|
||||
// 本地视频状态发生改变回调。
|
||||
onLocalVideoStateChanged: async (source: VideoSourceType, state: LocalVideoStreamState, reason: LocalVideoStreamReason) => {
|
||||
await onLocalVideoStateChanged?.(source, state, reason)
|
||||
},
|
||||
});
|
||||
},
|
||||
// 获取视图模式
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ export default defineConfig({
|
|||
AudioVolumeInfo,
|
||||
UserOfflineReasonType,
|
||||
ConnectionStateType,
|
||||
ConnectionChangedReasonType
|
||||
ConnectionChangedReasonType,
|
||||
LocalVideoStreamState,
|
||||
LocalVideoStreamReason
|
||||
} = require("agora-electron-sdk")
|
||||
export {
|
||||
createAgoraRtcEngine,
|
||||
|
|
@ -89,7 +91,9 @@ export default defineConfig({
|
|||
AudioVolumeInfo,
|
||||
UserOfflineReasonType,
|
||||
ConnectionStateType,
|
||||
ConnectionChangedReasonType
|
||||
ConnectionChangedReasonType,
|
||||
LocalVideoStreamState,
|
||||
LocalVideoStreamReason
|
||||
}
|
||||
`,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue