diff --git a/src/App.tsx b/src/App.tsx index 229e5a4..f77582f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,25 +1,25 @@ -import {useEffect, useRef, useState} from "react"; +import { useEffect, useRef, useState } from "react"; import '@/utils/styles/App.scss' -import {Navigate, Route, Routes, useLocation, useNavigate} from 'react-router-dom'; +import { Navigate, Route, Routes, useLocation, useNavigate } from 'react-router-dom'; import Home from '@/page/Home/index' import Index from '@/page/Home/Index/index' import User from '@/page/Home/User/index' import Login from '@/page/Login/index' import Meeting from '@/page/Meeting/index' import NotFound from '@/page/NotFound/index' -import {storage} from '@/utils' -import {message, Spin} from "antd"; -import {onInvitation, onInvoke, onReconnected, onStart, startSignalr} from "@/utils/package/signalr"; +import { storage } from '@/utils' +import { message, Spin } from "antd"; +import { onInvitation, onInvoke, onReconnected, onStart, startSignalr } from "@/utils/package/signalr"; import JoinMeetingModal from "@/components/JoinMeetingModal"; import UpdateModal from "@/components/UpdateModal"; import * as CryptoJS from 'crypto-js'; -import {PostLogin} from "@/api/Login"; +import { PostLogin } from "@/api/Login"; import agora from "@/utils/package/agora"; import QuitTips from "@/components/QuitTips"; const App: React.FC = () => { const navigate = useNavigate(); - const {state} = useLocation(); + const { state } = useLocation(); const joinMeetingModalRef = useRef(); const updateModalRef = useRef(); const quitTipsRef = useRef(); @@ -120,9 +120,22 @@ const App: React.FC = () => { onReconnected(async () => { storage.setItem('reconnect', true) }) - window.electron.onUpdate((e: any, data: any) => { + window.electron.onUpdate((_e: any, data: any) => { updateModalRef.current.changeModal(data) }) + if (!storage.getItem('setting')) { + storage.setItem('setting', JSON.stringify({ + videoDeviceId: '', //摄像头id + ecordingDeviceId: "", //输入设备id + playBackDeviceId: "", //输出设备id + ecordingVolume: '', //输入音量 + playBackVolume: '', //输出音量 + autoEcordingVolume: false, //是否自动调整麦克风音量 + recordingFilesPath: '', //本地录制保存路径 + shareFilesPath: '', //共享文件保存路径 + isShareSavePath: false, //是否下载钱询问每个文件保存的位置 + })) + } }, []) useEffect(() => { if (isState) { @@ -173,20 +186,20 @@ const App: React.FC = () => { return ( <> - }/> - }> - }/> - }/> - }/> + } /> + }> + } /> + } /> + } /> - }/> - }/> - }/> + } /> + } /> + } /> - - - - + + + + ) } diff --git a/src/components/StupWizard/index.tsx b/src/components/StupWizard/index.tsx index 53dda2f..52054a5 100644 --- a/src/components/StupWizard/index.tsx +++ b/src/components/StupWizard/index.tsx @@ -1,6 +1,6 @@ import styles from '@/components/StupWizard/index.module.scss' import ImageUrl from '@/utils/package/ImageUrl'; -import { Button, Checkbox, Empty, Input, message, Modal, Select, Slider } from 'antd'; +import { Button, Checkbox, Empty, Input, Modal, Select, Slider } from 'antd'; import { useState, useImperativeHandle, forwardRef, useEffect } from "react"; import agora from '@/utils/package/agora' import { CloseOutlined, LoadingOutlined } from '@ant-design/icons'; @@ -101,9 +101,17 @@ const VideoComponents = () => { useEffect(() => { getVideoDeviceList() }, []); - const getVideoDeviceList = (): void => { + const getVideoDeviceList = async (): Promise => { + const setting = await JSON.parse(storage.getItem('setting') as string) agora.getVideoDeviceManager().then(async (res) => { const { item, list } = res + if ((!setting.videoDeviceId && item) || (!(list.find((item: any) => item.deviceId === setting.videoDeviceId)) && item)) { + setting.videoDeviceId = item + } + if (!list.length) { + setting.videoDeviceId = '' + } + storage.setItem('setting', JSON.stringify(setting)) setVideoDeviceManager({ list: list.map((row: any) => { return { @@ -111,10 +119,11 @@ const VideoComponents = () => { label: row.deviceName } }), - item: item ? item : null, + item: setting.videoDeviceId ? setting.videoDeviceId : item || null, }) - if (item) { - agora.startPreview('videoPreview', Number(userInfo.account)) + if (setting.videoDeviceId && list.length) { + await agora.setVideoDeviceManager(setting.videoDeviceId) + await agora.startPreview('videoPreview', Number(userInfo.account)) } }) } @@ -136,14 +145,21 @@ const VideoComponents = () => { }} /> : -
+
+
+ +
+
}
摄像头: