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(webcam): hide the background control where it cannot work

EtienneLescot5077f7aa3d31
diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsx
index 497f45b62..39cedff5f 100644
--- a/src/components/ai-edition/RightPanes.tsx
+++ b/src/components/ai-edition/RightPanes.tsx
@@ -1894,6 +1894,19 @@ const CAMERA_SHAPES: Array<{
},
];
+/**
+ * Whether this build can actually segment the camera.
+ *
+ * The mask is produced by the native compositor, and only the Windows back-end captures the
+ * frame and uploads the mask — macOS and Linux carry the shader branch but nothing feeds it,
+ * so `fx.z` never leaves 0 there. Showing the control anyway would put a setting in the panel
+ * that changes nothing, which is the one thing a control must never do. It comes back for a
+ * platform the moment that platform's capture lands.
+ */
+function supportsWebcamSegmentation(): boolean {
+ return window.electronAPI?.getPlatform?.() === "win32";
+}
+
const CAMERA_BACKGROUND_MODES: Array<{
value: "none" | "transparent" | "blur" | "custom";
labelKey: string;
@@ -2143,77 +2156,81 @@ export function LayoutPane() {
</div>
</div>
) : null}
- <div className={styles.sectionLabel}>{ts("layout.webcamBackground")}</div>
- <div
- style={{
- display: "grid",
- gridTemplateColumns: "repeat(4, minmax(0, 1fr))",
- gap: 8,
- padding: "0 var(--sp-4) 12px",
- }}
- >
- {CAMERA_BACKGROUND_MODES.map((mode) => {
- const isActive = settings.webcamBackgroundMode === mode.value;
- return (
- <button
- type="button"
- key={mode.value}
- className={`${styles.cursorCell} ${isActive ? styles.isActive : ""}`}
- style={{
- flexDirection: "column",
- gap: 4,
- padding: 8,
- display: "flex",
- alignItems: "center",
- minWidth: 0,
- }}
- disabled={layoutControlsDisabled}
- onClick={() => {
- void set({ webcamBackgroundMode: mode.value });
- }}
- >
- <svg
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- width={22}
- height={22}
- >
- {mode.icon}
- </svg>
- <span style={{ font: "500 11px/1 var(--font-body)" }}>{ts(mode.labelKey)}</span>
- </button>
- );
- })}
- </div>
- {settings.webcamBackgroundMode === "blur" ? (
- <div className={styles.sliderGrid}>
- <SliderCell
- label={ts("layout.webcamBlurIntensity")}
- value={Math.round(settings.webcamBlurIntensity * 100)}
- min={0}
- max={100}
- suffix="%"
- disabled={layoutControlsDisabled}
- onChange={(next) => setLive({ webcamBlurIntensity: next / 100 })}
- onCommit={() => void commit()}
- />
- </div>
- ) : null}
- {settings.webcamBackgroundMode === "custom" ? (
- <div style={{ padding: "0 var(--sp-4) 12px" }}>
- <WallpaperPicker
- value={settings.webcamWallpaper}
- hasDocument={hasDocument && !layoutControlsDisabled}
- onChange={(url) => void set({ webcamWallpaper: url })}
- onLiveChange={(url) => setLive({ webcamWallpaper: url })}
- onCommit={commit}
- updateNativeBackground={false}
- onPickFile={handlePickWebcamWallpaper}
- />
- {webcamWallpaperInput}
- </div>
+ {supportsWebcamSegmentation() ? (
+ <>
+ <div className={styles.sectionLabel}>{ts("layout.webcamBackground")}</div>
+ <div
+ style={{
+ display: "grid",
+ gridTemplateColumns: "repeat(4, minmax(0, 1fr))",
+ gap: 8,
+ padding: "0 var(--sp-4) 12px",
+ }}
+ >
+ {CAMERA_BACKGROUND_MODES.map((mode) => {
+ const isActive = settings.webcamBackgroundMode === mode.value;
+ return (
+ <button
+ type="button"
+ key={mode.value}
+ className={`${styles.cursorCell} ${isActive ? styles.isActive : ""}`}
+ style={{
+ flexDirection: "column",
+ gap: 4,
+ padding: 8,
+ display: "flex",
+ alignItems: "center",
+ minWidth: 0,
+ }}
+ disabled={layoutControlsDisabled}
+ onClick={() => {
+ void set({ webcamBackgroundMode: mode.value });
+ }}
+ >
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ width={22}
+ height={22}
+ >
+ {mode.icon}
+ </svg>
+ <span style={{ font: "500 11px/1 var(--font-body)" }}>{ts(mode.labelKey)}</span>
+ </button>
+ );
+ })}
+ </div>
+ {settings.webcamBackgroundMode === "blur" ? (
+ <div className={styles.sliderGrid}>
+ <SliderCell
+ label={ts("layout.webcamBlurIntensity")}
+ value={Math.round(settings.webcamBlurIntensity * 100)}
+ min={0}
+ max={100}
+ suffix="%"
+ disabled={layoutControlsDisabled}
+ onChange={(next) => setLive({ webcamBlurIntensity: next / 100 })}
+ onCommit={() => void commit()}
+ />
+ </div>
+ ) : null}
+ {settings.webcamBackgroundMode === "custom" ? (
+ <div style={{ padding: "0 var(--sp-4) 12px" }}>
+ <WallpaperPicker
+ value={settings.webcamWallpaper}
+ hasDocument={hasDocument && !layoutControlsDisabled}
+ onChange={(url) => void set({ webcamWallpaper: url })}
+ onLiveChange={(url) => setLive({ webcamWallpaper: url })}
+ onCommit={commit}
+ updateNativeBackground={false}
+ onPickFile={handlePickWebcamWallpaper}
+ />
+ {webcamWallpaperInput}
+ </div>
+ ) : null}
+ </>
) : null}
<div className={styles.sectionLabel}>{ts("layout.webcamFraming")}</div>
<div className={styles.sliderGrid}>
diff --git a/technical-documentation/engineering/webcam-segmentation.md b/technical-documentation/engineering/webcam-segmentation.md
index 713178810..20ef8fd72 100644
--- a/technical-documentation/engineering/webcam-segmentation.md
+++ b/technical-documentation/engineering/webcam-segmentation.md
@@ -57,7 +57,17 @@ not an alpha channel, so nothing has to survive a codec that cannot carry one.
- **macOS and Linux have the shader half only.** All three back-ends carry the same branch, but
only Windows captures and uploads a mask, so `fx.z` never leaves 0 on the other two and the
- effect is inert there. That is deliberate: the shader is the part that must not drift.
+ effect is inert there. That is deliberate: the shader is the part that must not drift, and it
+ is also the part that cannot be verified from a Windows machine, so it is the half worth
+ landing blind.
+
+ **The control is therefore hidden off Windows** (`supportsWebcamSegmentation` in
+ `RightPanes.tsx`). A visible setting that changes nothing is worse than an absent one; it
+ comes back for a platform the moment that platform's capture lands. What each one still needs
+ is `capture_webcam_rgb` and `set_webcam_mask` — a 256x144 render plus a readback, and an R8
+ texture upload — against machinery both back-ends already have (`read_nv12_scaled` on macOS,
+ the `Readback` buffers on Linux). Neither can be compiled here, so both belong on a machine
+ that builds them.
- **ONNX Runtime is not staged.** The crate links `ort` with `load-dynamic`, so nothing is needed
to *build*; at runtime `ensureOnnxRuntimeOnPath` looks for the library next to the addon in
`electron/native/bin/<tag>/`, the convention `whisper-stt` already uses. Until a CI job puts it