Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix: handle export and camera access edge cases

Marcus Schiesser6236d2a13d10
diff --git a/package-lock.json b/package-lock.json
index 38d3e0cfc..58e37a3a8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -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": {
diff --git a/src/lib/exporter/frameRenderer.ts b/src/lib/exporter/frameRenderer.ts
index 5ce5bface..b928df276 100644
--- a/src/lib/exporter/frameRenderer.ts
+++ b/src/lib/exporter/frameRenderer.ts
@@ -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;
diff --git a/src/lib/requestCameraAccess.ts b/src/lib/requestCameraAccess.ts
index ed18f6f8b..249422408 100644
--- a/src/lib/requestCameraAccess.ts
+++ b/src/lib/requestCameraAccess.ts
@@ -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),
+ };
}
}