From ec5edabaf08e9c73274157e787c2b977cb68e34e Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Fri, 13 Dec 2024 10:27:53 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/Home/Index/index.tsx | 3 +-- src/page/Home/User/index.tsx | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/page/Home/Index/index.tsx b/src/page/Home/Index/index.tsx index 2c3caeb..ae48584 100644 --- a/src/page/Home/Index/index.tsx +++ b/src/page/Home/Index/index.tsx @@ -385,7 +385,6 @@ const Index: React.FC = () => { placeholder="请输入房间号" style={{ flexGrow: 1 }} className={styles.letterSpacing} - showCount maxLength={8} value={createRoomFrom.roomNum} onChange={(e) => { @@ -422,7 +421,6 @@ const Index: React.FC = () => { { @@ -437,6 +435,7 @@ const Index: React.FC = () => { 届: { diff --git a/src/page/Home/User/index.tsx b/src/page/Home/User/index.tsx index b83d7d7..adbac80 100644 --- a/src/page/Home/User/index.tsx +++ b/src/page/Home/User/index.tsx @@ -221,7 +221,7 @@ const User: React.FC = () => { > 删除用户 - +
{ onClick={() => { const file = document.createElement("input") as any; file.type = "file"; - // file.accept = ".xls,.xlsx"; + file.accept = ".xls,.xlsx"; file.onchange = async () => { const setting = await JSON.parse(storage.getItem('setting') as string) const fileInfo = file.files[0]; @@ -669,7 +669,7 @@ const User: React.FC = () => { onClick={() => { const file = document.createElement("input") as any; file.type = "file"; - // file.accept = ".xls,.xlsx"; + file.accept = ".xls,.xlsx"; file.onchange = async () => { const setting = await JSON.parse(storage.getItem('setting') as string) const fileInfo = file.files[0]; @@ -762,12 +762,17 @@ const User: React.FC = () => {
From 8176c9b5d7971543e4aabfa5a6e17f4890ad7d1d Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Fri, 13 Dec 2024 11:44:15 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 9 +++ src/api/Meeting/index.ts | 7 +++ src/components/UserName/index.module.scss | 8 +++ src/components/UserName/index.tsx | 69 +++++++++++++++++++++++ src/page/Meeting/index.tsx | 24 ++++++++ 5 files changed, 117 insertions(+) create mode 100644 src/components/UserName/index.module.scss create mode 100644 src/components/UserName/index.tsx diff --git a/main.js b/main.js index 345ce0f..0415f85 100644 --- a/main.js +++ b/main.js @@ -181,6 +181,7 @@ app.on('ready', () => { connection.off('DriverList'); connection.off('SetDriver'); connection.off('ShowDriverList'); + connection.off('ModifyNickName'); } }); ipcMain.handle('onStop', (event) => { @@ -370,6 +371,14 @@ app.on('ready', () => { driversJsonString }) }); + // 修改用户名称 + connection.on("ModifyNickName", (uid, nickName) => { + mainWindow.webContents.send('onSignalr', { + key: 'ModifyNickName', + uid, + nickName + }) + }); } }); // 放大缩小退出窗口 diff --git a/src/api/Meeting/index.ts b/src/api/Meeting/index.ts index 3733fae..22db4c8 100644 --- a/src/api/Meeting/index.ts +++ b/src/api/Meeting/index.ts @@ -147,4 +147,11 @@ export const PostRoomSingnIn = (data: any) => url: `/room/sign-in`, method: 'post', data + }) + +export const PutAlterUname = (data: any) => + request({ + url: `/room/alter-uname`, + method: 'put', + data }) \ No newline at end of file diff --git a/src/components/UserName/index.module.scss b/src/components/UserName/index.module.scss new file mode 100644 index 0000000..07f2ea1 --- /dev/null +++ b/src/components/UserName/index.module.scss @@ -0,0 +1,8 @@ +.userNameModal { + + .userNameModalFooter { + margin-top: 10px; + display: flex; + justify-content: center; + } +} \ No newline at end of file diff --git a/src/components/UserName/index.tsx b/src/components/UserName/index.tsx new file mode 100644 index 0000000..2f0d030 --- /dev/null +++ b/src/components/UserName/index.tsx @@ -0,0 +1,69 @@ +import { PutAlterUname } from '@/api/Meeting'; +import styles from '@/components/UserName/index.module.scss' +import { storage } from '@/utils'; +import { Button, Input, message, Modal } from 'antd'; +import { useState, useImperativeHandle, forwardRef } from "react"; +const UserName = forwardRef((props: any, ref: any) => { + useImperativeHandle(ref, () => ({ + changeModal: (str: string) => { + setUserName(str) + setUserNameModal(true) + } + })) + const [userNameModal, setUserNameModal] = useState(false); + const [userName, setUserName] = useState(''); + return ( + <> + setUserNameModal(false)} + centered + width={'300px'} + > +
+
+ { + setUserName(e.target.value) + }} + /> +
+
+ + +
+
+
+ + ) +}) + +export default UserName \ No newline at end of file diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index 07c2de6..92d061e 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -24,6 +24,7 @@ import { fixWebmDuration } from "webm-duration-fix-buffer"; import { getKeyOpenChildWindow, setKeyOpenChildWindow } from '@/utils/package/public'; import MeetingDisconnected from '@/components/MeetingDisconnected'; import SingIn from '@/components/SingIn'; +import UserName from '@/components/UserName'; const { setTimeout, setInterval, clearTimeout, clearInterval } = require('timers'); const { confirm } = Modal; const { exec } = require('child_process'); @@ -39,6 +40,7 @@ const Meeting: React.FC = () => { const equipmentManagementRef = useRef(); const meetingDisconnectedRef = useRef(); const singInRef = useRef(); + const userNameRef = useRef(); const [isClicked, setIsClicked] = useState(false); const [statusList, setStatusList] = useState({ userList: false, @@ -855,6 +857,10 @@ const Meeting: React.FC = () => { } } break; + // 修改用户名称 + case 'ModifyNickName': + setAllUserListData('ModifyNickName', item) + break; } }) return () => { @@ -1276,6 +1282,15 @@ const Meeting: React.FC = () => { return res }) break; + case 'ModifyNickName': + setRoomUserList((res: any) => { + let userItem = res.find((row: any) => row.uid === item.uid) + if (userItem) { + userItem.userName = item.nickName + } + return res + }) + break; } changeAgoraDevice() } @@ -2487,6 +2502,14 @@ const Meeting: React.FC = () => { getRoomKickout(state.channelId, item.uid, item.userName) }} >移出会议 + }> @@ -2995,6 +3018,7 @@ const Meeting: React.FC = () => { + ) } From bfd629f26433ba66197d00fa21f1e1c6b016fa7b Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Fri, 13 Dec 2024 12:17:18 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UserName/index.tsx | 23 ++++++++++++++--------- src/page/Meeting/index.tsx | 9 ++++++--- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/components/UserName/index.tsx b/src/components/UserName/index.tsx index 2f0d030..1bc10d7 100644 --- a/src/components/UserName/index.tsx +++ b/src/components/UserName/index.tsx @@ -5,13 +5,16 @@ import { Button, Input, message, Modal } from 'antd'; import { useState, useImperativeHandle, forwardRef } from "react"; const UserName = forwardRef((props: any, ref: any) => { useImperativeHandle(ref, () => ({ - changeModal: (str: string) => { - setUserName(str) + changeModal: (data: any) => { + setInfo(data) setUserNameModal(true) } })) const [userNameModal, setUserNameModal] = useState(false); - const [userName, setUserName] = useState(''); + const [info, setInfo] = useState({ + userName: '', + uid: '' + }); return ( <> { { - setUserName(e.target.value) + setInfo({ + ...info, + userName: e.target.value + }) }} /> @@ -40,12 +46,11 @@ const UserName = forwardRef((props: any, ref: any) => { From 7b7049681a6135f9a9688587ed1cb6e561ad1dfe Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Fri, 13 Dec 2024 12:18:22 +0800 Subject: [PATCH 04/18] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/Meeting/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index e16d663..defc83c 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -2506,6 +2506,7 @@ const Meeting: React.FC = () => { type="primary" className='m-ant-btn' style={{ width: '100%', marginTop: '10px' }} + size={'small'} onClick={() => { userNameRef.current.changeModal({ userName: item.userName, From c557fed280147dfdafc51ccd5e30bf1eca54fb35 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Fri, 13 Dec 2024 13:32:36 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E5=B0=8F=E7=AA=97=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/Meeting/index.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index defc83c..815bf39 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -2344,6 +2344,18 @@ const Meeting: React.FC = () => { getRoomKickout(state.channelId, item.uid, item.userName) }} >移出会议 : null} + {item.uid !== user.uid ? : null} }>
From 631dbf26b1c818fb0ff6857937b025035a02ac5a Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Fri, 13 Dec 2024 13:37:07 +0800 Subject: [PATCH 06/18] =?UTF-8?q?=E5=85=B1=E4=BA=AB=E5=B1=8F=E5=B9=95?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/Meeting/UserListWindow/index.tsx | 15 +++++++++++++++ src/page/Meeting/index.tsx | 1 - 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/page/Meeting/UserListWindow/index.tsx b/src/page/Meeting/UserListWindow/index.tsx index 14fd1d9..1630667 100644 --- a/src/page/Meeting/UserListWindow/index.tsx +++ b/src/page/Meeting/UserListWindow/index.tsx @@ -7,6 +7,7 @@ import Avatar from '@/components/Avatar'; import { useEffect, useState, useRef } from "react"; import { storage } from '@/utils'; import EquipmentManagement from '@/components/EquipmentManagement'; +import UserName from '@/components/UserName'; const { confirm } = Modal; const UserListWindow: React.FC = () => { @@ -14,6 +15,7 @@ const UserListWindow: React.FC = () => { const [user, setUser] = useState({}); const [roomUserList, setRoomUserList] = useState([]) const equipmentManagementRef = useRef(); + const userNameRef = useRef(); const channel = new BroadcastChannel('meeting_channel'); const userInfo = JSON.parse(storage.getItem('user') as string) useEffect(() => { @@ -149,6 +151,18 @@ const UserListWindow: React.FC = () => { }); }} >移出会议 +
}> { }}>全员静音 + { channel.postMessage({ type: 'userListWindowEquipmentManagement', diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index 815bf39..5ff2e42 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -2347,7 +2347,6 @@ const Meeting: React.FC = () => { {item.uid !== user.uid ? + >上传 : null}
@@ -341,7 +353,7 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => { ...fileList, pageIndex: e }) - }} pageSize={fileList.pageSize} current={fileList.pageIndex} hideOnSinglePage={true} showSizeChanger={false}/> + }} pageSize={fileList.pageSize} current={fileList.pageIndex} hideOnSinglePage={true} showSizeChanger={false} />
From 2501267340d632d936526be8bcd5e80d0bf4874d Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Fri, 13 Dec 2024 15:10:39 +0800 Subject: [PATCH 11/18] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b7a531b..ce35f53 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "WGShare.Metting", "private": true, - "version": "0.6.0", + "version": "0.6.3", "main": "main.js", "authors": "yj", "description": "智汇享", From d0387662a6e092a42b573709fa7068eb99351023 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Mon, 16 Dec 2024 14:09:25 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=B1=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/Home/User/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/page/Home/User/index.tsx b/src/page/Home/User/index.tsx index adbac80..e297033 100644 --- a/src/page/Home/User/index.tsx +++ b/src/page/Home/User/index.tsx @@ -415,6 +415,7 @@ const User: React.FC = () => { { const regex = /^[0-9]*$/; if (regex.test(e.target.value)) { From 63914c1fb7a7834aaeb4818a697add59045d8879 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Mon, 16 Dec 2024 14:27:13 +0800 Subject: [PATCH 13/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E4=BC=9A=E8=AE=AE=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/JoinSetting/index.tsx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/JoinSetting/index.tsx b/src/components/JoinSetting/index.tsx index 18065db..e8be5b5 100644 --- a/src/components/JoinSetting/index.tsx +++ b/src/components/JoinSetting/index.tsx @@ -20,18 +20,17 @@ const JoinSetting = forwardRef((_props: any, ref: any) => { if (location.hash.indexOf('/meeting') === -1) { await agora.init() } - setJoinRoomSettingForm((res: any) => { - res.forEach(async (item: any, index: number) => { - if (index === 0 && role.ID.includes(userInfo.roleId)) { - await agora.getAudioMediaList().then(res => { - item.active = res.ecordingList.length ? true : false - }) - } else { - item.active = false - } - }); - return res - }) + const list = [...joinRoomSettingForm] + list.forEach(async (item: any, index: number) => { + if (index === 0 && role.ID.includes(userInfo.roleId)) { + await agora.getAudioMediaList().then(res => { + item.active = res.ecordingList.length ? true : false + }) + } else { + item.active = false + } + }); + setJoinRoomSettingForm(list) setRoomNumber(roomNum) getDeviceList() } From e5ca4e6f3ac31924148cbdaa107b04453037683a Mon Sep 17 00:00:00 2001 From: youngq Date: Mon, 16 Dec 2024 16:49:46 +0800 Subject: [PATCH 14/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BF=E5=90=8D?= =?UTF-8?q?=E5=85=A5=E4=BC=9A=E4=B8=BA=E6=B8=B8=E5=AE=A2=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/Home/Index/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/page/Home/Index/index.tsx b/src/page/Home/Index/index.tsx index b970642..270763b 100644 --- a/src/page/Home/Index/index.tsx +++ b/src/page/Home/Index/index.tsx @@ -465,7 +465,7 @@ const Index: React.FC = () => { }} />
- 匿名入会: + 游客入会: { setAllowAnonymous(e.target.value); }} value={allowAnonymous}> From bc78d3a692e29e89d51c94b45f906febb3ae374a Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Tue, 17 Dec 2024 11:14:42 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SharedFilesModel/index.tsx | 31 ++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/components/SharedFilesModel/index.tsx b/src/components/SharedFilesModel/index.tsx index 063161c..8a314a8 100644 --- a/src/components/SharedFilesModel/index.tsx +++ b/src/components/SharedFilesModel/index.tsx @@ -100,10 +100,10 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
} - onChange={(e) => { + onPressEnter={(e: any) => { if (fileList.pageIndex === 1) { setFileList({ ...fileList, @@ -116,8 +116,30 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => { pageIndex: 1 }) } - }} + onBlur={(e) => { + if (fileList.pageIndex === 1) { + setFileList({ + ...fileList, + keyword: e.target.value, + }) + } else { + setFileList({ + ...fileList, + keyword: e.target.value, + pageIndex: 1 + }) + } + }} + suffix={ + { + getRoomFile() + }} + >搜索 + + } /> { if (fileList.pageIndex === 1) { @@ -273,6 +295,7 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => { { + storage.setItem('loading', true) GetRoomFileDwUrl(item.fileUrl, item.id).then(res => { if (res.code === 200) { axios({ @@ -341,6 +364,8 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => { }, 2000) }) } + }).finally(() => { + storage.setItem('loading', false) }) }} /> {/* */} From 12eaca27f96937a25e012de146c4951a28d21e3a Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Tue, 17 Dec 2024 14:05:56 +0800 Subject: [PATCH 16/18] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SharedFilesModel/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SharedFilesModel/index.tsx b/src/components/SharedFilesModel/index.tsx index 8a314a8..9b065de 100644 --- a/src/components/SharedFilesModel/index.tsx +++ b/src/components/SharedFilesModel/index.tsx @@ -292,7 +292,7 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => { /> ( <> - { storage.setItem('loading', true) @@ -367,7 +367,7 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => { }).finally(() => { storage.setItem('loading', false) }) - }} /> + }} /> : null} {/* */} )} /> From 3df6dc6add37d38803d2176c64d2822af26c0fb1 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Tue, 17 Dec 2024 14:47:57 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SharedFilesModel/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/SharedFilesModel/index.tsx b/src/components/SharedFilesModel/index.tsx index 9b065de..2eb8029 100644 --- a/src/components/SharedFilesModel/index.tsx +++ b/src/components/SharedFilesModel/index.tsx @@ -1,6 +1,7 @@ import styles from '@/components/SharedFilesModel/index.module.scss' import { DeleteOutlined, + LoadingOutlined, ProfileOutlined, ReloadOutlined, SearchOutlined, @@ -367,7 +368,7 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => { }).finally(() => { storage.setItem('loading', false) }) - }} /> : null} + }} /> : } {/* */} )} /> From d867305ca4a161f75794e24944f42694ff7b1ee6 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Tue, 17 Dec 2024 15:08:20 +0800 Subject: [PATCH 18/18] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E5=BD=95=E5=88=B6?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/Meeting/index.tsx | 122 ++++++++++++++++++++++--------------- 1 file changed, 72 insertions(+), 50 deletions(-) diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index 5ff2e42..ccf0a00 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -42,6 +42,7 @@ const Meeting: React.FC = () => { const singInRef = useRef(); const userNameRef = useRef(); const [isClicked, setIsClicked] = useState(false); + const [isClickedMediaSteam, setIsClickedMediaSteam] = useState(false); const [statusList, setStatusList] = useState({ userList: false, userChatList: false, @@ -433,7 +434,7 @@ const Meeting: React.FC = () => { setTimeout(async () => { const setting = await JSON.parse(storage.getItem('setting') as string); const stateInfo = await JSON.parse(storage.getItem('stateInfo') as string); - if (stateInfo && setting.isRecordingTips) { + if (stateInfo && setting.isRecordingTips && location.href.indexOf('/meeting') !== -1) { setRecorder((data: any) => { if (!data) { setIsScreenCapture(bool => { @@ -918,6 +919,18 @@ const Meeting: React.FC = () => { return () => clearTimeout(timer); }, [isClicked]); + useEffect(() => { + let timer: NodeJS.Timeout; + + if (isClickedMediaSteam) { + timer = setTimeout(() => { + setIsClickedMediaSteam(false) + }, 3000); + } + + return () => clearTimeout(timer); + }, [isClickedMediaSteam]); + useEffect(() => { const elements = document.querySelectorAll('.intersectionObserver-view'); if (elements.length && currentVideoId) { @@ -1521,52 +1534,57 @@ const Meeting: React.FC = () => { case '录制': const setting = await JSON.parse(storage.getItem('setting') as string); try { - await fs.access(setting.recordingFilesPath, fs.constants.F_OK); - footerListTemplate[itemIndex][rowIndex].title = '录制中'; - footerListTemplate[itemIndex][rowIndex].active = true; - setFooterList(footerListTemplate); - window.electron.getSources().then(async (sources: any) => { - const screenId = sources[0].id; - const stream = await navigator.mediaDevices.getUserMedia({ - audio: { - mandatory: { - chromeMediaSource: 'desktop', - chromeMediaSourceId: screenId, - } - } as any, - video: { - mandatory: { - chromeMediaSource: 'desktop', - chromeMediaSourceId: screenId, - } - } as any + if (!isClickedMediaSteam) { + setIsClickedMediaSteam(true) + await fs.access(setting.recordingFilesPath, fs.constants.F_OK); + footerListTemplate[itemIndex][rowIndex].title = '录制中'; + footerListTemplate[itemIndex][rowIndex].active = true; + setFooterList(footerListTemplate); + window.electron.getSources().then(async (sources: any) => { + const screenId = sources[0].id; + const stream = await navigator.mediaDevices.getUserMedia({ + audio: { + mandatory: { + chromeMediaSource: 'desktop', + chromeMediaSourceId: screenId, + } + } as any, + video: { + mandatory: { + chromeMediaSource: 'desktop', + chromeMediaSourceId: screenId, + } + } as any + }); + // 获取所有音频输入设备 + const devices = await navigator.mediaDevices.enumerateDevices(); + const audioInputDevices = devices.filter(device => device.kind === 'audioinput' && + device.deviceId !== 'default' && + device.deviceId !== 'communications'); + // 使用Web Audio API来捕获系统声音和麦克风声音,将它们合并到同一个MediaStream中。 + const audioCtx = new (window.AudioContext || (window as any).webkitAudioContext)(); + const systemSoundSource = audioCtx.createMediaStreamSource(stream); + const systemSoundDestination = audioCtx.createMediaStreamDestination(); + systemSoundSource.connect(systemSoundDestination); + // 录制所有音频输入设备 + audioInputDevices.forEach(async device => { + const micStream = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: { exact: device.deviceId } } }); + setMediaStream((res: any) => [...res, micStream]); + const micSoundSource = audioCtx.createMediaStreamSource(micStream); + micSoundSource.connect(systemSoundDestination); + }) + // 合并音频流与视频流 + const combinedSource = new MediaStream([...stream.getVideoTracks(), ...systemSoundDestination.stream.getAudioTracks()]); + // 开始录制 + const mediaRecorder = new MediaRecorder(combinedSource, { + mimeType: 'video/webm;codecs=vp9,opus', + videoBitsPerSecond: 1.5e6, + }); + setRecorder(mediaRecorder); }); - // 获取所有音频输入设备 - const devices = await navigator.mediaDevices.enumerateDevices(); - const audioInputDevices = devices.filter(device => device.kind === 'audioinput' && - device.deviceId !== 'default' && - device.deviceId !== 'communications'); - // 使用Web Audio API来捕获系统声音和麦克风声音,将它们合并到同一个MediaStream中。 - const audioCtx = new (window.AudioContext || (window as any).webkitAudioContext)(); - const systemSoundSource = audioCtx.createMediaStreamSource(stream); - const systemSoundDestination = audioCtx.createMediaStreamDestination(); - systemSoundSource.connect(systemSoundDestination); - // 录制所有音频输入设备 - audioInputDevices.forEach(async device => { - const micStream = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: { exact: device.deviceId } } }); - setMediaStream((res: any) => [...res, micStream]); - const micSoundSource = audioCtx.createMediaStreamSource(micStream); - micSoundSource.connect(systemSoundDestination); - }) - // 合并音频流与视频流 - const combinedSource = new MediaStream([...stream.getVideoTracks(), ...systemSoundDestination.stream.getAudioTracks()]); - // 开始录制 - const mediaRecorder = new MediaRecorder(combinedSource, { - mimeType: 'video/webm;codecs=vp9,opus', - videoBitsPerSecond: 1.5e6, - }); - setRecorder(mediaRecorder); - }); + } else { + message.error('录制太频繁了,请稍后重试!'); + } } catch (error: any) { if (error.code === 'ENOENT') { message.error({ @@ -1582,10 +1600,14 @@ const Meeting: React.FC = () => { break; case '录制中': - footerListTemplate[itemIndex][rowIndex].title = '录制' - footerListTemplate[itemIndex][rowIndex].active = false - setFooterList(footerListTemplate) - stopRecorderMedia() + if (isClickedMediaSteam) { + message.error('录制时长不足3秒,请稍后重试!'); + } else { + footerListTemplate[itemIndex][rowIndex].title = '录制' + footerListTemplate[itemIndex][rowIndex].active = false + setFooterList(footerListTemplate) + stopRecorderMedia() + } break; case '共享文件': sharedFilesModelRef.current.getData()