fix: handle export and camera access edge cases
This commit is contained in:
Generated
+4
@@ -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": {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user