fix: handle export and camera access edge cases

This commit is contained in:
Marcus Schiesser
2026-03-19 20:03:55 +08:00
parent c84c244761
commit 6236d2a13d
3 changed files with 19 additions and 6 deletions
+4
View File
@@ -73,6 +73,10 @@
"vite-plugin-electron": "^0.28.6",
"vite-plugin-electron-renderer": "^0.14.5",
"vitest": "^4.0.16"
},
"engines": {
"node": "22.22.1",
"npm": "10.9.4"
}
},
"node_modules/@alloc/quick-lru": {
+3 -3
View File
@@ -336,7 +336,7 @@ export class FrameRenderer {
}
// Apply layout
this.updateLayout();
this.updateLayout(webcamFrame);
const timeMs = this.currentVideoTime * 1000;
const TICKS_PER_FRAME = 1;
@@ -400,7 +400,7 @@ export class FrameRenderer {
}
}
private updateLayout(): void {
private updateLayout(webcamFrame?: VideoFrame | null): void {
if (!this.app || !this.videoSprite || !this.maskGraphics || !this.videoContainer) return;
const { width, height } = this.config;
@@ -426,7 +426,7 @@ export class FrameRenderer {
canvasSize: { width, height },
maxContentSize: { width: viewportWidth, height: viewportHeight },
screenSize: { width: croppedVideoWidth, height: croppedVideoHeight },
webcamSize: this.config.webcamSize,
webcamSize: webcamFrame ? this.config.webcamSize : null,
layoutPreset: this.config.webcamLayoutPreset,
});
if (!compositeLayout) return;
+12 -3
View File
@@ -15,9 +15,18 @@ function getDeniedStatus(error: unknown) {
export async function requestCameraAccess(): Promise<CameraAccessResult> {
if (window.electronAPI?.requestCameraAccess) {
const electronResult = await window.electronAPI.requestCameraAccess();
if (!electronResult.success || !electronResult.granted) {
return electronResult;
try {
const electronResult = await window.electronAPI.requestCameraAccess();
if (!electronResult.success || !electronResult.granted) {
return electronResult;
}
} catch (error) {
return {
success: false,
granted: false,
status: "error",
error: String(error),
};
}
}