Skip to content

Commit db9ba2a

Browse files
committed
feat(webcam): default the camera to 40% and let it grow to 60%
The picture-in-picture camera opened at 25%, too small to read a face once a zoom shrinks it, and stopped at 50%. Existing projects keep the size they stored.
1 parent 845f58f commit db9ba2a

15 files changed

Lines changed: 26 additions & 26 deletions

File tree

‎src/components/ai-edition/RightPanes.layout.test.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,11 @@ describe("LayoutPane picture-in-picture camera", () => {
286286
expect(stored()).toMatchObject({ webcamAnchor: "right" });
287287
});
288288

289-
it("offers a camera from 15% to 50% of the frame", () => {
289+
it("offers a camera from 15% to 60% of the frame", () => {
290290
renderLayout(seedProject(true));
291291
const slider = screen.getByRole("slider", { name: "Webcam size" });
292292
expect(slider).toHaveAttribute("min", "15");
293-
expect(slider).toHaveAttribute("max", "50");
293+
expect(slider).toHaveAttribute("max", "60");
294294
});
295295
});
296296

‎src/components/video-editor/types.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import { clamp01 } from "@/utils/math";
1111
export type { ZoomDepth, ZoomScaleInput };
1212
export type ZoomFocusMode = "manual" | "auto";
1313
export type { WebcamLayoutPreset };
14-
/** Webcam size as a percentage of the canvas reference dimension (15-50). */
14+
/** Webcam size as a percentage of the canvas reference dimension (15-60). */
1515
export type WebcamSizePreset = number;
1616

17-
export const DEFAULT_WEBCAM_SIZE_PRESET: WebcamSizePreset = 25;
17+
export const DEFAULT_WEBCAM_SIZE_PRESET: WebcamSizePreset = 40;
1818

1919
export const DEFAULT_WEBCAM_LAYOUT_PRESET: WebcamLayoutPreset = "picture-in-picture";
2020

‎src/lib/ai-edition/store/editorSettings.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,12 @@ describe("patchEditorSettings", () => {
264264
expect(read({})).toEqual(["square", 0.7]);
265265
});
266266

267-
it("reads a camera size outside the slider's 15–50% into it", () => {
267+
it("reads a camera size outside the slider's 15–60% into it", () => {
268268
const read = (webcamSizePreset: number) =>
269269
getEditorSettings({ ...baseDoc, legacyEditor: { webcamSizePreset } }).webcamSizePreset;
270270
// An older build allowed 10%.
271271
expect(read(10)).toBe(15);
272-
expect(read(80)).toBe(50);
272+
expect(read(80)).toBe(60);
273273
});
274274

275275
it("preserves a non-zero crop at the bottom-right edge", () => {

‎src/lib/compositeLayout.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe("computeCompositeLayout", () => {
8181
});
8282

8383
const refDim = Math.sqrt(1280 * 720);
84-
const defaultFraction = 25 / 100; // DEFAULT_WEBCAM_SIZE_PRESET = 25
84+
const defaultFraction = 40 / 100; // DEFAULT_WEBCAM_SIZE_PRESET = 40
8585
expect(layout).not.toBeNull();
8686
expect(layout!.webcamRect).not.toBeNull();
8787
expect(layout!.webcamRect!.width).toBeLessThanOrEqual(Math.round(refDim * defaultFraction) + 1);
@@ -580,7 +580,7 @@ describe("computeCompositeLayout", () => {
580580

581581
// A fraction of half the short side: the same value is the same shape at any size.
582582
it("rounds by the roundness, and a fully round square is a circle", () => {
583-
const circle = pipAt({ webcamMaskShape: "square", webcamRoundness: 1 });
583+
const circle = pipAt({ webcamMaskShape: "square", webcamRoundness: 1, webcamSizePreset: 25 });
584584
expect(circle.width).toBe(circle.height);
585585
expect(circle.borderRadius).toBe(circle.width / 2);
586586
expect(pipAt({ webcamRoundness: 0 }).borderRadius).toBe(0);
@@ -612,10 +612,10 @@ describe("computeCompositeLayout", () => {
612612
}
613613
});
614614

615-
// The size is the camera's long side: a 16:9 camera at the 50% cap is 540 x 304 in 1080p.
616-
it("caps the camera at 50% of the short side", () => {
617-
expect(pipAt({ webcamSizePreset: WEBCAM_SIZE_MAX })).toMatchObject({ width: 540, height: 304 });
618-
expect(pipAt({ webcamSizePreset: 80 }).height).toBe(304);
615+
// The size is the camera's long side: a 16:9 camera at the 60% cap is 648 x 365 in 1080p.
616+
it("caps the camera at 60% of the short side", () => {
617+
expect(pipAt({ webcamSizePreset: WEBCAM_SIZE_MAX })).toMatchObject({ width: 648, height: 365 });
618+
expect(pipAt({ webcamSizePreset: 80 }).height).toBe(365);
619619
});
620620
});
621621

‎src/lib/compositeLayout.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ export function computeCompositeLayout(params: {
426426
screenSize,
427427
webcamSize,
428428
layoutPreset = "picture-in-picture",
429-
webcamSizePreset = 25,
429+
webcamSizePreset = 40,
430430
webcamAnchor = "bottom-right",
431431
webcamMaskShape = "rectangle",
432432
webcamRoundness = DEFAULT_WEBCAM_ROUNDNESS[

‎src/lib/projectDefaults.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ const LEGACY_WEBCAM_ROUNDNESS = 0.3;
148148

149149
/**
150150
* The picture-in-picture camera's size, in percent of the frame's short side: the camera's
151-
* long side, so a 16:9 camera at 50 is 28% of a 1080p frame's height. Below 15 a face no
151+
* long side, so a 16:9 camera at 60 is 34% of a 1080p frame's height. Below 15 a face no
152152
* longer reads, and less still once a zoom shrinks it; older builds allowed 10, read back as 15.
153153
*/
154154
export const WEBCAM_SIZE_MIN = 15;
155-
export const WEBCAM_SIZE_MAX = 50;
155+
export const WEBCAM_SIZE_MAX = 60;
156156

157157
/**
158158
* Reads a stored camera shape and roundness. `circle` and `rounded` were a proportion and a
@@ -253,7 +253,7 @@ export const DEFAULT_PROJECT_APPEARANCE: ProjectAppearanceDefaults = {
253253
webcamRoundness: DEFAULT_WEBCAM_ROUNDNESS.square,
254254
webcamMirrored: false,
255255
webcamReactiveZoom: true,
256-
webcamSizePreset: 25,
256+
webcamSizePreset: 40,
257257
webcamAnchor: "bottom-right",
258258
webcamBackgroundMode: "none",
259259
webcamWallpaper: "/wallpapers/wallpaper11.jpg",

‎src/native/sceneDescription.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,11 +1259,11 @@ describe("buildSceneDescription.settings mapping", () => {
12591259
expect(buildSceneDescription(doc).layout.webcamSize).toBeCloseTo(0.334, 5);
12601260
});
12611261

1262-
it("webcamSize clamps below 15 and above 50", () => {
1262+
it("webcamSize clamps below 15 and above 60", () => {
12631263
const low = makeDoc({ legacyEditor: { webcamSizePreset: 2 } });
12641264
const high = makeDoc({ legacyEditor: { webcamSizePreset: 90 } });
12651265
expect(buildSceneDescription(low).layout.webcamSize).toBeCloseTo(0.15, 5);
1266-
expect(buildSceneDescription(high).layout.webcamSize).toBeCloseTo(0.5, 5);
1266+
expect(buildSceneDescription(high).layout.webcamSize).toBeCloseTo(0.6, 5);
12671267
});
12681268

12691269
it("carries the camera's anchor, the point its zoom-time shrink keeps fixed", () => {

‎website/docs/guides/product-demo-video.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The webcam is recorded to its own file, so its placement is an editing decision
5252

5353
- **Picture in picture**, **Vertical stack**, **Dual frame**, or **No webcam**.
5454
- For every layout: mirror, and a crop of the camera image.
55-
- For **Picture in picture** only: **Camera shape** (Square by default, or Original, which keeps the camera's own proportions), **Roundness** (70% for Square and 40% for Original by default; at 100% a square camera is a circle), a size from 15 to 50% (25% by default), **Position** (a corner or the middle of an edge, bottom right by default), and **Shrink on zoom**, on by default, which makes the camera smaller while a zoom plays so it does not cover the detail. Drag the camera on the canvas and it snaps to the nearest position.
55+
- For **Picture in picture** only: **Camera shape** (Square by default, or Original, which keeps the camera's own proportions), **Roundness** (70% for Square and 40% for Original by default; at 100% a square camera is a circle), a size from 15 to 60% (40% by default), **Position** (a corner or the middle of an edge, bottom right by default), and **Shrink on zoom**, on by default, which makes the camera smaller while a zoom plays so it does not cover the detail. Drag the camera on the canvas and it snaps to the nearest position.
5656
- **Camera background**: Original, Blur, Cutout or Custom. Cutout removes the background without a green screen, using a segmentation model that runs on your CPU. This section only appears when the segmentation runtime loads on your machine.
5757

5858
For an intro or outro, press `C` to add a **Full Camera** segment: the camera fills the whole frame for that span.

‎website/i18n/de/docusaurus-plugin-content-docs/current/guides/product-demo-video.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Die Webcam wird in eine eigene Datei aufgenommen. Ihre Platzierung ist also eine
5252

5353
- **Picture in Picture**, **Vertical Stack**, **Dual Frame** oder **No Webcam**.
5454
- Für jedes Layout: Spiegeln und ein Zuschnitt des Kamerabilds.
55-
- Nur für **Picture in Picture**: **Camera Shape** (standardmäßig Square, oder Original, das die eigenen Proportionen der Kamera behält), **Roundness** (standardmäßig 70 % für Square und 40 % für Original; bei 100 % wird eine quadratische Kamera zum Kreis), eine Größe von 15 bis 50 % (standardmäßig 25 %), **Position** (eine Ecke oder die Mitte einer Kante, standardmäßig unten rechts) und **Shrink on Zoom**, standardmäßig an: Es verkleinert die Kamera, während ein Zoom läuft, damit sie das Detail nicht verdeckt. Zieh die Kamera auf der Arbeitsfläche, und sie rastet an der nächsten Position ein.
55+
- Nur für **Picture in Picture**: **Camera Shape** (standardmäßig Square, oder Original, das die eigenen Proportionen der Kamera behält), **Roundness** (standardmäßig 70 % für Square und 40 % für Original; bei 100 % wird eine quadratische Kamera zum Kreis), eine Größe von 15 bis 60 % (standardmäßig 40 %), **Position** (eine Ecke oder die Mitte einer Kante, standardmäßig unten rechts) und **Shrink on Zoom**, standardmäßig an: Es verkleinert die Kamera, während ein Zoom läuft, damit sie das Detail nicht verdeckt. Zieh die Kamera auf der Arbeitsfläche, und sie rastet an der nächsten Position ein.
5656
- **Camera Background**: Original, Blur, Cutout oder Custom. Cutout entfernt den Hintergrund ohne Greenscreen, mit einem Segmentierungsmodell, das auf deiner CPU läuft. Dieser Abschnitt erscheint nur, wenn sich die Segmentierungs-Laufzeit auf deinem Rechner laden lässt.
5757

5858
Für ein Intro oder Outro drückst du `C`, um ein **Full Camera**-Segment hinzuzufügen: Die Kamera füllt in diesem Abschnitt das ganze Bild.

‎website/i18n/es/docusaurus-plugin-content-docs/current/guides/product-demo-video.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ La cámara web se graba en su propio archivo, así que su ubicación es una deci
5252

5353
- **Imagen en imagen**, **Apilado vertical**, **Marco dual** o **Sin cámara**.
5454
- En todas las disposiciones: reflejo y un encuadre de la imagen de la cámara.
55-
- Solo en **Imagen en imagen**: **Forma de cámara** (Cuadrado por defecto, u Original, que conserva las proporciones propias de la cámara), **Redondez** (70 % para Cuadrado y 40 % para Original por defecto; al 100 % una cámara cuadrada es un círculo), un tamaño del 15 al 50 % (25 % por defecto), **Posición** (una esquina o el centro de un borde, abajo a la derecha por defecto) y **Reducir al ampliar**, activado por defecto, que hace más pequeña la cámara mientras se reproduce un zoom para que no tape el detalle. Arrastra la cámara sobre el lienzo y se ajusta a la posición más cercana.
55+
- Solo en **Imagen en imagen**: **Forma de cámara** (Cuadrado por defecto, u Original, que conserva las proporciones propias de la cámara), **Redondez** (70 % para Cuadrado y 40 % para Original por defecto; al 100 % una cámara cuadrada es un círculo), un tamaño del 15 al 60 % (40 % por defecto), **Posición** (una esquina o el centro de un borde, abajo a la derecha por defecto) y **Reducir al ampliar**, activado por defecto, que hace más pequeña la cámara mientras se reproduce un zoom para que no tape el detalle. Arrastra la cámara sobre el lienzo y se ajusta a la posición más cercana.
5656
- **Fondo de la cámara**: Original, Desenfocado, Recortado o Personalizado. Recortado quita el fondo sin pantalla verde, con un modelo de segmentación que se ejecuta en tu CPU. Esta sección solo aparece cuando el entorno de ejecución de segmentación se carga en tu equipo.
5757

5858
Para una introducción o un cierre, presiona `C` para agregar un segmento de **Cámara a pantalla completa**: la cámara llena todo el cuadro durante ese tramo.

0 commit comments

Comments
 (0)