yangjie #28

Merged
yangqiang merged 32 commits from yangjie into master 2024-10-29 15:15:48 +08:00
3 changed files with 34 additions and 8 deletions
Showing only changes of commit 3a5e299975 - Show all commits

View File

@ -46,7 +46,7 @@
"webm-duration-fix-buffer": "^1.0.0", "webm-duration-fix-buffer": "^1.0.0",
"winreg": "^1.2.5" "winreg": "^1.2.5"
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^18.0.0", "@types/react": "^18.0.0",
"@types/react-dom": "^17.0.25", "@types/react-dom": "^17.0.25",
"@vitejs/plugin-react": "^1.0.7", "@vitejs/plugin-react": "^1.0.7",
@ -91,7 +91,15 @@
"directories": { "directories": {
"output": "electron" "output": "electron"
}, },
"extraResources": [], "extraResources": [
{
"from": "src/assets/virtualBackground",
"to": "images",
"filter": [
"**/*"
]
}
],
"nsis": { "nsis": {
"oneClick": false, "oneClick": false,
"installerIcon": "build/install.ico", "installerIcon": "build/install.ico",

View File

@ -233,14 +233,23 @@ const VideoComponents = () => {
}, [darkLightEnhancement]); }, [darkLightEnhancement]);
useEffect(() => { useEffect(() => {
if (typeof virtualBackground.sourceIndex === 'number') { if (typeof virtualBackground.sourceIndex === 'number') {
window.electron.getAppPath().then((res: string) => { if (import.meta.env.VITE_ENV === 'development') {
const imagePath = path.join(res, 'src', 'assets', 'virtualBackground', `${virtualBackground.sourceIndex + 1}.png`); window.electron.getAppPath().then((res: string) => {
const imagePath = path.join(res, 'src', 'assets', 'virtualBackground', `${virtualBackground.sourceIndex + 1}.png`);
agora.enableVirtualBackground(virtualBackground.isVirtualBackground, {
source: imagePath,
background_source_type: 2,
color: Number(virtualBackground.color),
})
})
} else {
const imagePath = path.join((process as any).resourcesPath, 'images', `${virtualBackground.sourceIndex + 1}.png`);
agora.enableVirtualBackground(virtualBackground.isVirtualBackground, { agora.enableVirtualBackground(virtualBackground.isVirtualBackground, {
source: imagePath, source: imagePath,
background_source_type: 2, background_source_type: 2,
color: Number(virtualBackground.color), color: Number(virtualBackground.color),
}) })
}) }
} else { } else {
agora.enableVirtualBackground(virtualBackground.isVirtualBackground, { agora.enableVirtualBackground(virtualBackground.isVirtualBackground, {
background_source_type: 1, background_source_type: 1,

View File

@ -120,14 +120,23 @@ export const agora = {
agora.setLowlightEnhanceOptions(settingData.darkLightEnhancement.isDarkLightEnhancement, settingData.darkLightEnhancement) agora.setLowlightEnhanceOptions(settingData.darkLightEnhancement.isDarkLightEnhancement, settingData.darkLightEnhancement)
console.log(settingData); console.log(settingData);
if (typeof settingData.virtualBackground.sourceIndex === 'number') { if (typeof settingData.virtualBackground.sourceIndex === 'number') {
window.electron.getAppPath().then((res: string) => { if (import.meta.env.VITE_ENV === 'development') {
const imagePath = path.join(res, 'src', 'assets', 'virtualBackground', `${settingData.virtualBackground.sourceIndex + 1}.png`); window.electron.getAppPath().then((res: string) => {
const imagePath = path.join(res, 'src', 'assets', 'virtualBackground', `${settingData.virtualBackground.sourceIndex + 1}.png`);
agora.enableVirtualBackground(settingData.virtualBackground.isVirtualBackground, {
source: imagePath,
background_source_type: 2,
color: Number(settingData.virtualBackground.color),
})
})
} else {
const imagePath = path.join((process as any).resourcesPath, 'images', `${settingData.virtualBackground.sourceIndex + 1}.png`);
agora.enableVirtualBackground(settingData.virtualBackground.isVirtualBackground, { agora.enableVirtualBackground(settingData.virtualBackground.isVirtualBackground, {
source: imagePath, source: imagePath,
background_source_type: 2, background_source_type: 2,
color: Number(settingData.virtualBackground.color), color: Number(settingData.virtualBackground.color),
}) })
}) }
} else { } else {
agora.enableVirtualBackground(settingData.virtualBackground.isVirtualBackground, { agora.enableVirtualBackground(settingData.virtualBackground.isVirtualBackground, {
background_source_type: 1, background_source_type: 1,