优化引入
This commit is contained in:
parent
87392a2585
commit
d7a3dcda63
|
|
@ -17,6 +17,7 @@
|
|||
"crypto-js": "^4.2.0",
|
||||
"dayjs": "^1.11.11",
|
||||
"electron-squirrel-startup": "^1.0.1",
|
||||
"os": "^0.1.2",
|
||||
"path": "^0.12.7",
|
||||
"postcss-px-to-viewport-8-plugin": "^1.2.5",
|
||||
"react": "^18.3.1",
|
||||
|
|
@ -41,7 +42,8 @@
|
|||
"cross-env": "^7.0.3",
|
||||
"electron": "^23.3.13",
|
||||
"typescript": "^4.5.4",
|
||||
"vite": "^2.8.0"
|
||||
"vite": "^2.8.0",
|
||||
"vite-plugin-resolve": "^2.5.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
|
|
@ -9012,6 +9014,12 @@
|
|||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/lib-esm": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmmirror.com/lib-esm/-/lib-esm-0.4.2.tgz",
|
||||
"integrity": "sha512-VGqaEGuryUbT7FLGxXg46nrSzkhLzyk+JQjYoYEORH5UtdIu3yf6DCOqh65FOR3bWOHHGINQH/vR5YGGIFBgJw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/liftoff": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/liftoff/-/liftoff-3.1.0.tgz",
|
||||
|
|
@ -10311,6 +10319,11 @@
|
|||
"readable-stream": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/os": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/os/-/os-0.1.2.tgz",
|
||||
"integrity": "sha512-ZoXJkvAnljwvc56MbvhtKVWmSkzV712k42Is2mA0+0KTSRakq5XXuXpjZjgAt9ctzl51ojhQWakQQpmOvXWfjQ=="
|
||||
},
|
||||
"node_modules/os-locale": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/os-locale/-/os-locale-1.4.0.tgz",
|
||||
|
|
@ -14130,6 +14143,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-resolve": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmmirror.com/vite-plugin-resolve/-/vite-plugin-resolve-2.5.1.tgz",
|
||||
"integrity": "sha512-9dD0Yq5JT1RxHQGZOyhC7e/JlhyhMCftCpQ8TPzQa7KEB/3ERnoCPinH3VJk/0C8qHsA+l41bIcHh5BcHBTmAw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"lib-esm": "~0.4.1"
|
||||
}
|
||||
},
|
||||
"node_modules/vite/node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz",
|
||||
|
|
@ -21039,6 +21061,12 @@
|
|||
"flush-write-stream": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"lib-esm": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmmirror.com/lib-esm/-/lib-esm-0.4.2.tgz",
|
||||
"integrity": "sha512-VGqaEGuryUbT7FLGxXg46nrSzkhLzyk+JQjYoYEORH5UtdIu3yf6DCOqh65FOR3bWOHHGINQH/vR5YGGIFBgJw==",
|
||||
"dev": true
|
||||
},
|
||||
"liftoff": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/liftoff/-/liftoff-3.1.0.tgz",
|
||||
|
|
@ -22032,6 +22060,11 @@
|
|||
"readable-stream": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"os": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/os/-/os-0.1.2.tgz",
|
||||
"integrity": "sha512-ZoXJkvAnljwvc56MbvhtKVWmSkzV712k42Is2mA0+0KTSRakq5XXuXpjZjgAt9ctzl51ojhQWakQQpmOvXWfjQ=="
|
||||
},
|
||||
"os-locale": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/os-locale/-/os-locale-1.4.0.tgz",
|
||||
|
|
@ -24823,6 +24856,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"vite-plugin-resolve": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmmirror.com/vite-plugin-resolve/-/vite-plugin-resolve-2.5.1.tgz",
|
||||
"integrity": "sha512-9dD0Yq5JT1RxHQGZOyhC7e/JlhyhMCftCpQ8TPzQa7KEB/3ERnoCPinH3VJk/0C8qHsA+l41bIcHh5BcHBTmAw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lib-esm": "~0.4.1"
|
||||
}
|
||||
},
|
||||
"wcwidth": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/wcwidth/-/wcwidth-1.0.1.tgz",
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
"crypto-js": "^4.2.0",
|
||||
"dayjs": "^1.11.11",
|
||||
"electron-squirrel-startup": "^1.0.1",
|
||||
"os": "^0.1.2",
|
||||
"path": "^0.12.7",
|
||||
"postcss-px-to-viewport-8-plugin": "^1.2.5",
|
||||
"react": "^18.3.1",
|
||||
|
|
@ -58,7 +59,8 @@
|
|||
"cross-env": "^7.0.3",
|
||||
"electron": "^23.3.13",
|
||||
"typescript": "^4.5.4",
|
||||
"vite": "^2.8.0"
|
||||
"vite": "^2.8.0",
|
||||
"vite-plugin-resolve": "^2.5.1"
|
||||
},
|
||||
"config": {
|
||||
"forge": "./forge.config.js"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { message } from "antd";
|
||||
import os from 'os'
|
||||
import storage from "./storage";
|
||||
const {
|
||||
createAgoraRtcEngine,
|
||||
|
|
@ -197,6 +198,35 @@ const agora = {
|
|||
}
|
||||
},
|
||||
|
||||
// 停止录制音视频
|
||||
stopRecording: () => {
|
||||
iMediaRecorder.stopRecording()
|
||||
rtcEngine.destroyMediaRecorder(iMediaRecorder)
|
||||
iMediaRecorder = ""
|
||||
},
|
||||
// 开始录制音视频
|
||||
startRecording: () => {
|
||||
iMediaRecorder = rtcEngine.createMediaRecorder({
|
||||
channelId: option.channelId,
|
||||
uid: 123,
|
||||
})
|
||||
iMediaRecorder.setMediaRecorderObserver({
|
||||
// 录制状态发生改变回调。
|
||||
onRecorderStateChanged: (channelId: any, uid: any, state: any, reason: any) => {
|
||||
console.log(channelId, uid, state, reason, '录制状态发生改变回调。');
|
||||
},
|
||||
// 录制信息更新回调。
|
||||
onRecorderInfoUpdated: (channelId: any, uid: any, info: any) => {
|
||||
console.log(channelId, uid, info, '录制信息更新回调。');
|
||||
},
|
||||
})
|
||||
iMediaRecorder.startRecording({
|
||||
storagePath: `${os.homedir()}/${+new Date()}.mp4`, //录音文件在本地保存的绝对路径,需精确到文件名及格式
|
||||
containerFormat: MediaRecorderContainerFormat.FormatMp4, //录制文件的格式
|
||||
streamType: MediaRecorderStreamType.StreamTypeBoth, //录制内容
|
||||
maxDurationMs: 7200000, //maxDurationMs
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
|
@ -293,35 +323,7 @@ const agora = {
|
|||
setPlaybackDevice: (deviceId: string) => {
|
||||
rtcEngine.getAudioDeviceManager().setPlaybackDevice(deviceId)
|
||||
},
|
||||
// 停止录制音视频
|
||||
stopRecording: () => {
|
||||
iMediaRecorder.stopRecording()
|
||||
rtcEngine.destroyMediaRecorder(iMediaRecorder)
|
||||
iMediaRecorder = ""
|
||||
},
|
||||
// 开始录制音视频
|
||||
startRecording: () => {
|
||||
iMediaRecorder = rtcEngine.createMediaRecorder({
|
||||
channelId: option.channelId,
|
||||
uid: 123,
|
||||
})
|
||||
iMediaRecorder.setMediaRecorderObserver({
|
||||
// 录制状态发生改变回调。
|
||||
onRecorderStateChanged: (channelId: any, uid: any, state: any, reason: any) => {
|
||||
console.log(channelId, uid, state, reason, '录制状态发生改变回调。');
|
||||
},
|
||||
// 录制信息更新回调。
|
||||
onRecorderInfoUpdated: (channelId: any, uid: any, info: any) => {
|
||||
console.log(channelId, uid, info, '录制信息更新回调。');
|
||||
},
|
||||
})
|
||||
iMediaRecorder.startRecording({
|
||||
storagePath: `D:/word/${+new Date()}.mp4`, //录音文件在本地保存的绝对路径,需精确到文件名及格式
|
||||
containerFormat: MediaRecorderContainerFormat.FormatMp4, //录制文件的格式
|
||||
streamType: MediaRecorderStreamType.StreamTypeBoth, //录制内容
|
||||
maxDurationMs: 7200000, //maxDurationMs
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
export default agora;
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import pxtovw from 'postcss-px-to-viewport-8-plugin'
|
||||
import { resolve } from 'path'
|
||||
import { resolve as resolvePath } from 'path'
|
||||
import resolve from 'vite-plugin-resolve';
|
||||
const loder_pxtovw = pxtovw({
|
||||
viewportWidth: 1900,
|
||||
viewportUnit: 'vw',
|
||||
selectorBlackList: ['.login','.ant-pagination']
|
||||
selectorBlackList: ['.login', '.ant-pagination']
|
||||
})
|
||||
|
||||
export default defineConfig({
|
||||
|
|
@ -24,7 +25,7 @@ export default defineConfig({
|
|||
alias: [
|
||||
{
|
||||
find: '@',
|
||||
replacement: resolve(__dirname, 'src'),
|
||||
replacement: resolvePath(__dirname, 'src'),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -50,5 +51,15 @@ export default defineConfig({
|
|||
base: './', // 这里更改打包相对绝对路径
|
||||
plugins: [
|
||||
react(),
|
||||
resolve({
|
||||
'agora-electron-sdk': `
|
||||
const {
|
||||
createAgoraRtcEngine
|
||||
} = require("agora-electron-sdk")
|
||||
export {
|
||||
createAgoraRtcEngine,
|
||||
}
|
||||
`,
|
||||
})
|
||||
]
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue