Skip to content

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

feat(editor): add Full Camera timeline effect

Rodrigo Valladares88669afc4017
diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsx
index 31ba6c11d..0490cfe48 100644
--- a/src/components/video-editor/VideoEditor.tsx
+++ b/src/components/video-editor/VideoEditor.tsx
@@ -107,6 +107,7 @@ import { buildAutoZoomSuggestions } from "./timeline/zoomSuggestionUtils";
import {
type AnnotationRegion,
type BlurData,
+ type CameraFullscreenRegion,
clampFocusToDepth,
DEFAULT_ANNOTATION_POSITION,
DEFAULT_ANNOTATION_SIZE,
@@ -205,6 +206,7 @@ export default function VideoEditor() {
const {
zoomRegions,
+ cameraFullscreenRegions,
autoZoomEnabled,
autoFocusAll,
trimRegions,
@@ -243,6 +245,7 @@ export default function VideoEditor() {
const durationRef = useRef(duration);
durationRef.current = duration;
const [selectedZoomId, setSelectedZoomId] = useState<string | null>(null);
+ const [selectedCameraFullscreenId, setSelectedCameraFullscreenId] = useState<string | null>(null);
const [isPreviewingZoom, setIsPreviewingZoom] = useState(false);
const [selectedTrimId, setSelectedTrimId] = useState<string | null>(null);
const [selectedSpeedId, setSelectedSpeedId] = useState<string | null>(null);
@@ -313,6 +316,7 @@ export default function VideoEditor() {
const videoPlaybackRef = useRef<VideoPlaybackRef>(null);
const nextZoomIdRef = useRef(1);
+ const nextCameraFullscreenIdRef = useRef(1);
const nextTrimIdRef = useRef(1);
const nextSpeedIdRef = useRef(1);
@@ -389,6 +393,7 @@ export default function VideoEditor() {
const inferredDurationMs = Math.max(
0,
...normalizedEditor.zoomRegions.map((region) => region.endMs),
+ ...normalizedEditor.cameraFullscreenRegions.map((region) => region.endMs),
...normalizedEditor.trimRegions.map((region) => region.endMs),
...normalizedEditor.speedRegions.map((region) => region.endMs),
...normalizedEditor.annotationRegions.map((region) => region.endMs),
@@ -425,6 +430,7 @@ export default function VideoEditor() {
padding: normalizedEditor.padding,
cropRegion: normalizedEditor.cropRegion,
zoomRegions: normalizedEditor.zoomRegions,
+ cameraFullscreenRegions: normalizedEditor.cameraFullscreenRegions,
autoZoomEnabled: normalizedEditor.autoZoomEnabled,
autoFocusAll: normalizedEditor.autoFocusAll,
trimRegions: normalizedEditor.trimRegions,
@@ -446,6 +452,7 @@ export default function VideoEditor() {
setCursorTheme(normalizedEditor.cursorTheme);
setSelectedZoomId(null);
+ setSelectedCameraFullscreenId(null);
setSelectedTrimId(null);
setSelectedSpeedId(null);
setSelectedAnnotationId(null);
@@ -455,6 +462,10 @@ export default function VideoEditor() {
"zoom",
normalizedEditor.zoomRegions.map((region) => region.id),
);
+ nextCameraFullscreenIdRef.current = deriveNextId(
+ "camera-fullscreen",
+ normalizedEditor.cameraFullscreenRegions.map((region) => region.id),
+ );
nextTrimIdRef.current = deriveNextId(
"trim",
normalizedEditor.trimRegions.map((region) => region.id),
@@ -502,6 +513,7 @@ export default function VideoEditor() {
padding,
cropRegion,
zoomRegions,
+ cameraFullscreenRegions,
autoZoomEnabled,
autoFocusAll,
trimRegions,
@@ -533,6 +545,7 @@ export default function VideoEditor() {
padding,
cropRegion,
zoomRegions,
+ cameraFullscreenRegions,
autoZoomEnabled,
autoFocusAll,
trimRegions,
@@ -661,6 +674,7 @@ export default function VideoEditor() {
padding,
cropRegion,
zoomRegions,
+ cameraFullscreenRegions,
autoZoomEnabled,
autoFocusAll,
trimRegions,
@@ -726,6 +740,7 @@ export default function VideoEditor() {
padding,
cropRegion,
zoomRegions,
+ cameraFullscreenRegions,
autoZoomEnabled,
autoFocusAll,
trimRegions,
@@ -990,6 +1005,18 @@ export default function VideoEditor() {
const handleSelectZoom = useCallback((id: string | null) => {
setSelectedZoomId(id);
if (id) {
+ setSelectedCameraFullscreenId(null);
+ setSelectedTrimId(null);
+ setSelectedSpeedId(null);
+ setSelectedAnnotationId(null);
+ setSelectedBlurId(null);
+ }
+ }, []);
+
+ const handleSelectCameraFullscreen = useCallback((id: string | null) => {
+ setSelectedCameraFullscreenId(id);
+ if (id) {
+ setSelectedZoomId(null);
setSelectedTrimId(null);
setSelectedSpeedId(null);
setSelectedAnnotationId(null);
@@ -1001,6 +1028,7 @@ export default function VideoEditor() {
setSelectedTrimId(id);
if (id) {
setSelectedZoomId(null);
+ setSelectedCameraFullscreenId(null);
setSelectedSpeedId(null);
setSelectedAnnotationId(null);
setSelectedBlurId(null);
@@ -1011,6 +1039,7 @@ export default function VideoEditor() {
setSelectedAnnotationId(id);
if (id) {
setSelectedZoomId(null);
+ setSelectedCameraFullscreenId(null);
setSelectedTrimId(null);
setSelectedSpeedId(null);
setSelectedBlurId(null);
@@ -1021,6 +1050,7 @@ export default function VideoEditor() {
setSelectedBlurId(id);
if (id) {
setSelectedZoomId(null);
+ setSelectedCameraFullscreenId(null);
setSelectedTrimId(null);
setSelectedAnnotationId(null);
setSelectedSpeedId(null);
@@ -1043,6 +1073,7 @@ export default function VideoEditor() {
};
pushState((prev) => ({ zoomRegions: [...prev.zoomRegions, newRegion] }));
setSelectedZoomId(id);
+ setSelectedCameraFullscreenId(null);
setSelectedTrimId(null);
setSelectedSpeedId(null);
setSelectedAnnotationId(null);
@@ -1051,6 +1082,56 @@ export default function VideoEditor() {
[pushState, autoFocusAll],
);
+ const handleCameraFullscreenAdded = useCallback(
+ (span: Span) => {
+ const id = `camera-fullscreen-${nextCameraFullscreenIdRef.current++}`;
+ const newRegion: CameraFullscreenRegion = {
+ id,
+ startMs: Math.round(span.start),
+ endMs: Math.round(span.end),
+ };
+ pushState((prev) => ({
+ cameraFullscreenRegions: [...prev.cameraFullscreenRegions, newRegion],
+ }));
+ setSelectedCameraFullscreenId(id);
+ setSelectedZoomId(null);
+ setSelectedTrimId(null);
+ setSelectedSpeedId(null);
+ setSelectedAnnotationId(null);
+ setSelectedBlurId(null);
+ },
+ [pushState],
+ );
+
+ const handleCameraFullscreenSpanChange = useCallback(
+ (id: string, span: Span) => {
+ pushState((prev) => ({
+ cameraFullscreenRegions: prev.cameraFullscreenRegions.map((region) =>
+ region.id === id
+ ? {
+ ...region,
+ startMs: Math.round(span.start),
+ endMs: Math.round(span.end),
+ }
+ : region,
+ ),
+ }));
+ },
+ [pushState],
+ );
+
+ const handleCameraFullscreenDelete = useCallback(
+ (id: string) => {
+ pushState((prev) => ({
+ cameraFullscreenRegions: prev.cameraFullscreenRegions.filter((r) => r.id !== id),
+ }));
+ if (selectedCameraFullscreenId === id) {
+ setSelectedCameraFullscreenId(null);
+ }
+ },
+ [selectedCameraFullscreenId, pushState],
+ );
+
// Builds fresh "auto" zoom regions from cursor telemetry without overlapping
// existing ones. Used by both the on-load auto-suggest pass and the wand toggle.
const buildAutoZoomRegions = useCallback(
@@ -1301,6 +1382,7 @@ export default function VideoEditor() {
setSelectedSpeedId(id);
if (id) {
setSelectedZoomId(null);
+ setSelectedCameraFullscreenId(null);
setSelectedTrimId(null);
setSelectedAnnotationId(null);
setSelectedBlurId(null);
@@ -1969,6 +2051,15 @@ export default function VideoEditor() {
}
}, [selectedZoomId, zoomRegions]);
+ useEffect(() => {
+ if (
+ selectedCameraFullscreenId &&
+ !cameraFullscreenRegions.some((region) => region.id === selectedCameraFullscreenId)
+ ) {
+ setSelectedCameraFullscreenId(null);
+ }
+ }, [selectedCameraFullscreenId, cameraFullscreenRegions]);
+
useEffect(() => {
if (selectedTrimId && !trimRegions.some((region) => region.id === selectedTrimId)) {
setSelectedTrimId(null);
@@ -2138,6 +2229,7 @@ export default function VideoEditor() {
sizePreset: settings.gifConfig.sizePreset,
wallpaper,
zoomRegions,
+ cameraFullscreenRegions,
trimRegions,
speedRegions,
showShadow: shadowIntensity > 0,
@@ -2233,6 +2325,7 @@ export default function VideoEditor() {
codec: "avc1.640033",
wallpaper,
zoomRegions,
+ cameraFullscreenRegions,
trimRegions,
speedRegions,
showShadow: shadowIntensity > 0,
@@ -2341,6 +2434,7 @@ export default function VideoEditor() {
webcamVideoPath,
wallpaper,
zoomRegions,
+ cameraFullscreenRegions,
trimRegions,
speedRegions,
shadowIntensity,
@@ -2871,6 +2965,7 @@ export default function VideoEditor() {
onError={setError}
wallpaper={wallpaper}
zoomRegions={zoomRegions}
+ cameraFullscreenRegions={cameraFullscreenRegions}
selectedZoomId={selectedZoomId}
onSelectZoom={handleSelectZoom}
onZoomFocusChange={handleZoomFocusChange}
@@ -3127,6 +3222,12 @@ export default function VideoEditor() {
onZoomDelete={handleZoomDelete}
selectedZoomId={selectedZoomId}
onSelectZoom={handleSelectZoom}
+ cameraFullscreenRegions={cameraFullscreenRegions}
+ onCameraFullscreenAdded={handleCameraFullscreenAdded}
+ onCameraFullscreenSpanChange={handleCameraFullscreenSpanChange}
+ onCameraFullscreenDelete={handleCameraFullscreenDelete}
+ selectedCameraFullscreenId={selectedCameraFullscreenId}
+ onSelectCameraFullscreen={handleSelectCameraFullscreen}
trimRegions={trimRegions}
onTrimAdded={handleTrimAdded}
onTrimSpanChange={handleTrimSpanChange}
diff --git a/src/components/video-editor/VideoPlayback.tsx b/src/components/video-editor/VideoPlayback.tsx
index 8ce32cfd2..11c9e4061 100644
--- a/src/components/video-editor/VideoPlayback.tsx
+++ b/src/components/video-editor/VideoPlayback.tsx
@@ -19,7 +19,9 @@ import {
useState,
} from "react";
import {
+ computeCameraFullscreenTargetRect,
getWebcamLayoutCssBoxShadow,
+ lerpRect,
reactiveWebcamScale,
type Size,
type StyledRenderRect,
@@ -56,6 +58,7 @@ import {
import {
type AnnotationRegion,
type BlurData,
+ type CameraFullscreenRegion,
type CursorTelemetryPoint,
computeRotation3DContainScale,
DEFAULT_CROP_REGION,
@@ -70,6 +73,7 @@ import {
type ZoomFocus,
type ZoomRegion,
} from "./types";
+import { computeCameraFullscreenProgress } from "./videoPlayback/cameraFullscreenUtils";
import { AUTO_FOLLOW_PARAMS, DEFAULT_FOCUS } from "./videoPlayback/constants";
import { advanceFollowFocus } from "./videoPlayback/cursorFollowUtils";
import {
@@ -110,6 +114,7 @@ interface VideoPlaybackProps {
onError: (error: string) => void;
wallpaper?: string;
zoomRegions: ZoomRegion[];
+ cameraFullscreenRegions?: CameraFullscreenRegion[];
selectedZoomId: string | null;
onSelectZoom: (id: string | null) => void;
onZoomFocusChange: (id: string, focus: ZoomFocus) => void;
@@ -264,6 +269,7 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
onError,
wallpaper,
zoomRegions,
+ cameraFullscreenRegions = [],
selectedZoomId,
onSelectZoom,
onZoomFocusChange,
@@ -330,9 +336,11 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
const composite3DRef = useRef<HTMLDivElement | null>(null);
const outerWrapperRef = useRef<HTMLDivElement | null>(null);
const [webcamLayout, setWebcamLayout] = useState<StyledRenderRect | null>(null);
+ const webcamLayoutRef = useRef<StyledRenderRect | null>(null);
const [webcamDimensions, setWebcamDimensions] = useState<Size | null>(null);
const currentTimeRef = useRef(0);
const zoomRegionsRef = useRef<ZoomRegion[]>([]);
+ const cameraFullscreenRegionsRef = useRef<CameraFullscreenRegion[]>([]);
const cursorTelemetryRef = useRef<CursorTelemetryPoint[]>([]);
const cursorClickTimestampsRef = useRef<number[]>([]);
const selectedZoomIdRef = useRef<string | null>(null);
@@ -607,6 +615,7 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
baseMaskRef.current = result.maskRect;
borderRadiusRef.current = result.maskBorderRadius;
cropBoundsRef.current = result.cropBounds;
+ webcamLayoutRef.current = result.webcamRect;
setWebcamLayout(result.webcamRect);
// Reset camera container to identity
@@ -811,6 +820,10 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
zoomRegionsRef.current = zoomRegions;
}, [zoomRegions]);
+ useEffect(() => {
+ cameraFullscreenRegionsRef.current = cameraFullscreenRegions;
+ }, [cameraFullscreenRegions]);
+
useEffect(() => {
cursorTelemetryRef.current = cursorTelemetry;
}, [cursorTelemetry]);
@@ -1411,17 +1424,51 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
// corner (bottom-right by default) so it stays flush instead of drifting to center.
const webcamWrapper = webcamWrapperRef.current;
if (webcamWrapper) {
- const reactive =
- webcamReactiveZoomRef.current && webcamLayoutPresetRef.current === "picture-in-picture";
- const factor = reactive ? reactiveWebcamScale(state.appliedScale) : 1;
- if (factor < 1) {
- const pos = webcamPositionRef.current;
- const originX = (pos ? pos.cx >= 0.5 : true) ? "100%" : "0%";
- const originY = (pos ? pos.cy >= 0.5 : true) ? "100%" : "0%";
- webcamWrapper.style.transformOrigin = `${originX} ${originY}`;
- webcamWrapper.style.transform = `scale(${factor})`;
+ const cameraFullProgress = computeCameraFullscreenProgress(
+ cameraFullscreenRegionsRef.current,
+ currentTimeRef.current,
+ );
+ const baseRect = webcamLayoutRef.current;
+
+ if (cameraFullProgress > 0 && baseRect && baseRect.width > 0 && baseRect.height > 0) {
+ // Full Camera takes over the webcam's size/position entirely: it grows to
+ // cover the whole stage. Like the reactive-zoom branch below, this only ever
+ // touches `transform` (never left/top/width/height, which stay driven by the
+ // `webcamLayout` React state in the JSX style prop) so it can't race React's
+ // re-render on every currentTime update. The base rect is lerped toward a
+ // full-stage rect and expressed as a translate+scale from the base rect's own
+ // box, matching the CSS transform box (border-box, top-left origin).
+ const stage = stageSizeRef.current;
+ const targetRect = computeCameraFullscreenTargetRect(stage, baseRect);
+ const fullRect: StyledRenderRect = {
+ x: targetRect.x,
+ y: targetRect.y,
+ width: targetRect.width,
+ height: targetRect.height,
+ borderRadius: 0,
+ maskShape: baseRect.maskShape,
+ };
+ const drawRect = lerpRect(baseRect, fullRect, cameraFullProgress);
+ const scaleX = drawRect.width / baseRect.width;
+ const scaleY = drawRect.height / baseRect.height;
+ const translateX = drawRect.x - baseRect.x;
+ const translateY = drawRect.y - baseRect.y;
+ webcamWrapper.style.transformOrigin = "0% 0%";
+ webcamWrapper.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
} else {
- webcamWrapper.style.transform = "";
+ const reactive =
+ webcamReactiveZoomRef.current &&
+ webcamLayoutPresetRef.current === "picture-in-picture";
+ const factor = reactive ? reactiveWebcamScale(state.appliedScale) : 1;
+ if (factor < 1) {
+ const pos = webcamPositionRef.current;
+ const originX = (pos ? pos.cx >= 0.5 : true) ? "100%" : "0%";
+ const originY = (pos ? pos.cy >= 0.5 : true) ? "100%" : "0%";
+ webcamWrapper.style.transformOrigin = `${originX} ${originY}`;
+ webcamWrapper.style.transform = `scale(${factor})`;
+ } else {
+ webcamWrapper.style.transform = "";
+ }
}
}
};
diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.ts
index 258efdf6a..4727b685e 100644
--- a/src/components/video-editor/projectPersistence.ts
+++ b/src/components/video-editor/projectPersistence.ts
@@ -15,6 +15,7 @@ import {
} from "./editorDefaults";
import {
type AnnotationRegion,
+ type CameraFullscreenRegion,
type CropRegion,
clampPlaybackSpeed,
DEFAULT_ANNOTATION_POSITION,
@@ -74,6 +75,7 @@ export interface ProjectEditorState {
padding: number;
cropRegion: CropRegion;
zoomRegions: ZoomRegion[];
+ cameraFullscreenRegions: CameraFullscreenRegion[];
autoZoomEnabled: boolean;
autoFocusAll: boolean;
trimRegions: TrimRegion[];
@@ -271,6 +273,26 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro
})
: [];
+ const normalizedCameraFullscreenRegions: CameraFullscreenRegion[] = Array.isArray(
+ editor.cameraFullscreenRegions,
+ )
+ ? editor.cameraFullscreenRegions
+ .filter((region): region is CameraFullscreenRegion =>
+ Boolean(region && typeof region.id === "string"),
+ )
+ .map((region) => {
+ const rawStart = isFiniteNumber(region.startMs) ? Math.round(region.startMs) : 0;
+ const rawEnd = isFiniteNumber(region.endMs) ? Math.round(region.endMs) : rawStart + 1000;
+ const startMs = Math.max(0, Math.min(rawStart, rawEnd));
+ const endMs = Math.max(startMs + 1, rawEnd);
+ return {
+ id: region.id,
+ startMs,
+ endMs,
+ };
+ })
+ : [];
+
const normalizedTrimRegions: TrimRegion[] = Array.isArray(editor.trimRegions)
? editor.trimRegions
.filter((region): region is TrimRegion => Boolean(region && typeof region.id === "string"))
@@ -484,6 +506,7 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro
height: cropHeight,
},
zoomRegions: normalizedZoomRegions,
+ cameraFullscreenRegions: normalizedCameraFullscreenRegions,
// Default on for legacy projects so re-opens match the new default. The
// on-load auto-suggest pass is gated separately, so this won't add zooms.
autoZoomEnabled: typeof editor.autoZoomEnabled === "boolean" ? editor.autoZoomEnabled : true,
diff --git a/src/components/video-editor/timeline/Item.tsx b/src/components/video-editor/timeline/Item.tsx
index 254c4f94b..ec4ca084d 100644
--- a/src/components/video-editor/timeline/Item.tsx
+++ b/src/components/video-editor/timeline/Item.tsx
@@ -1,6 +1,6 @@
import type { Span } from "dnd-timeline";
import { useItem } from "dnd-timeline";
-import { Gauge, MessageSquare, MousePointer2, Scissors, ZoomIn } from "lucide-react";
+import { Gauge, Maximize, MessageSquare, MousePointer2, Scissors, ZoomIn } from "lucide-react";
import { useMemo } from "react";
import { useScopedT } from "@/contexts/I18nContext";
import { cn } from "@/lib/utils";
@@ -17,7 +17,7 @@ interface ItemProps {
zoomCustomScale?: number;
speedValue?: number;
isAutoFocus?: boolean;
- variant?: "zoom" | "trim" | "annotation" | "speed" | "blur";
+ variant?: "zoom" | "camera-fullscreen" | "trim" | "annotation" | "speed" | "blur";
}
// Map zoom depth to multiplier labels
@@ -61,18 +61,29 @@ export default function Item({
});
const isZoom = variant === "zoom";
+ const isCameraFullscreen = variant === "camera-fullscreen";
const isTrim = variant === "trim";
const isSpeed = variant === "speed";
const glassClass = isZoom
? glassStyles.glassGreen
- : isTrim
- ? glassStyles.glassRed
- : isSpeed
- ? glassStyles.glassAmber
- : glassStyles.glassYellow;
+ : isCameraFullscreen
+ ? glassStyles.glassBlue
+ : isTrim
+ ? glassStyles.glassRed
+ : isSpeed
+ ? glassStyles.glassAmber
+ : glassStyles.glassYellow;
- const endCapColor = isZoom ? "#21916A" : isTrim ? "#ef4444" : isSpeed ? "#d97706" : "#B4A046";
+ const endCapColor = isZoom
+ ? "#21916A"
+ : isCameraFullscreen
+ ? "#0ea5e9"
+ : isTrim
+ ? "#ef4444"
+ : isSpeed
+ ? "#d97706"
+ : "#B4A046";
const timeLabel = useMemo(
() => `${formatMs(span.start)} – ${formatMs(span.end)}`,
@@ -146,6 +157,13 @@ export default function Item({
/>
)}
</>
+ ) : isCameraFullscreen ? (
+ <>
+ <Maximize className="w-3.5 h-3.5 shrink-0" />
+ <span className="text-[11px] font-semibold whitespace-nowrap">
+ {t("labels.cameraFullscreen")}
+ </span>
+ </>
) : isTrim ? (
<>
<Scissors className="w-3.5 h-3.5 shrink-0" />
diff --git a/src/components/video-editor/timeline/ItemGlass.module.css b/src/components/video-editor/timeline/ItemGlass.module.css
index 9fdbacdb6..94fcbadee 100644
--- a/src/components/video-editor/timeline/ItemGlass.module.css
+++ b/src/components/video-editor/timeline/ItemGlass.module.css
@@ -110,6 +110,34 @@
z-index: 10;
}
+.glassBlue {
+ position: relative;
+ border-radius: 10px;
+ -corner-smoothing: antialiased;
+ background: linear-gradient(180deg, rgba(56, 189, 248, 0.28), rgba(14, 116, 144, 0.2));
+ border: 1px solid rgba(56, 189, 248, 0.36);
+ box-shadow:
+ 0 1px 0 rgba(255, 255, 255, 0.1) inset,
+ 0 8px 22px rgba(0, 0, 0, 0.22);
+ margin: 3px 0;
+ transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+.glassBlue:hover {
+ background: linear-gradient(180deg, rgba(56, 189, 248, 0.36), rgba(14, 116, 144, 0.25));
+ border-color: rgba(56, 189, 248, 0.62);
+}
+
+.glassBlue.selected {
+ background: linear-gradient(180deg, rgba(56, 189, 248, 0.48), rgba(14, 116, 144, 0.32));
+ border-color: #38bdf8;
+ box-shadow:
+ 0 0 0 1px rgba(56, 189, 248, 0.95),
+ 0 0 0 4px rgba(56, 189, 248, 0.14),
+ 0 12px 26px rgba(0, 0, 0, 0.28);
+ z-index: 10;
+}
+
.zoomEndCap {
position: absolute;
top: 0;
@@ -130,7 +158,9 @@
.glassYellow:hover .zoomEndCap,
.glassYellow.selected .zoomEndCap,
.glassAmber:hover .zoomEndCap,
-.glassAmber.selected .zoomEndCap {
+.glassAmber.selected .zoomEndCap,
+.glassBlue:hover .zoomEndCap,
+.glassBlue.selected .zoomEndCap {
opacity: 1;
}
diff --git a/src/components/video-editor/timeline/TimelineEditor.tsx b/src/components/video-editor/timeline/TimelineEditor.tsx
index 96965a012..cba7950e2 100644
--- a/src/components/video-editor/timeline/TimelineEditor.tsx
+++ b/src/components/video-editor/timeline/TimelineEditor.tsx
@@ -5,6 +5,7 @@ import {
Check,
ChevronDown,
Gauge,
+ Maximize,
MessageSquare,
Plus,
ScanEye,
@@ -31,7 +32,13 @@ import { ASPECT_RATIOS, type AspectRatio, getAspectRatioLabel } from "@/utils/as
import { formatShortcut } from "@/utils/platformUtils";
import { BLUR_REGIONS_ENABLED } from "../featureFlags";
import { findFreeGapAt } from "../regionPlacement";
-import type { AnnotationRegion, SpeedRegion, TrimRegion, ZoomRegion } from "../types";
+import type {
+ AnnotationRegion,
+ CameraFullscreenRegion,
+ SpeedRegion,
+ TrimRegion,
+ ZoomRegion,
+} from "../types";
import BackgroundWaveform from "./BackgroundWaveform";
import Item from "./Item";
import KeyframeMarkers from "./KeyframeMarkers";
@@ -39,6 +46,7 @@ import Row from "./Row";
import TimelineWrapper from "./TimelineWrapper";
const ZOOM_ROW_ID = "row-zoom";
+const CAMERA_ROW_ID = "row-camera-fullscreen";
const TRIM_ROW_ID = "row-trim";
const ANNOTATION_ROW_ID = "row-annotation";
const BLUR_ROW_ID = "row-blur";
@@ -63,6 +71,12 @@ interface TimelineEditorProps {
onZoomDelete: (id: string) => void;
selectedZoomId: string | null;
onSelectZoom: (id: string | null) => void;
+ cameraFullscreenRegions?: CameraFullscreenRegion[];
+ onCameraFullscreenAdded?: (span: Span) => void;
+ onCameraFullscreenSpanChange?: (id: string, span: Span) => void;
+ onCameraFullscreenDelete?: (id: string) => void;
+ selectedCameraFullscreenId?: string | null;
+ onSelectCameraFullscreen?: (id: string | null) => void;
trimRegions?: TrimRegion[];
onTrimAdded?: (span: Span) => void;
onTrimSpanChange?: (id: string, span: Span) => void;
@@ -113,7 +127,7 @@ interface TimelineRenderItem {
zoomCustomScale?: number;
speedValue?: number;
isAutoFocus?: boolean;
- variant: "zoom" | "trim" | "annotation" | "speed" | "blur";
+ variant: "zoom" | "camera-fullscreen" | "trim" | "annotation" | "speed" | "blur";
}
const SCALE_CANDIDATES = [
@@ -560,11 +574,13 @@ function Timeline({
onSeek,
onRangeChange,
onSelectZoom,
+ onSelectCameraFullscreen,
onSelectTrim,
onSelectAnnotation,
onSelectBlur,
onSelectSpeed,
selectedZoomId,
+ selectedCameraFullscreenId,
selectedTrimId,
selectedAnnotationId,
selectedBlurId,
@@ -579,11 +595,13 @@ function Timeline({
onSeek?: (time: number) => void;
onRangeChange?: (updater: (previous: Range) => Range) => void;
onSelectZoom?: (id: string | null) => void;
+ onSelectCameraFullscreen?: (id: string | null) => void;
onSelectTrim?: (id: string | null) => void;
onSelectAnnotation?: (id: string | null) => void;
onSelectBlur?: (id: string | null) => void;
onSelectSpeed?: (id: string | null) => void;
selectedZoomId: string | null;
+ selectedCameraFullscreenId?: string | null;
selectedTrimId?: string | null;
selectedAnnotationId?: string | null;
selectedBlurId?: string | null;
@@ -627,11 +645,19 @@ function Timeline({
const clearTimelineSelection = useCallback(() => {
onSelectZoom?.(null);
+ onSelectCameraFullscreen?.(null);
onSelectTrim?.(null);
onSelectAnnotation?.(null);
onSelectBlur?.(null);
onSelectSpeed?.(null);
- }, [onSelectZoom, onSelectTrim, onSelectAnnotation, onSelectBlur, onSelectSpeed]);
+ }, [
+ onSelectZoom,
+ onSelectCameraFullscreen,
+ onSelectTrim,
+ onSelectAnnotation,
+ onSelectBlur,
+ onSelectSpeed,
+ ]);
const handleTimelineClick = useCallback(
(e: React.MouseEvent<HTMLDivElement>) => {
@@ -746,6 +772,7 @@ function Timeline({
);
const zoomItems = items.filter((item) => item.rowId === ZOOM_ROW_ID);
+ const cameraFullscreenItems = items.filter((item) => item.rowId === CAMERA_ROW_ID);
const trimItems = items.filter((item) => item.rowId === TRIM_ROW_ID);
const annotationItems = items.filter((item) => item.rowId === ANNOTATION_ROW_ID);
const blurItems = items.filter((item) => item.rowId === BLUR_ROW_ID);
@@ -795,6 +822,26 @@ function Timeline({
))}
</Row>
+ <Row
+ id={CAMERA_ROW_ID}
+ isEmpty={cameraFullscreenItems.length === 0}
+ hint={t("hints.pressCameraFullscreen")}
+ >
+ {cameraFullscreenItems.map((item) => (
+ <Item
+ id={item.id}
+ key={item.id}
+ rowId={item.rowId}
+ span={item.span}
+ isSelected={item.id === selectedCameraFullscreenId}
+ onSelect={() => onSelectCameraFullscreen?.(item.id)}
+ variant="camera-fullscreen"
+ >
+ {item.label}
+ </Item>
+ ))}
+ </Row>
+
<Row
id={TRIM_ROW_ID}
isEmpty={trimItems.length === 0}
@@ -898,6 +945,12 @@ export default function TimelineEditor({
onZoomDelete,
selectedZoomId,
onSelectZoom,
+ cameraFullscreenRegions = [],
+ onCameraFullscreenAdded,
+ onCameraFullscreenSpanChange,
+ onCameraFullscreenDelete,
+ selectedCameraFullscreenId,
+ onSelectCameraFullscreen,
trimRegions = [],
onTrimAdded,
onTrimSpanChange,
@@ -988,6 +1041,14 @@ export default function TimelineEditor({
onSelectZoom(null);
}, [selectedZoomId, onZoomDelete, onSelectZoom]);
+ const deleteSelectedCameraFullscreen = useCallback(() => {
+ if (!selectedCameraFullscreenId || !onCameraFullscreenDelete || !onSelectCameraFullscreen) {
+ return;
+ }
+ onCameraFullscreenDelete(selectedCameraFullscreenId);
+ onSelectCameraFullscreen(null);
+ }, [selectedCameraFullscreenId, onCameraFullscreenDelete, onSelectCameraFullscreen]);
+
const deleteSelectedTrim = useCallback(() => {
if (!selectedTrimId || !onTrimDelete || !onSelectTrim) return;
onTrimDelete(selectedTrimId);
@@ -1019,9 +1080,11 @@ export default function TimelineEditor({
// Normalize regions only when timeline bounds change. Reading via refs avoids a
// dependency loop that would re-fire on every drag and race dnd-timeline's state.
const zoomRegionsRef = useRef(zoomRegions);
+ const cameraFullscreenRegionsRef = useRef(cameraFullscreenRegions);
const trimRegionsRef = useRef(trimRegions);
const speedRegionsRef = useRef(speedRegions);
zoomRegionsRef.current = zoomRegions;
+ cameraFullscreenRegionsRef.current = cameraFullscreenRegions;
trimRegionsRef.current = trimRegions;
speedRegionsRef.current = speedRegions;
@@ -1042,6 +1105,18 @@ export default function TimelineEditor({
}
});
+ cameraFullscreenRegionsRef.current.forEach((region) => {
+ const clampedStart = Math.max(0, Math.min(region.startMs, totalMs));
+ const minEnd = clampedStart + safeMinDurationMs;
+ const clampedEnd = Math.min(totalMs, Math.max(minEnd, region.endMs));
+ const normalizedStart = Math.max(0, Math.min(clampedStart, totalMs - safeMinDurationMs));
+ const normalizedEnd = Math.max(minEnd, Math.min(clampedEnd, totalMs));
+
+ if (normalizedStart !== region.startMs || normalizedEnd !== region.endMs) {
+ onCameraFullscreenSpanChange?.(region.id, { start: normalizedStart, end: normalizedEnd });
+ }
+ });
+
trimRegionsRef.current.forEach((region) => {
const clampedStart = Math.max(0, Math.min(region.startMs, totalMs));
const minEnd = clampedStart + safeMinDurationMs;
@@ -1065,11 +1140,19 @@ export default function TimelineEditor({
onSpeedSpanChange?.(region.id, { start: normalizedStart, end: normalizedEnd });
}
});
- }, [totalMs, safeMinDurationMs, onZoomSpanChange, onTrimSpanChange, onSpeedSpanChange]);
+ }, [
+ totalMs,
+ safeMinDurationMs,
+ onZoomSpanChange,
+ onCameraFullscreenSpanChange,
+ onTrimSpanChange,
+ onSpeedSpanChange,
+ ]);
const hasOverlap = useCallback(
(newSpan: Span, excludeId?: string): boolean => {
const isZoomItem = zoomRegions.some((r) => r.id === excludeId);
+ const isCameraFullscreenItem = cameraFullscreenRegions.some((r) => r.id === excludeId);
const isTrimItem = trimRegions.some((r) => r.id === excludeId);
const isAnnotationItem = annotationRegions.some((r) => r.id === excludeId);
const isBlurItem = blurRegions.some((r) => r.id === excludeId);
@@ -1079,7 +1162,9 @@ export default function TimelineEditor({
return false;
}
- const checkOverlap = (regions: (ZoomRegion | TrimRegion | SpeedRegion)[]) => {
+ const checkOverlap = (
+ regions: (ZoomRegion | CameraFullscreenRegion | TrimRegion | SpeedRegion)[],
+ ) => {
return regions.some((region) => {
if (region.id === excludeId) return false;
// True intersection, adjacency is allowed
@@ -1091,6 +1176,10 @@ export default function TimelineEditor({
return checkOverlap(zoomRegions);
}
+ if (isCameraFullscreenItem) {
+ return checkOverlap(cameraFullscreenRegions);
+ }
+
if (isTrimItem) {
return checkOverlap(trimRegions);
}
@@ -1101,7 +1190,14 @@ export default function TimelineEditor({
return false;
},
- [zoomRegions, trimRegions, annotationRegions, blurRegions, speedRegions],
+ [
+ zoomRegions,
+ cameraFullscreenRegions,
+ trimRegions,
+ annotationRegions,
+ blurRegions,
+ speedRegions,
+ ],
);
// 5% of the timeline or 1000ms, whichever is larger, so it's wide enough to grab.
@@ -1133,6 +1229,37 @@ export default function TimelineEditor({
onZoomAdded({ start: startPos, end: startPos + actualDuration });
}, [videoDuration, totalMs, currentTimeMs, zoomRegions, onZoomAdded, defaultRegionDurationMs, t]);
+ const handleAddCameraFullscreen = useCallback(() => {
+ if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onCameraFullscreenAdded) {
+ return;
+ }
+
+ const defaultDuration = Math.min(defaultRegionDurationMs, totalMs);
+ if (defaultDuration <= 0) {
+ return;
+ }
+
+ const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));
+ const { ok, gapMs } = findFreeGapAt(cameraFullscreenRegions, startPos, totalMs);
+ if (!ok) {
+ toast.error(t("errors.cannotPlaceCameraFullscreen"), {
+ description: t("errors.cameraFullscreenExistsAtLocation"),
+ });
+ return;
+ }
+
+ const actualDuration = Math.min(defaultRegionDurationMs, gapMs);
+ onCameraFullscreenAdded({ start: startPos, end: startPos + actualDuration });
+ }, [
+ videoDuration,
+ totalMs,
+ currentTimeMs,
+ cameraFullscreenRegions,
+ onCameraFullscreenAdded,
+ defaultRegionDurationMs,
+ t,
+ ]);
+
const handleAddTrim = useCallback(() => {
if (!videoDuration || videoDuration === 0 || totalMs === 0 || !onTrimAdded) {
return;
@@ -1243,6 +1370,9 @@ export default function TimelineEditor({
if (matchesShortcut(e, keyShortcuts.addSpeed, isMac)) {
handleAddSpeed();
}
+ if (matchesShortcut(e, keyShortcuts.addCameraFullscreen, isMac)) {
+ handleAddCameraFullscreen();
+ }
// Tab cycles through overlapping annotations at the current time
if (e.key === "Tab" && annotationRegions.length > 0) {
@@ -1275,6 +1405,8 @@ export default function TimelineEditor({
deleteSelectedKeyframe();
} else if (selectedZoomId) {
deleteSelectedZoom();
+ } else if (selectedCameraFullscreenId) {
+ deleteSelectedCameraFullscreen();
} else if (selectedTrimId) {
deleteSelectedTrim();
} else if (selectedAnnotationId) {
@@ -1295,14 +1427,17 @@ export default function TimelineEditor({
handleAddAnnotation,
handleAddBlur,
handleAddSpeed,
+ handleAddCameraFullscreen,
deleteSelectedKeyframe,
deleteSelectedZoom,
+ deleteSelectedCameraFullscreen,
deleteSelectedTrim,
deleteSelectedAnnotation,
deleteSelectedBlur,
deleteSelectedSpeed,
selectedKeyframeId,
selectedZoomId,
+ selectedCameraFullscreenId,
selectedTrimId,
selectedAnnotationId,
selectedBlurId,
@@ -1337,6 +1472,16 @@ export default function TimelineEditor({
variant: "zoom",
}));
+ const cameraFullscreens: TimelineRenderItem[] = cameraFullscreenRegions.map(
+ (region, index) => ({
+ id: region.id,
+ rowId: CAMERA_ROW_ID,
+ span: { start: region.startMs, end: region.endMs },
+ label: t("labels.cameraFullscreenItem", { index: String(index + 1) }),
+ variant: "camera-fullscreen",
+ }),
+ );
+
const trims: TimelineRenderItem[] = trimRegions.map((region, index) => ({
id: region.id,
rowId: TRIM_ROW_ID,
@@ -1383,17 +1528,30 @@ export default function TimelineEditor({
variant: "speed",
}));
- return [...zooms, ...trims, ...annotations, ...blurs, ...speeds];
- }, [zoomRegions, trimRegions, annotationRegions, blurRegions, speedRegions, t]);
+ return [...zooms, ...cameraFullscreens, ...trims, ...annotations, ...blurs, ...speeds];
+ }, [
+ zoomRegions,
+ cameraFullscreenRegions,
+ trimRegions,
+ annotationRegions,
+ blurRegions,
+ speedRegions,
+ t,
+ ]);
// Spans that participate in overlap resolution (clampToNeighbours). Annotation
// and blur are excluded since they may overlap and shouldn't constrain a drag.
const allRegionSpans = useMemo(() => {
const zooms = zoomRegions.map((r) => ({ id: r.id, start: r.startMs, end: r.endMs }));
+ const cameraFullscreens = cameraFullscreenRegions.map((r) => ({
+ id: r.id,
+ start: r.startMs,
+ end: r.endMs,
+ }));
const trims = trimRegions.map((r) => ({ id: r.id, start: r.startMs, end: r.endMs }));
const speeds = speedRegions.map((r) => ({ id: r.id, start: r.startMs, end: r.endMs }));
- return [...zooms, ...trims, ...speeds];
- }, [zoomRegions, trimRegions, speedRegions]);
+ return [...zooms, ...cameraFullscreens, ...trims, ...speeds];
+ }, [zoomRegions, cameraFullscreenRegions, trimRegions, speedRegions]);
// Snap targets whose edges pull during a snap but don't push anyone away.
const softSnapSpans = useMemo(() => {
@@ -1412,6 +1570,8 @@ export default function TimelineEditor({
(id: string, span: Span) => {
if (zoomRegions.some((r) => r.id === id)) {
onZoomSpanChange(id, span);
+ } else if (cameraFullscreenRegions.some((r) => r.id === id)) {
+ onCameraFullscreenSpanChange?.(id, span);
} else if (trimRegions.some((r) => r.id === id)) {
onTrimSpanChange?.(id, span);
} else if (speedRegions.some((r) => r.id === id)) {
@@ -1424,11 +1584,13 @@ export default function TimelineEditor({
},
[
zoomRegions,
+ cameraFullscreenRegions,
trimRegions,
speedRegions,
annotationRegions,
blurRegions,
onZoomSpanChange,
+ onCameraFullscreenSpanChange,
onTrimSpanChange,
onSpeedSpanChange,
onAnnotationSpanChange,
@@ -1469,6 +1631,15 @@ export default function TimelineEditor({
>
<ZoomIn className="w-4 h-4" />
</Button>
+ <Button
+ onClick={handleAddCameraFullscreen}
+ variant="ghost"
+ size="icon"
+ className="h-7 w-7 rounded-lg text-slate-400 hover:text-[#38bdf8] hover:bg-[#38bdf8]/10 transition-all"
+ title={t("buttons.addCameraFullscreen")}
+ >
+ <Maximize className="w-4 h-4" />
+ </Button>
<Button
onClick={() => onToggleAutoZoom?.(!autoZoomEnabled)}
variant="ghost"
@@ -1631,11 +1802,13 @@ export default function TimelineEditor({
onSeek={onSeek}
onRangeChange={setRange}
onSelectZoom={onSelectZoom}
+ onSelectCameraFullscreen={onSelectCameraFullscreen}
onSelectTrim={onSelectTrim}
onSelectAnnotation={onSelectAnnotation}
onSelectBlur={onSelectBlur}
onSelectSpeed={onSelectSpeed}
selectedZoomId={selectedZoomId}
+ selectedCameraFullscreenId={selectedCameraFullscreenId}
selectedTrimId={selectedTrimId}
selectedAnnotationId={selectedAnnotationId}
selectedBlurId={selectedBlurId}
diff --git a/src/components/video-editor/types.ts b/src/components/video-editor/types.ts
index 4406ee961..27e740211 100644
--- a/src/components/video-editor/types.ts
+++ b/src/components/video-editor/types.ts
@@ -214,6 +214,19 @@ export interface TrimRegion {
endMs: number;
}
+/**
+ * "Full Camera" / "Cut to camera" timeline region. During this span, the webcam overlay
+ * animates its size/position until it covers the entire canvas, visually hiding the
+ * desktop behind it (the desktop keeps recording underneath, it's just covered).
+ * No focus/depth/rotation needed: unlike ZoomRegion, the destination is always "fill the
+ * canvas", so the shape stays intentionally simpler.
+ */
+export interface CameraFullscreenRegion {
+ id: string;
+ startMs: number;
+ endMs: number;
+}
+
export type AnnotationType = "text" | "image" | "figure" | "blur";
export type ArrowDirection =
diff --git a/src/components/video-editor/videoPlayback/cameraFullscreenUtils.test.ts b/src/components/video-editor/videoPlayback/cameraFullscreenUtils.test.ts
new file mode 100644
index 000000000..49ff853af
--- /dev/null
+++ b/src/components/video-editor/videoPlayback/cameraFullscreenUtils.test.ts
@@ -0,0 +1,135 @@
+import { describe, expect, it } from "vitest";
+import type { CameraFullscreenRegion } from "../types";
+import { computeCameraFullscreenProgress } from "./cameraFullscreenUtils";
+import { TRANSITION_WINDOW_MS } from "./constants";
+
+function makeRegion(startMs: number, endMs: number): CameraFullscreenRegion {
+ return { id: `camera-${startMs}-${endMs}`, startMs, endMs };
+}
+
+describe("computeCameraFullscreenProgress", () => {
+ it("returns 0 for an empty regions array", () => {
+ expect(computeCameraFullscreenProgress([], 1000)).toBe(0);
+ });
+
+ it("returns 0 well outside any region", () => {
+ const region = makeRegion(5000, 8000);
+ expect(computeCameraFullscreenProgress([region], 0)).toBe(0);
+ expect(computeCameraFullscreenProgress([region], 20000)).toBe(0);
+ });
+
+ it("returns exactly 0 at startMs and at endMs", () => {
+ const region = makeRegion(5000, 8000);
+ expect(computeCameraFullscreenProgress([region], region.startMs)).toBe(0);
+ expect(computeCameraFullscreenProgress([region], region.endMs)).toBe(0);
+ });
+
+ it("returns 1 in the middle (hold) of a region", () => {
+ const region = makeRegion(5000, 8000);
+ expect(computeCameraFullscreenProgress([region], 6500)).toBe(1);
+ });
+
+ it("holds at 1 for the full duration between the lead-in and lead-out windows", () => {
+ const region = makeRegion(1000, 3000);
+ const leadInEnd = region.startMs + TRANSITION_WINDOW_MS;
+ const leadOutStart = region.endMs - TRANSITION_WINDOW_MS;
+ expect(computeCameraFullscreenProgress([region], leadInEnd)).toBeCloseTo(1, 5);
+ expect(computeCameraFullscreenProgress([region], leadOutStart)).toBeCloseTo(1, 5);
+ expect(computeCameraFullscreenProgress([region], (leadInEnd + leadOutStart) / 2)).toBe(1);
+ });
+
+ it("eases in from 0 (at startMs) toward 1 entirely within the region", () => {
+ const region = makeRegion(5000, 8000);
+ const leadInEnd = region.startMs + TRANSITION_WINDOW_MS;
+
+ const atStart = computeCameraFullscreenProgress([region], region.startMs);
+ const midway = computeCameraFullscreenProgress([region], (region.startMs + leadInEnd) / 2);
+ const atLeadInEnd = computeCameraFullscreenProgress([region], leadInEnd);
+
+ expect(atStart).toBe(0);
+ expect(midway).toBeGreaterThan(0);
+ expect(midway).toBeLessThan(1);
+ expect(atLeadInEnd).toBeCloseTo(1, 5);
+ // Monotonically increasing during ease-in.
+ expect(midway).toBeGreaterThan(atStart);
+ expect(atLeadInEnd).toBeGreaterThan(midway);
+ });
+
+ it("eases out from 1 toward 0, landing exactly at endMs", () => {
+ const region = makeRegion(5000, 8000);
+ const leadOutWindow = Math.min(TRANSITION_WINDOW_MS * 1.5, (region.endMs - region.startMs) / 2);
+ const leadOutStart = region.endMs - leadOutWindow;
+
+ const atLeadOutStart = computeCameraFullscreenProgress([region], leadOutStart);
+ const midway = computeCameraFullscreenProgress([region], (leadOutStart + region.endMs) / 2);
+ const atEndMs = computeCameraFullscreenProgress([region], region.endMs);
+
+ expect(atLeadOutStart).toBeCloseTo(1, 5);
+ expect(midway).toBeGreaterThan(0);
+ expect(midway).toBeLessThan(1);
+ expect(atEndMs).toBe(0);
+ // Monotonically decreasing during ease-out.
+ expect(midway).toBeLessThan(atLeadOutStart);
+ expect(atEndMs).toBeLessThan(midway);
+ });
+
+ it("eases out over a longer window than it eases in (slower return to normal)", () => {
+ // Long region so neither window is clamped: lead-in is TRANSITION_WINDOW_MS,
+ // lead-out is 1.5x that. At TRANSITION_WINDOW_MS from the start the ease-in has
+ // finished, but at the mirrored offset from the end the ease-out is still going.
+ const region = makeRegion(5000, 15000);
+ const atLeadInEnd = computeCameraFullscreenProgress(
+ [region],
+ region.startMs + TRANSITION_WINDOW_MS,
+ );
+ const mirroredNearEnd = computeCameraFullscreenProgress(
+ [region],
+ region.endMs - TRANSITION_WINDOW_MS,
+ );
+ expect(atLeadInEnd).toBeCloseTo(1, 5);
+ expect(mirroredNearEnd).toBeLessThan(1);
+ expect(mirroredNearEnd).toBeGreaterThan(0);
+ });
+
+ it("returns exactly 0 just past endMs and just before startMs", () => {
+ const region = makeRegion(5000, 8000);
+ expect(computeCameraFullscreenProgress([region], region.endMs + 1)).toBe(0);
+ expect(computeCameraFullscreenProgress([region], region.startMs - 1)).toBe(0);
+ });
+
+ it("clamps the transition windows to half the region duration for short regions", () => {
+ // Region shorter than 2x TRANSITION_WINDOW_MS: lead-in and lead-out windows must
+ // each shrink to half the duration so they still meet exactly at the midpoint,
+ // staying fully contained within [startMs, endMs].
+ const region = makeRegion(1000, 1000 + TRANSITION_WINDOW_MS); // duration < 2x window
+ const midpoint = (region.startMs + region.endMs) / 2;
+
+ expect(computeCameraFullscreenProgress([region], region.startMs)).toBe(0);
+ expect(computeCameraFullscreenProgress([region], region.endMs)).toBe(0);
+ expect(computeCameraFullscreenProgress([region], midpoint)).toBeCloseTo(1, 5);
+ });
+
+ it("picks the strongest of multiple overlapping regions", () => {
+ // Two regions that don't normally overlap in the UI, but the function should be
+ // defensive: whichever region yields the higher strength wins for that instant.
+ const early = makeRegion(0, 2000);
+ const late = makeRegion(1800, 5000);
+ const timeMs = 1900; // inside early's ease-out and late's ease-in
+ const combinedStrongest = Math.max(
+ computeCameraFullscreenProgress([early], timeMs),
+ computeCameraFullscreenProgress([late], timeMs),
+ );
+ expect(computeCameraFullscreenProgress([early, late], timeMs)).toBeCloseTo(
+ combinedStrongest,
+ 10,
+ );
+ });
+
+ it("handles multiple disjoint regions independently", () => {
+ const first = makeRegion(0, 1000);
+ const second = makeRegion(10000, 12000);
+ expect(computeCameraFullscreenProgress([first, second], 500)).toBe(1);
+ expect(computeCameraFullscreenProgress([first, second], 5000)).toBe(0);
+ expect(computeCameraFullscreenProgress([first, second], 11000)).toBe(1);
+ });
+});
diff --git a/src/components/video-editor/videoPlayback/cameraFullscreenUtils.ts b/src/components/video-editor/videoPlayback/cameraFullscreenUtils.ts
new file mode 100644
index 000000000..bf7228d40
--- /dev/null
+++ b/src/components/video-editor/videoPlayback/cameraFullscreenUtils.ts
@@ -0,0 +1,66 @@
+import type { CameraFullscreenRegion } from "../types";
+import { TRANSITION_WINDOW_MS } from "./constants";
+import { easeOutScreenStudio } from "./mathUtils";
+
+// The return to the normal layout should feel gentler than the expansion, so the
+// lead-out window is stretched relative to the lead-in one.
+const LEAD_OUT_WINDOW_MS = TRANSITION_WINDOW_MS * 1.5;
+
+/**
+ * Ease-in/hold/ease-out envelope for a single region. Unlike zoom's
+ * `computeRegionStrength` (which anticipates the transition before `startMs`),
+ * Full Camera must stay fully contained within [startMs, endMs]: progress is
+ * exactly 0 at startMs, eases up to 1 within a lead-in window that starts at
+ * startMs, holds at 1, then eases back down to exactly 0 at endMs (over a longer
+ * window than the lead-in). Outside [startMs, endMs] progress is always 0. The
+ * transition windows are clamped to at most half the region's duration so short
+ * regions still ease in/out fully within their own bounds instead of overlapping.
+ */
+function computeCameraFullscreenRegionStrength(
+ region: CameraFullscreenRegion,
+ timeMs: number,
+): number {
+ if (timeMs <= region.startMs || timeMs >= region.endMs) {
+ return 0;
+ }
+
+ const duration = region.endMs - region.startMs;
+ const halfDuration = duration / 2;
+ const leadInWindow = Math.min(TRANSITION_WINDOW_MS, halfDuration);
+ const leadOutWindow = Math.min(LEAD_OUT_WINDOW_MS, halfDuration);
+ const leadInEnd = region.startMs + leadInWindow;
+ const leadOutStart = region.endMs - leadOutWindow;
+
+ if (timeMs < leadInEnd) {
+ const progress = leadInWindow > 0 ? (timeMs - region.startMs) / leadInWindow : 1;
+ return easeOutScreenStudio(progress);
+ }
+
+ if (timeMs <= leadOutStart) {
+ return 1;
+ }
+
+ const progress = leadOutWindow > 0 ? (region.endMs - timeMs) / leadOutWindow : 0;
+ return easeOutScreenStudio(progress);
+}
+
+/**
+ * Returns the Full Camera progress (0..1) at a given time: 0 = webcam at its normal
+ * layout, 1 = webcam fully covering the canvas. Ramps in/out at the edges of the
+ * dominant region using the same easing as zoom. When multiple regions overlap
+ * (shouldn't normally happen given timeline overlap guards, but is handled
+ * defensively) the strongest one wins.
+ */
+export function computeCameraFullscreenProgress(
+ regions: CameraFullscreenRegion[],
+ timeMs: number,
+): number {
+ let strongest = 0;
+ for (const region of regions) {
+ const strength = computeCameraFullscreenRegionStrength(region, timeMs);
+ if (strength > strongest) {
+ strongest = strength;
+ }
+ }
+ return strongest;
+}
diff --git a/src/hooks/useEditorHistory.ts b/src/hooks/useEditorHistory.ts
index 9ca00440b..2b105e175 100644
--- a/src/hooks/useEditorHistory.ts
+++ b/src/hooks/useEditorHistory.ts
@@ -6,6 +6,7 @@ import {
} from "@/components/video-editor/editorDefaults";
import type {
AnnotationRegion,
+ CameraFullscreenRegion,
CropRegion,
SpeedRegion,
TrimRegion,
@@ -26,6 +27,7 @@ import type { AspectRatio } from "@/utils/aspectRatioUtils";
// would feel surprising.
export interface EditorState {
zoomRegions: ZoomRegion[];
+ cameraFullscreenRegions: CameraFullscreenRegion[];
/** Magic-wand auto-zoom toggle. When on, fresh recordings get suggested zooms. */
autoZoomEnabled: boolean;
/** Global Auto-Focus toggle: when on, all zooms follow the cursor and the
@@ -53,6 +55,7 @@ export interface EditorState {
export const INITIAL_EDITOR_STATE: EditorState = {
zoomRegions: [],
+ cameraFullscreenRegions: [],
autoZoomEnabled: true,
autoFocusAll: false,
trimRegions: [],
diff --git a/src/i18n/locales/ar/shortcuts.json b/src/i18n/locales/ar/shortcuts.json
index 44c2f22fd..fa4472bce 100644
--- a/src/i18n/locales/ar/shortcuts.json
+++ b/src/i18n/locales/ar/shortcuts.json
@@ -22,6 +22,7 @@
"addAnnotation": "إضافة شرح",
"addBlur": "إضافة تمويه",
"addKeyframe": "إضافة إطار رئيسي",
+ "addCameraFullscreen": "إضافة كاميرا كاملة الشاشة",
"deleteSelected": "حذف المحدد",
"playPause": "تشغيل / إيقاف مؤقت",
"copySelected": "نسخ المحدد",
diff --git a/src/i18n/locales/ar/timeline.json b/src/i18n/locales/ar/timeline.json
index 09d55c4af..bd57d650e 100644
--- a/src/i18n/locales/ar/timeline.json
+++ b/src/i18n/locales/ar/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "إضافة قص (T)",
"addAnnotation": "إضافة شرح (A)",
"addBlur": "إضافة تمويه (B)",
- "addSpeed": "إضافة سرعة (S)"
+ "addSpeed": "إضافة سرعة (S)",
+ "addCameraFullscreen": "إضافة كاميرا كاملة الشاشة (C)"
},
"hints": {
"pressZoom": "اضغط Z لإضافة تكبير",
"pressTrim": "اضغط T لإضافة قص",
"pressAnnotation": "اضغط A لإضافة شرح",
"pressBlur": "اضغط B لإضافة منطقة تمويه",
- "pressSpeed": "اضغط S لإضافة سرعة"
+ "pressSpeed": "اضغط S لإضافة سرعة",
+ "pressCameraFullscreen": "اضغط C لإضافة مقطع كاميرا كاملة الشاشة"
},
"labels": {
"pan": "تحريك",
@@ -25,7 +27,9 @@
"annotationItem": "شرح",
"blurItem": "تمويه {{index}}",
"imageItem": "صورة",
- "emptyText": "نص فارغ"
+ "emptyText": "نص فارغ",
+ "cameraFullscreen": "كاميرا كاملة الشاشة",
+ "cameraFullscreenItem": "كاميرا كاملة الشاشة {{index}}"
},
"emptyState": {
"noVideo": "لم يتم تحميل أي فيديو",
@@ -46,7 +50,9 @@
"cannotPlaceTrim": "لا يمكن وضع القص هنا",
"trimExistsAtLocation": "يوجد قص بالفعل في هذا الموقع أو لا توجد مساحة كافية متاحة.",
"cannotPlaceSpeed": "لا يمكن وضع السرعة هنا",
- "speedExistsAtLocation": "توجد منطقة سرعة بالفعل في هذا الموقع أو لا توجد مساحة كافية متاحة."
+ "speedExistsAtLocation": "توجد منطقة سرعة بالفعل في هذا الموقع أو لا توجد مساحة كافية متاحة.",
+ "cannotPlaceCameraFullscreen": "لا يمكن وضع الكاميرا الكاملة هنا",
+ "cameraFullscreenExistsAtLocation": "يوجد بالفعل مقطع كاميرا كاملة الشاشة في هذا الموقع أو لا توجد مساحة كافية متاحة."
},
"success": {
"addedZoomSuggestions": "تمت إضافة {{count}} اقتراح تكبير بناءً على المؤشر",
diff --git a/src/i18n/locales/en/shortcuts.json b/src/i18n/locales/en/shortcuts.json
index d5a4b0dd8..3d4d6de51 100644
--- a/src/i18n/locales/en/shortcuts.json
+++ b/src/i18n/locales/en/shortcuts.json
@@ -22,6 +22,7 @@
"addAnnotation": "Add Annotation",
"addBlur": "Add Blur",
"addKeyframe": "Add Keyframe",
+ "addCameraFullscreen": "Add Full Camera",
"deleteSelected": "Delete Selected",
"playPause": "Play / Pause",
"copySelected": "Copy Selected",
diff --git a/src/i18n/locales/en/timeline.json b/src/i18n/locales/en/timeline.json
index 4fc250828..a906edcd8 100644
--- a/src/i18n/locales/en/timeline.json
+++ b/src/i18n/locales/en/timeline.json
@@ -9,14 +9,16 @@
"addTrim": "Add Trim (T)",
"addAnnotation": "Add Annotation (A)",
"addBlur": "Add Blur (B)",
- "addSpeed": "Add Speed (S)"
+ "addSpeed": "Add Speed (S)",
+ "addCameraFullscreen": "Add Full Camera (C)"
},
"hints": {
"pressZoom": "Press Z to add zoom",
"pressTrim": "Press T to add trim",
"pressAnnotation": "Press A to add annotation",
"pressBlur": "Press B to add blur region",
- "pressSpeed": "Press S to add speed"
+ "pressSpeed": "Press S to add speed",
+ "pressCameraFullscreen": "Press C to add a Full Camera segment"
},
"labels": {
"pan": "Pan",
@@ -29,7 +31,9 @@
"annotationItem": "Annotation",
"blurItem": "Blur {{index}}",
"imageItem": "Image",
- "emptyText": "Empty text"
+ "emptyText": "Empty text",
+ "cameraFullscreen": "Full Camera",
+ "cameraFullscreenItem": "Full Camera {{index}}"
},
"emptyState": {
"noVideo": "No Video Loaded",
@@ -50,7 +54,9 @@
"cannotPlaceTrim": "Cannot place trim here",
"trimExistsAtLocation": "Trim already exists at this location or not enough space available.",
"cannotPlaceSpeed": "Cannot place speed here",
- "speedExistsAtLocation": "Speed region already exists at this location or not enough space available."
+ "speedExistsAtLocation": "Speed region already exists at this location or not enough space available.",
+ "cannotPlaceCameraFullscreen": "Cannot place Full Camera here",
+ "cameraFullscreenExistsAtLocation": "A Full Camera segment already exists at this location or not enough space available."
},
"success": {
"addedZoomSuggestions": "Added {{count}} cursor-based zoom suggestion",
diff --git a/src/i18n/locales/es/shortcuts.json b/src/i18n/locales/es/shortcuts.json
index b23a1cbe0..b1755a9c6 100644
--- a/src/i18n/locales/es/shortcuts.json
+++ b/src/i18n/locales/es/shortcuts.json
@@ -22,6 +22,7 @@
"addAnnotation": "Agregar anotación",
"addBlur": "Agregar desenfoque",
"addKeyframe": "Agregar fotograma clave",
+ "addCameraFullscreen": "Agregar cámara a pantalla completa",
"deleteSelected": "Eliminar seleccionado",
"playPause": "Reproducir / Pausar",
"copySelected": "Copiar selección",
diff --git a/src/i18n/locales/es/timeline.json b/src/i18n/locales/es/timeline.json
index 1a1abe1b1..95d6d27b6 100644
--- a/src/i18n/locales/es/timeline.json
+++ b/src/i18n/locales/es/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "Agregar recorte (T)",
"addAnnotation": "Agregar anotación (A)",
"addSpeed": "Agregar velocidad (S)",
- "addBlur": "Agregar desenfoque (B)"
+ "addBlur": "Agregar desenfoque (B)",
+ "addCameraFullscreen": "Agregar cámara a pantalla completa (C)"
},
"hints": {
"pressZoom": "Presiona Z para agregar zoom",
"pressTrim": "Presiona T para agregar recorte",
"pressAnnotation": "Presiona A para agregar anotación",
"pressSpeed": "Presiona S para agregar velocidad",
- "pressBlur": "Presiona B para agregar una región de desenfoque"
+ "pressBlur": "Presiona B para agregar una región de desenfoque",
+ "pressCameraFullscreen": "Presiona C para agregar un segmento de cámara a pantalla completa"
},
"labels": {
"pan": "Desplazar",
@@ -25,6 +27,8 @@
"annotationItem": "Anotación",
"imageItem": "Imagen",
"emptyText": "Texto vacío",
+ "cameraFullscreen": "Cámara a pantalla completa",
+ "cameraFullscreenItem": "Cámara a pantalla completa {{index}}",
"blurItem": "Desenfoque {{index}}"
},
"emptyState": {
@@ -46,7 +50,9 @@
"cannotPlaceTrim": "No se puede colocar el recorte aquí",
"trimExistsAtLocation": "Ya existe un recorte en esta ubicación o no hay suficiente espacio disponible.",
"cannotPlaceSpeed": "No se puede colocar la velocidad aquí",
- "speedExistsAtLocation": "Ya existe una región de velocidad en esta ubicación o no hay suficiente espacio disponible."
+ "speedExistsAtLocation": "Ya existe una región de velocidad en esta ubicación o no hay suficiente espacio disponible.",
+ "cannotPlaceCameraFullscreen": "No se puede colocar la cámara a pantalla completa aquí",
+ "cameraFullscreenExistsAtLocation": "Ya existe un segmento de cámara a pantalla completa en esta ubicación o no hay suficiente espacio disponible."
},
"success": {
"addedZoomSuggestions": "Se agregó {{count}} sugerencia de zoom basada en el cursor",
diff --git a/src/i18n/locales/fr/shortcuts.json b/src/i18n/locales/fr/shortcuts.json
index 56451fcca..4165f1382 100644
--- a/src/i18n/locales/fr/shortcuts.json
+++ b/src/i18n/locales/fr/shortcuts.json
@@ -22,6 +22,7 @@
"addAnnotation": "Ajouter une annotation",
"addBlur": "Ajouter un flou",
"addKeyframe": "Ajouter une image-clé",
+ "addCameraFullscreen": "Ajouter Caméra plein écran",
"deleteSelected": "Supprimer la sélection",
"playPause": "Lecture / Pause",
"copySelected": "Copier la sélection",
diff --git a/src/i18n/locales/fr/timeline.json b/src/i18n/locales/fr/timeline.json
index b4c6e16a9..7b0384679 100644
--- a/src/i18n/locales/fr/timeline.json
+++ b/src/i18n/locales/fr/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "Ajouter une coupe (T)",
"addAnnotation": "Ajouter une annotation (A)",
"addSpeed": "Ajouter une vitesse (S)",
- "addBlur": "Ajouter un flou (B)"
+ "addBlur": "Ajouter un flou (B)",
+ "addCameraFullscreen": "Ajouter Caméra plein écran (C)"
},
"hints": {
"pressZoom": "Appuyez sur Z pour ajouter un zoom",
"pressTrim": "Appuyez sur T pour ajouter une coupe",
"pressAnnotation": "Appuyez sur A pour ajouter une annotation",
"pressSpeed": "Appuyez sur S pour ajouter une vitesse",
- "pressBlur": "Appuyez sur B pour ajouter une zone de flou"
+ "pressBlur": "Appuyez sur B pour ajouter une zone de flou",
+ "pressCameraFullscreen": "Appuyez sur C pour ajouter un segment Caméra plein écran"
},
"labels": {
"pan": "Panoramique",
@@ -25,6 +27,8 @@
"annotationItem": "Annotation",
"imageItem": "Image",
"emptyText": "Texte vide",
+ "cameraFullscreen": "Caméra plein écran",
+ "cameraFullscreenItem": "Caméra plein écran {{index}}",
"blurItem": "Flou {{index}}"
},
"emptyState": {
@@ -33,20 +37,22 @@
},
"errors": {
"cannotPlaceZoom": "Impossible de placer le zoom ici",
- "zoomExistsAtLocation": "Un zoom existe déjà à cet emplacement ou l\u0027espace disponible est insuffisant.",
+ "zoomExistsAtLocation": "Un zoom existe déjà à cet emplacement ou l'espace disponible est insuffisant.",
"zoomSuggestionUnavailable": "Gestionnaire de suggestions de zoom non disponible",
"noCursorTelemetry": "Aucune télémétrie de curseur disponible",
- "noCursorTelemetryDescription": "Enregistrez d\u0027abord un screencast pour générer des suggestions basées sur le curseur.",
+ "noCursorTelemetryDescription": "Enregistrez d'abord un screencast pour générer des suggestions basées sur le curseur.",
"noUsableTelemetry": "Aucune télémétrie de curseur utilisable",
- "noUsableTelemetryDescription": "L\u0027enregistrement ne contient pas suffisamment de données de mouvement du curseur.",
+ "noUsableTelemetryDescription": "L'enregistrement ne contient pas suffisamment de données de mouvement du curseur.",
"noDwellMoments": "Aucun moment de pause du curseur trouvé",
"noDwellMomentsDescription": "Essayez un enregistrement avec des pauses plus lentes du curseur sur les actions importantes.",
"noAutoZoomSlots": "Aucun emplacement de zoom automatique disponible",
"noAutoZoomSlotsDescription": "Les points de pause détectés chevauchent des régions de zoom existantes.",
"cannotPlaceTrim": "Impossible de placer la coupe ici",
- "trimExistsAtLocation": "Une coupe existe déjà à cet emplacement ou l\u0027espace disponible est insuffisant.",
+ "trimExistsAtLocation": "Une coupe existe déjà à cet emplacement ou l'espace disponible est insuffisant.",
"cannotPlaceSpeed": "Impossible de placer la vitesse ici",
- "speedExistsAtLocation": "Une région de vitesse existe déjà à cet emplacement ou l\u0027espace disponible est insuffisant."
+ "speedExistsAtLocation": "Une région de vitesse existe déjà à cet emplacement ou l'espace disponible est insuffisant.",
+ "cannotPlaceCameraFullscreen": "Impossible de placer la caméra plein écran ici",
+ "cameraFullscreenExistsAtLocation": "Un segment Caméra plein écran existe déjà à cet emplacement ou l'espace disponible est insuffisant."
},
"success": {
"addedZoomSuggestions": "{{count}} suggestion de zoom basée sur le curseur ajoutée",
diff --git a/src/i18n/locales/it/shortcuts.json b/src/i18n/locales/it/shortcuts.json
index 528d149bc..c8c83a1e1 100644
--- a/src/i18n/locales/it/shortcuts.json
+++ b/src/i18n/locales/it/shortcuts.json
@@ -22,6 +22,7 @@
"addAnnotation": "Aggiungi annotazione",
"addBlur": "Aggiungi sfocatura",
"addKeyframe": "Aggiungi fotogramma chiave",
+ "addCameraFullscreen": "Aggiungi Camera a schermo intero",
"deleteSelected": "Elimina selezionato",
"playPause": "Riproduci / Pausa",
"copySelected": "Copia selezione",
diff --git a/src/i18n/locales/it/timeline.json b/src/i18n/locales/it/timeline.json
index 499a39a33..ffc076756 100644
--- a/src/i18n/locales/it/timeline.json
+++ b/src/i18n/locales/it/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "Aggiungi taglio (T)",
"addAnnotation": "Aggiungi annotazione (A)",
"addBlur": "Aggiungi sfocatura (B)",
- "addSpeed": "Aggiungi velocità (S)"
+ "addSpeed": "Aggiungi velocità (S)",
+ "addCameraFullscreen": "Aggiungi Camera a schermo intero (C)"
},
"hints": {
"pressZoom": "Premi Z per aggiungere zoom",
"pressTrim": "Premi T per aggiungere taglio",
"pressAnnotation": "Premi A per aggiungere annotazione",
"pressBlur": "Premi B per aggiungere regione sfocatura",
- "pressSpeed": "Premi S per aggiungere velocità"
+ "pressSpeed": "Premi S per aggiungere velocità",
+ "pressCameraFullscreen": "Premi C per aggiungere un segmento Camera a schermo intero"
},
"labels": {
"pan": "Panoramica",
@@ -25,7 +27,9 @@
"annotationItem": "Annotazione",
"blurItem": "Sfocatura {{index}}",
"imageItem": "Immagine",
- "emptyText": "Testo vuoto"
+ "emptyText": "Testo vuoto",
+ "cameraFullscreen": "Camera a schermo intero",
+ "cameraFullscreenItem": "Camera a schermo intero {{index}}"
},
"emptyState": {
"noVideo": "Nessun video caricato",
@@ -46,7 +50,9 @@
"cannotPlaceTrim": "Impossibile posizionare il taglio qui",
"trimExistsAtLocation": "Il taglio esiste già in questa posizione o non c'è spazio sufficiente.",
"cannotPlaceSpeed": "Impossibile posizionare la velocità qui",
- "speedExistsAtLocation": "La regione velocità esiste già in questa posizione o non c'è spazio sufficiente."
+ "speedExistsAtLocation": "La regione velocità esiste già in questa posizione o non c'è spazio sufficiente.",
+ "cannotPlaceCameraFullscreen": "Impossibile posizionare la Camera a schermo intero qui",
+ "cameraFullscreenExistsAtLocation": "Un segmento Camera a schermo intero esiste già in questa posizione o non c'è spazio sufficiente."
},
"success": {
"addedZoomSuggestions": "Aggiunto {{count}} suggerimento zoom basato sul cursore",
diff --git a/src/i18n/locales/ja-JP/shortcuts.json b/src/i18n/locales/ja-JP/shortcuts.json
index fc5d6de32..38ed6064d 100644
--- a/src/i18n/locales/ja-JP/shortcuts.json
+++ b/src/i18n/locales/ja-JP/shortcuts.json
@@ -22,6 +22,7 @@
"addAnnotation": "注釈を追加",
"addBlur": "ぼかしを追加",
"addKeyframe": "キーフレームを追加",
+ "addCameraFullscreen": "フルスクリーンカメラを追加",
"deleteSelected": "選択を削除",
"playPause": "再生 / 一時停止",
"copySelected": "選択をコピー",
diff --git a/src/i18n/locales/ja-JP/timeline.json b/src/i18n/locales/ja-JP/timeline.json
index ec9472a4b..44ea109f7 100644
--- a/src/i18n/locales/ja-JP/timeline.json
+++ b/src/i18n/locales/ja-JP/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "トリムを追加 (T)",
"addAnnotation": "注釈を追加 (A)",
"addBlur": "ぼかしを追加 (B)",
- "addSpeed": "再生速度を追加 (S)"
+ "addSpeed": "再生速度を追加 (S)",
+ "addCameraFullscreen": "フルスクリーンカメラを追加 (C)"
},
"hints": {
"pressZoom": "Zキーを押してズームを追加",
"pressTrim": "Tキーを押してトリムを追加",
"pressAnnotation": "Aキーを押して注釈を追加",
"pressBlur": "Bキーを押してぼかしを追加",
- "pressSpeed": "Sキーを押して再生速度を追加"
+ "pressSpeed": "Sキーを押して再生速度を追加",
+ "pressCameraFullscreen": "Cキーを押してフルスクリーンカメラのセグメントを追加"
},
"labels": {
"pan": "移動",
@@ -25,7 +27,9 @@
"annotationItem": "注釈",
"blurItem": "ぼかし {{index}}",
"imageItem": "画像",
- "emptyText": "空のテキスト"
+ "emptyText": "空のテキスト",
+ "cameraFullscreen": "フルスクリーンカメラ",
+ "cameraFullscreenItem": "フルスクリーンカメラ {{index}}"
},
"emptyState": {
"noVideo": "ビデオが読み込まれていません",
@@ -46,7 +50,9 @@
"cannotPlaceTrim": "ここにトリムを配置できません",
"trimExistsAtLocation": "この場所にはすでにトリムが存在するか、十分なスペースがありません。",
"cannotPlaceSpeed": "ここに再生速度を配置できません",
- "speedExistsAtLocation": "この場所にはすでに再生速度の範囲が存在するか、十分なスペースがありません。"
+ "speedExistsAtLocation": "この場所にはすでに再生速度の範囲が存在するか、十分なスペースがありません。",
+ "cannotPlaceCameraFullscreen": "ここにフルスクリーンカメラを配置できません",
+ "cameraFullscreenExistsAtLocation": "この場所にはすでにフルスクリーンカメラのセグメントが存在するか、十分なスペースがありません。"
},
"success": {
"addedZoomSuggestions": "カーソルに基づくズーム提案を {{count}} 件追加しました",
diff --git a/src/i18n/locales/ko-KR/shortcuts.json b/src/i18n/locales/ko-KR/shortcuts.json
index 53a2de968..3bd180b76 100644
--- a/src/i18n/locales/ko-KR/shortcuts.json
+++ b/src/i18n/locales/ko-KR/shortcuts.json
@@ -21,6 +21,7 @@
"addSpeed": "속도 추가",
"addAnnotation": "주석 추가",
"addKeyframe": "키프레임 추가",
+ "addCameraFullscreen": "전체 화면 카메라 추가",
"deleteSelected": "선택 항목 삭제",
"playPause": "재생 / 일시정지",
"addBlur": "블러 추가",
diff --git a/src/i18n/locales/ko-KR/timeline.json b/src/i18n/locales/ko-KR/timeline.json
index 52e2ca724..ca2ac1526 100644
--- a/src/i18n/locales/ko-KR/timeline.json
+++ b/src/i18n/locales/ko-KR/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "트림 추가 (T)",
"addAnnotation": "주석 추가 (A)",
"addSpeed": "속도 추가 (S)",
- "addBlur": "블러 추가 (B)"
+ "addBlur": "블러 추가 (B)",
+ "addCameraFullscreen": "전체 화면 카메라 추가 (C)"
},
"hints": {
"pressZoom": "Z를 눌러 줌 추가",
"pressTrim": "T를 눌러 트림 추가",
"pressAnnotation": "A를 눌러 주석 추가",
"pressSpeed": "S를 눌러 속도 추가",
- "pressBlur": "B 키를 눌러 블러 영역을 추가하세요"
+ "pressBlur": "B 키를 눌러 블러 영역을 추가하세요",
+ "pressCameraFullscreen": "C를 눌러 전체 화면 카메라 구간을 추가하세요"
},
"labels": {
"pan": "이동",
@@ -25,6 +27,8 @@
"annotationItem": "주석",
"imageItem": "이미지",
"emptyText": "빈 텍스트",
+ "cameraFullscreen": "전체 화면 카메라",
+ "cameraFullscreenItem": "전체 화면 카메라 {{index}}",
"blurItem": "블러 {{index}}"
},
"emptyState": {
@@ -46,7 +50,9 @@
"cannotPlaceTrim": "이 위치에 트림을 추가할 수 없습니다",
"trimExistsAtLocation": "이 위치에 이미 트림이 있거나 공간이 부족합니다.",
"cannotPlaceSpeed": "이 위치에 속도를 추가할 수 없습니다",
- "speedExistsAtLocation": "이 위치에 이미 속도 구간이 있거나 공간이 부족합니다."
+ "speedExistsAtLocation": "이 위치에 이미 속도 구간이 있거나 공간이 부족합니다.",
+ "cannotPlaceCameraFullscreen": "이 위치에 전체 화면 카메라를 추가할 수 없습니다",
+ "cameraFullscreenExistsAtLocation": "이 위치에 이미 전체 화면 카메라 구간이 있거나 공간이 부족합니다."
},
"success": {
"addedZoomSuggestions": "커서 기반 줌 제안 {{count}}개가 추가되었습니다",
diff --git a/src/i18n/locales/pt-BR/shortcuts.json b/src/i18n/locales/pt-BR/shortcuts.json
index 0187ed554..83d1a18ec 100644
--- a/src/i18n/locales/pt-BR/shortcuts.json
+++ b/src/i18n/locales/pt-BR/shortcuts.json
@@ -20,6 +20,7 @@
"addAnnotation": "Adicionar Anotação",
"addBlur": "Adicionar Desfoque",
"addKeyframe": "Adicionar Quadro-chave",
+ "addCameraFullscreen": "Adicionar Câmera em Tela Cheia",
"deleteSelected": "Excluir Selecionado",
"playPause": "Reproduzir / Pausar",
"copySelected": "Copiar seleção",
diff --git a/src/i18n/locales/pt-BR/timeline.json b/src/i18n/locales/pt-BR/timeline.json
index ba875db67..b5d38ec82 100644
--- a/src/i18n/locales/pt-BR/timeline.json
+++ b/src/i18n/locales/pt-BR/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "Adicionar Recorte (T)",
"addAnnotation": "Adicionar Anotação (A)",
"addBlur": "Adicionar Desfoque (B)",
- "addSpeed": "Adicionar Velocidade (S)"
+ "addSpeed": "Adicionar Velocidade (S)",
+ "addCameraFullscreen": "Adicionar Câmera em Tela Cheia (C)"
},
"hints": {
"pressZoom": "Pressione Z para adicionar zoom",
"pressTrim": "Pressione T para adicionar recorte",
"pressAnnotation": "Pressione A para adicionar anotação",
"pressBlur": "Pressione B para adicionar região de desfoque",
- "pressSpeed": "Pressione S para adicionar velocidade"
+ "pressSpeed": "Pressione S para adicionar velocidade",
+ "pressCameraFullscreen": "Pressione C para adicionar um segmento de Câmera em Tela Cheia"
},
"labels": {
"pan": "Mover",
@@ -25,7 +27,9 @@
"annotationItem": "Anotação",
"blurItem": "Desfoque {{index}}",
"imageItem": "Imagem",
- "emptyText": "Texto vazio"
+ "emptyText": "Texto vazio",
+ "cameraFullscreen": "Câmera em Tela Cheia",
+ "cameraFullscreenItem": "Câmera em Tela Cheia {{index}}"
},
"emptyState": {
"noVideo": "Nenhum Vídeo Carregado",
@@ -46,7 +50,9 @@
"cannotPlaceTrim": "Não é possível colocar recorte aqui",
"trimExistsAtLocation": "Já existe um recorte neste local ou não há espaço suficiente disponível.",
"cannotPlaceSpeed": "Não é possível colocar velocidade aqui",
- "speedExistsAtLocation": "Já existe uma região de velocidade neste local ou não há espaço suficiente disponível."
+ "speedExistsAtLocation": "Já existe uma região de velocidade neste local ou não há espaço suficiente disponível.",
+ "cannotPlaceCameraFullscreen": "Não é possível colocar Câmera em Tela Cheia aqui",
+ "cameraFullscreenExistsAtLocation": "Já existe um segmento de Câmera em Tela Cheia neste local ou não há espaço suficiente disponível."
},
"success": {
"addedZoomSuggestions": "Adicionada {{count}} sugestão de zoom baseada no cursor",
diff --git a/src/i18n/locales/ru/shortcuts.json b/src/i18n/locales/ru/shortcuts.json
index 47ae35f24..c8a8f33ba 100644
--- a/src/i18n/locales/ru/shortcuts.json
+++ b/src/i18n/locales/ru/shortcuts.json
@@ -22,6 +22,7 @@
"addAnnotation": "Добавить аннотацию",
"addBlur": "Добавить размытие",
"addKeyframe": "Добавить ключевой кадр",
+ "addCameraFullscreen": "Добавить камеру на весь экран",
"deleteSelected": "Удалить выбранное",
"playPause": "Воспроизведение / Пауза",
"copySelected": "Копировать выбранное",
diff --git a/src/i18n/locales/ru/timeline.json b/src/i18n/locales/ru/timeline.json
index fe9ce46a8..a22027db5 100644
--- a/src/i18n/locales/ru/timeline.json
+++ b/src/i18n/locales/ru/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "Добавить обрезку (T)",
"addAnnotation": "Добавить аннотацию (A)",
"addBlur": "Добавить размытие (B)",
- "addSpeed": "Изменить скорость (S)"
+ "addSpeed": "Изменить скорость (S)",
+ "addCameraFullscreen": "Добавить камеру на весь экран (C)"
},
"hints": {
"pressZoom": "Нажмите Z для добавления масштабирования",
"pressTrim": "Нажмите T для добавления обрезки",
"pressAnnotation": "Нажмите A для добавления аннотации",
"pressBlur": "Нажмите B для добавления области размытия",
- "pressSpeed": "Нажмите S для изменения скорости"
+ "pressSpeed": "Нажмите S для изменения скорости",
+ "pressCameraFullscreen": "Нажмите C, чтобы добавить сегмент камеры на весь экран"
},
"labels": {
"pan": "Панорамирование",
@@ -25,7 +27,9 @@
"annotationItem": "Аннотация",
"blurItem": "Размытие {{index}}",
"imageItem": "Изображение",
- "emptyText": "Пустой текст"
+ "emptyText": "Пустой текст",
+ "cameraFullscreen": "Камера на весь экран",
+ "cameraFullscreenItem": "Камера на весь экран {{index}}"
},
"emptyState": {
"noVideo": "Видео не загружено",
@@ -46,7 +50,9 @@
"cannotPlaceTrim": "Невозможно разместить обрезку здесь",
"trimExistsAtLocation": "Обрезка уже существует в этом месте или недостаточно свободного места.",
"cannotPlaceSpeed": "Невозможно разместить изменение скорости здесь",
- "speedExistsAtLocation": "Область изменения скорости уже существует в этом месте или недостаточно свободного места."
+ "speedExistsAtLocation": "Область изменения скорости уже существует в этом месте или недостаточно свободного места.",
+ "cannotPlaceCameraFullscreen": "Невозможно разместить камеру на весь экран здесь",
+ "cameraFullscreenExistsAtLocation": "Сегмент камеры на весь экран уже существует в этом месте или недостаточно свободного места."
},
"success": {
"addedZoomSuggestions": "Добавлено {{count}} предложение масштабирования на основе курсора",
diff --git a/src/i18n/locales/tr/shortcuts.json b/src/i18n/locales/tr/shortcuts.json
index 24c1ea502..3afd2c5ed 100644
--- a/src/i18n/locales/tr/shortcuts.json
+++ b/src/i18n/locales/tr/shortcuts.json
@@ -22,6 +22,7 @@
"addAnnotation": "Açıklama Ekle",
"addBlur": "Bulanik Ekle",
"addKeyframe": "Anahtar Kare Ekle",
+ "addCameraFullscreen": "Tam Ekran Kamera Ekle",
"deleteSelected": "Seçileni Sil",
"playPause": "Oynat / Duraklat",
"copySelected": "Seçileni Kopyala",
diff --git a/src/i18n/locales/tr/timeline.json b/src/i18n/locales/tr/timeline.json
index 2632f7a6f..cae1d1f33 100644
--- a/src/i18n/locales/tr/timeline.json
+++ b/src/i18n/locales/tr/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "Kırpma Ekle (T)",
"addAnnotation": "Açıklama Ekle (A)",
"addSpeed": "Hız Ekle (S)",
- "addBlur": "Bulanık ekle (B)"
+ "addBlur": "Bulanık ekle (B)",
+ "addCameraFullscreen": "Tam Ekran Kamera Ekle (C)"
},
"hints": {
"pressZoom": "Yakınlaştırma eklemek için Z tuşuna basın",
"pressTrim": "Kırpma eklemek için T tuşuna basın",
"pressAnnotation": "Açıklama eklemek için A tuşuna basın",
"pressSpeed": "Hız eklemek için S tuşuna basın",
- "pressBlur": "Bulanık bölge eklemek için B tuşuna basın"
+ "pressBlur": "Bulanık bölge eklemek için B tuşuna basın",
+ "pressCameraFullscreen": "Tam Ekran Kamera bölümü eklemek için C tuşuna basın"
},
"labels": {
"pan": "Kaydır",
@@ -25,6 +27,8 @@
"annotationItem": "Açıklama",
"imageItem": "Görüntü",
"emptyText": "Boş metin",
+ "cameraFullscreen": "Tam Ekran Kamera",
+ "cameraFullscreenItem": "Tam Ekran Kamera {{index}}",
"blurItem": "Bulanık {{index}}"
},
"emptyState": {
@@ -46,7 +50,9 @@
"cannotPlaceTrim": "Buraya kırpma yerleştirilemiyor",
"trimExistsAtLocation": "Bu konumda zaten bir kırpma var veya yeterli alan yok.",
"cannotPlaceSpeed": "Buraya hız yerleştirilemiyor",
- "speedExistsAtLocation": "Bu konumda zaten bir hız bölgesi var veya yeterli alan yok."
+ "speedExistsAtLocation": "Bu konumda zaten bir hız bölgesi var veya yeterli alan yok.",
+ "cannotPlaceCameraFullscreen": "Buraya Tam Ekran Kamera yerleştirilemiyor",
+ "cameraFullscreenExistsAtLocation": "Bu konumda zaten bir Tam Ekran Kamera bölümü var veya yeterli alan yok."
},
"success": {
"addedZoomSuggestions": "{{count}} imleç tabanlı yakınlaştırma önerisi eklendi",
diff --git a/src/i18n/locales/vi/shortcuts.json b/src/i18n/locales/vi/shortcuts.json
index a1226b0ef..49ba4b385 100644
--- a/src/i18n/locales/vi/shortcuts.json
+++ b/src/i18n/locales/vi/shortcuts.json
@@ -22,6 +22,7 @@
"addAnnotation": "Thêm Chú thích",
"addBlur": "Thêm Làm mờ",
"addKeyframe": "Thêm Khung hình chính",
+ "addCameraFullscreen": "Thêm Camera Toàn màn hình",
"deleteSelected": "Xóa mục đã chọn",
"playPause": "Phát / Tạm dừng",
"copySelected": "Sao chép mục đã chọn",
diff --git a/src/i18n/locales/vi/timeline.json b/src/i18n/locales/vi/timeline.json
index a01dfe452..6956067d7 100644
--- a/src/i18n/locales/vi/timeline.json
+++ b/src/i18n/locales/vi/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "Thêm Cắt (T)",
"addAnnotation": "Thêm Chú thích (A)",
"addBlur": "Thêm Làm mờ (B)",
- "addSpeed": "Thêm Tốc độ (S)"
+ "addSpeed": "Thêm Tốc độ (S)",
+ "addCameraFullscreen": "Thêm Camera Toàn màn hình (C)"
},
"hints": {
"pressZoom": "Nhấn Z để thêm thu phóng",
"pressTrim": "Nhấn T để thêm cắt",
"pressAnnotation": "Nhấn A để thêm chú thích",
"pressBlur": "Nhấn B để thêm vùng làm mờ",
- "pressSpeed": "Nhấn S để thêm tốc độ"
+ "pressSpeed": "Nhấn S để thêm tốc độ",
+ "pressCameraFullscreen": "Nhấn C để thêm một đoạn Camera Toàn màn hình"
},
"labels": {
"pan": "Xoay",
@@ -25,7 +27,9 @@
"annotationItem": "Chú thích",
"blurItem": "Làm mờ {{index}}",
"imageItem": "Hình ảnh",
- "emptyText": "Văn bản trống"
+ "emptyText": "Văn bản trống",
+ "cameraFullscreen": "Camera Toàn màn hình",
+ "cameraFullscreenItem": "Camera Toàn màn hình {{index}}"
},
"emptyState": {
"noVideo": "Chưa tải video",
@@ -46,7 +50,9 @@
"cannotPlaceTrim": "Không thể đặt cắt ở đây",
"trimExistsAtLocation": "Cắt đã tồn tại ở vị trí này hoặc không có đủ không gian.",
"cannotPlaceSpeed": "Không thể đặt tốc độ ở đây",
- "speedExistsAtLocation": "Vùng tốc độ đã tồn tại ở vị trí này hoặc không có đủ không gian."
+ "speedExistsAtLocation": "Vùng tốc độ đã tồn tại ở vị trí này hoặc không có đủ không gian.",
+ "cannotPlaceCameraFullscreen": "Không thể đặt Camera Toàn màn hình ở đây",
+ "cameraFullscreenExistsAtLocation": "Đoạn Camera Toàn màn hình đã tồn tại ở vị trí này hoặc không có đủ không gian."
},
"success": {
"addedZoomSuggestions": "Đã thêm {{count}} đề xuất thu phóng dựa trên con trỏ",
diff --git a/src/i18n/locales/zh-CN/shortcuts.json b/src/i18n/locales/zh-CN/shortcuts.json
index b3204cb2b..b20429b73 100644
--- a/src/i18n/locales/zh-CN/shortcuts.json
+++ b/src/i18n/locales/zh-CN/shortcuts.json
@@ -22,6 +22,7 @@
"addAnnotation": "添加标注",
"addBlur": "添加模糊",
"addKeyframe": "添加关键帧",
+ "addCameraFullscreen": "添加全屏摄像头",
"deleteSelected": "删除所选",
"playPause": "播放 / 暂停",
"copySelected": "复制所选",
diff --git a/src/i18n/locales/zh-CN/timeline.json b/src/i18n/locales/zh-CN/timeline.json
index 783fef60f..c810edb35 100644
--- a/src/i18n/locales/zh-CN/timeline.json
+++ b/src/i18n/locales/zh-CN/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "添加剪辑 (T)",
"addAnnotation": "添加标注 (A)",
"addSpeed": "添加速度 (S)",
- "addBlur": "添加模糊 (B)"
+ "addBlur": "添加模糊 (B)",
+ "addCameraFullscreen": "添加全屏摄像头 (C)"
},
"hints": {
"pressZoom": "按 Z 添加缩放",
"pressTrim": "按 T 添加剪辑",
"pressAnnotation": "按 A 添加标注",
"pressSpeed": "按 S 添加速度",
- "pressBlur": "按 B 添加模糊区域"
+ "pressBlur": "按 B 添加模糊区域",
+ "pressCameraFullscreen": "按 C 添加一个全屏摄像头片段"
},
"labels": {
"pan": "平移",
@@ -25,6 +27,8 @@
"annotationItem": "标注",
"imageItem": "图片",
"emptyText": "空文本",
+ "cameraFullscreen": "全屏摄像头",
+ "cameraFullscreenItem": "全屏摄像头 {{index}}",
"blurItem": "模糊 {{index}}"
},
"emptyState": {
@@ -46,7 +50,9 @@
"cannotPlaceTrim": "无法在此处放置剪辑",
"trimExistsAtLocation": "此位置已存在剪辑或没有足够的空间。",
"cannotPlaceSpeed": "无法在此处放置速度",
- "speedExistsAtLocation": "此位置已存在速度区域或没有足够的空间。"
+ "speedExistsAtLocation": "此位置已存在速度区域或没有足够的空间。",
+ "cannotPlaceCameraFullscreen": "无法在此处放置全屏摄像头",
+ "cameraFullscreenExistsAtLocation": "此位置已存在全屏摄像头片段或没有足够的空间。"
},
"success": {
"addedZoomSuggestions": "已添加 {{count}} 个基于光标的缩放建议",
diff --git a/src/i18n/locales/zh-TW/shortcuts.json b/src/i18n/locales/zh-TW/shortcuts.json
index 65f148478..50cc5a649 100644
--- a/src/i18n/locales/zh-TW/shortcuts.json
+++ b/src/i18n/locales/zh-TW/shortcuts.json
@@ -22,6 +22,7 @@
"addAnnotation": "新增標註",
"addBlur": "新增模糊",
"addKeyframe": "新增關鍵影格",
+ "addCameraFullscreen": "新增全螢幕攝影機",
"deleteSelected": "刪除所選",
"playPause": "播放 / 暫停",
"copySelected": "複製所選",
diff --git a/src/i18n/locales/zh-TW/timeline.json b/src/i18n/locales/zh-TW/timeline.json
index cd47b7478..f30f98f16 100644
--- a/src/i18n/locales/zh-TW/timeline.json
+++ b/src/i18n/locales/zh-TW/timeline.json
@@ -5,14 +5,16 @@
"addTrim": "新增剪輯 (T)",
"addAnnotation": "新增標註 (A)",
"addSpeed": "新增速度 (S)",
- "addBlur": "新增模糊 (B)"
+ "addBlur": "新增模糊 (B)",
+ "addCameraFullscreen": "新增全螢幕攝影機 (C)"
},
"hints": {
"pressZoom": "按 Z 新增縮放",
"pressTrim": "按 T 新增剪輯",
"pressAnnotation": "按 A 新增標註",
"pressSpeed": "按 S 新增速度",
- "pressBlur": "按 B 新增模糊區域"
+ "pressBlur": "按 B 新增模糊區域",
+ "pressCameraFullscreen": "按 C 新增一個全螢幕攝影機片段"
},
"labels": {
"pan": "平移",
@@ -25,6 +27,8 @@
"annotationItem": "標註",
"imageItem": "圖片",
"emptyText": "空文字",
+ "cameraFullscreen": "全螢幕攝影機",
+ "cameraFullscreenItem": "全螢幕攝影機 {{index}}",
"blurItem": "模糊 {{index}}"
},
"emptyState": {
@@ -46,7 +50,9 @@
"cannotPlaceTrim": "無法在此處放置剪輯",
"trimExistsAtLocation": "此位置已存在剪輯或沒有足夠的空間。",
"cannotPlaceSpeed": "無法在此處放置速度",
- "speedExistsAtLocation": "此位置已存在速度區域或沒有足夠的空間。"
+ "speedExistsAtLocation": "此位置已存在速度區域或沒有足夠的空間。",
+ "cannotPlaceCameraFullscreen": "無法在此處放置全螢幕攝影機",
+ "cameraFullscreenExistsAtLocation": "此位置已存在全螢幕攝影機片段或沒有足夠的空間。"
},
"success": {
"addedZoomSuggestions": "已新增 {{count}} 個基於游標的縮放建議",
diff --git a/src/lib/compositeLayout.test.ts b/src/lib/compositeLayout.test.ts
index 51c3fd0b7..abe06c324 100644
--- a/src/lib/compositeLayout.test.ts
+++ b/src/lib/compositeLayout.test.ts
@@ -1,5 +1,9 @@
import { describe, expect, it } from "vitest";
-import { computeCompositeLayout } from "./compositeLayout";
+import {
+ CAMERA_FULLSCREEN_MARGIN_FRACTION,
+ computeCameraFullscreenTargetRect,
+ computeCompositeLayout,
+} from "./compositeLayout";
describe("computeCompositeLayout", () => {
it("anchors the overlay in the lower-right corner", () => {
@@ -264,3 +268,53 @@ describe("computeCompositeLayout", () => {
expect(roundedLayout?.webcamRect?.maskShape).toBe("rounded");
});
});
+
+describe("computeCameraFullscreenTargetRect", () => {
+ it("insets the target rect by the margin fraction of the canvas' shorter dimension", () => {
+ const canvasSize = { width: 1920, height: 1080 };
+ const margin = Math.round(
+ Math.min(canvasSize.width, canvasSize.height) * CAMERA_FULLSCREEN_MARGIN_FRACTION,
+ );
+ // Square aspect source so width is the constrained dimension in a landscape canvas.
+ const rect = computeCameraFullscreenTargetRect(canvasSize, { width: 1080, height: 1080 });
+
+ expect(rect.height).toBeCloseTo(canvasSize.height - margin * 2, 0);
+ expect(rect.y).toBeCloseTo(margin, 0);
+ });
+
+ it("preserves the source aspect ratio (contain-fit) instead of stretching to the canvas", () => {
+ const canvasSize = { width: 1920, height: 1080 };
+ const source = { width: 1280, height: 720 }; // 16:9, same as canvas
+ const rect = computeCameraFullscreenTargetRect(canvasSize, source);
+
+ expect(rect.width / rect.height).toBeCloseTo(source.width / source.height, 3);
+ });
+
+ it("fits a portrait source by constraining width, centering vertically and horizontally", () => {
+ const canvasSize = { width: 1920, height: 1080 };
+ const source = { width: 9, height: 16 }; // portrait webcam frame
+ const rect = computeCameraFullscreenTargetRect(canvasSize, source);
+
+ expect(rect.width / rect.height).toBeCloseTo(source.width / source.height, 3);
+ expect(rect.height).toBeLessThanOrEqual(canvasSize.height);
+ expect(rect.width).toBeLessThanOrEqual(canvasSize.width);
+ // Centered: equal leftover space on both sides horizontally.
+ expect(rect.x).toBeCloseTo(canvasSize.width - rect.x - rect.width, 0);
+ });
+
+ it("fits a landscape source by constraining height when it would overflow", () => {
+ const canvasSize = { width: 1080, height: 1920 }; // portrait canvas
+ const source = { width: 16, height: 9 }; // landscape webcam frame
+ const rect = computeCameraFullscreenTargetRect(canvasSize, source);
+
+ expect(rect.width / rect.height).toBeCloseTo(source.width / source.height, 3);
+ expect(rect.y).toBeCloseTo(canvasSize.height - rect.y - rect.height, 0);
+ });
+
+ it("falls back to a 1:1 aspect ratio for degenerate (zero-size) source rects", () => {
+ const canvasSize = { width: 1920, height: 1080 };
+ const rect = computeCameraFullscreenTargetRect(canvasSize, { width: 0, height: 0 });
+
+ expect(rect.width).toBeCloseTo(rect.height, 0);
+ });
+});
diff --git a/src/lib/compositeLayout.ts b/src/lib/compositeLayout.ts
index 5eedb266d..04c52c8b8 100644
--- a/src/lib/compositeLayout.ts
+++ b/src/lib/compositeLayout.ts
@@ -24,6 +24,72 @@ export interface StyledRenderRect extends RenderRect {
maskShape?: import("@/components/video-editor/types").WebcamMaskShape;
}
+/**
+ * Linearly interpolates position/size/borderRadius between two rects. Used to grow the
+ * webcam overlay from its normal layout to a full-canvas rect during a "Full Camera"
+ * timeline region, at progress `t` (0 = from, 1 = to). Pure and shape-agnostic so preview
+ * (DOM transform) and export (canvas draw) can share the exact same math.
+ */
+export function lerpRect(
+ from: StyledRenderRect,
+ to: StyledRenderRect,
+ t: number,
+): StyledRenderRect {
+ const clamped = Math.max(0, Math.min(1, t));
+ return {
+ x: from.x + (to.x - from.x) * clamped,
+ y: from.y + (to.y - from.y) * clamped,
+ width: from.width + (to.width - from.width) * clamped,
+ height: from.height + (to.height - from.height) * clamped,
+ borderRadius: from.borderRadius + (to.borderRadius - from.borderRadius) * clamped,
+ maskShape: from.maskShape,
+ };
+}
+
+/**
+ * Inset fraction (of the canvas' shorter dimension) left as a visible border around the
+ * webcam when Full Camera expands it, so rounded/circular webcam masks never touch the
+ * canvas edge at full screen. Matches the same order of magnitude as `MARGIN_FRACTION`
+ * used for the picture-in-picture layout above.
+ */
+export const CAMERA_FULLSCREEN_MARGIN_FRACTION = 0.025;
+
+/**
+ * Computes the Full Camera "grown" target rect: the largest rect matching `aspectRect`'s
+ * aspect ratio that fits centered inside the canvas, inset by `CAMERA_FULLSCREEN_MARGIN_FRACTION`
+ * of the canvas' shorter dimension. Preserving the base rect's aspect ratio (rather than
+ * filling the canvas' own aspect ratio) keeps the webcam undistorted throughout the lerp,
+ * since `lerpRect` only stays proportion-correct if both endpoints share the same ratio.
+ * Pure function shared by preview (`VideoPlayback.tsx`) and export (`frameRenderer.ts`) so
+ * both animate to the identical rect.
+ */
+export function computeCameraFullscreenTargetRect(
+ canvasSize: Size,
+ aspectRect: { width: number; height: number },
+): RenderRect {
+ const { width: canvasWidth, height: canvasHeight } = canvasSize;
+ const margin = Math.round(
+ Math.min(canvasWidth, canvasHeight) * CAMERA_FULLSCREEN_MARGIN_FRACTION,
+ );
+ const boundsWidth = Math.max(0, canvasWidth - margin * 2);
+ const boundsHeight = Math.max(0, canvasHeight - margin * 2);
+
+ const aspect =
+ aspectRect.width > 0 && aspectRect.height > 0 ? aspectRect.width / aspectRect.height : 1;
+
+ let width = boundsWidth;
+ let height = width / aspect;
+ if (height > boundsHeight) {
+ height = boundsHeight;
+ width = height * aspect;
+ }
+
+ const x = margin + (boundsWidth - width) / 2;
+ const y = margin + (boundsHeight - height) / 2;
+
+ return { x, y, width, height };
+}
+
export interface Size {
width: number;
height: number;
diff --git a/src/lib/exporter/frameRenderer.ts b/src/lib/exporter/frameRenderer.ts
index 36e86a065..b5e09e04c 100644
--- a/src/lib/exporter/frameRenderer.ts
+++ b/src/lib/exporter/frameRenderer.ts
@@ -10,6 +10,7 @@ import {
import { MotionBlurFilter } from "pixi-filters/motion-blur";
import type {
AnnotationRegion,
+ CameraFullscreenRegion,
CropRegion,
Rotation3D,
SpeedRegion,
@@ -23,6 +24,7 @@ import {
isRotation3DIdentity,
lerpRotation3D,
} from "@/components/video-editor/types";
+import { computeCameraFullscreenProgress } from "@/components/video-editor/videoPlayback/cameraFullscreenUtils";
import {
AUTO_FOLLOW_PARAMS,
DEFAULT_FOCUS,
@@ -43,8 +45,10 @@ import {
type MotionBlurState,
} from "@/components/video-editor/videoPlayback/zoomTransform";
import {
+ computeCameraFullscreenTargetRect,
computeCompositeLayout,
getWebcamLayoutPresetDefinition,
+ lerpRect,
reactiveWebcamScale,
type Size,
type StyledRenderRect,
@@ -78,6 +82,7 @@ interface FrameRenderConfig {
height: number;
wallpaper: string;
zoomRegions: ZoomRegion[];
+ cameraFullscreenRegions?: CameraFullscreenRegion[];
showShadow: boolean;
shadowIntensity: number;
showBlur: boolean;
@@ -118,6 +123,7 @@ interface AnimationState {
x: number;
y: number;
appliedScale: number;
+ cameraFullscreenProgress: number;
}
interface LayoutCache {
@@ -177,6 +183,7 @@ export class FrameRenderer {
x: 0,
y: 0,
appliedScale: 1,
+ cameraFullscreenProgress: 0,
};
}
@@ -778,6 +785,11 @@ export class FrameRenderer {
private updateAnimationState(timeMs: number): number {
if (!this.cameraContainer || !this.layoutCache) return 0;
+ this.animationState.cameraFullscreenProgress = computeCameraFullscreenProgress(
+ this.config.cameraFullscreenRegions ?? [],
+ timeMs,
+ );
+
const { region, strength, blendedScale, rotation3D, transition } = findDominantRegion(
this.config.zoomRegions,
timeMs,
@@ -1030,26 +1042,49 @@ export class FrameRenderer {
if (webcamFrame && webcamRect) {
const preset = getWebcamLayoutPresetDefinition(this.config.webcamLayoutPreset);
const shape = webcamRect.maskShape ?? this.config.webcamMaskShape ?? "rectangle";
- // Scale the PiP webcam inversely with the eased zoom, anchoring the shrink to the
- // docked corner (bottom-right by default) like the preview, so it stays flush to the
- // edges instead of drifting toward center.
- const reactiveFactor =
- this.config.webcamReactiveZoom && this.config.webcamLayoutPreset === "picture-in-picture"
- ? reactiveWebcamScale(this.animationState.appliedScale)
- : 1;
- const camPos = this.config.webcamPosition;
- const biasX = (camPos ? camPos.cx >= 0.5 : true) ? 1 : 0;
- const biasY = (camPos ? camPos.cy >= 0.5 : true) ? 1 : 0;
- const drawRect =
- reactiveFactor < 1
- ? {
- width: webcamRect.width * reactiveFactor,
- height: webcamRect.height * reactiveFactor,
- x: webcamRect.x + webcamRect.width * (1 - reactiveFactor) * biasX,
- y: webcamRect.y + webcamRect.height * (1 - reactiveFactor) * biasY,
- borderRadius: webcamRect.borderRadius * reactiveFactor,
- }
- : webcamRect;
+ const cameraFullProgress = this.animationState.cameraFullscreenProgress;
+ let drawRect: StyledRenderRect;
+ if (cameraFullProgress > 0) {
+ // Full Camera takes over the webcam's size/position entirely, growing it to cover
+ // the whole stage (inset by a margin, aspect-preserving — see
+ // computeCameraFullscreenTargetRect). Reactive zoom is ignored for this frame (see
+ // design notes 6.4): mixing "shrink for zoom" and "grow to full" in the same frame
+ // doesn't make sense.
+ const targetRect = computeCameraFullscreenTargetRect(
+ { width: this.config.width, height: this.config.height },
+ webcamRect,
+ );
+ const fullRect: StyledRenderRect = {
+ x: targetRect.x,
+ y: targetRect.y,
+ width: targetRect.width,
+ height: targetRect.height,
+ borderRadius: 0,
+ maskShape: webcamRect.maskShape,
+ };
+ drawRect = lerpRect(webcamRect, fullRect, cameraFullProgress);
+ } else {
+ // Scale the PiP webcam inversely with the eased zoom, anchoring the shrink to the
+ // docked corner (bottom-right by default) like the preview, so it stays flush to the
+ // edges instead of drifting toward center.
+ const reactiveFactor =
+ this.config.webcamReactiveZoom && this.config.webcamLayoutPreset === "picture-in-picture"
+ ? reactiveWebcamScale(this.animationState.appliedScale)
+ : 1;
+ const camPos = this.config.webcamPosition;
+ const biasX = (camPos ? camPos.cx >= 0.5 : true) ? 1 : 0;
+ const biasY = (camPos ? camPos.cy >= 0.5 : true) ? 1 : 0;
+ drawRect =
+ reactiveFactor < 1
+ ? {
+ width: webcamRect.width * reactiveFactor,
+ height: webcamRect.height * reactiveFactor,
+ x: webcamRect.x + webcamRect.width * (1 - reactiveFactor) * biasX,
+ y: webcamRect.y + webcamRect.height * (1 - reactiveFactor) * biasY,
+ borderRadius: webcamRect.borderRadius * reactiveFactor,
+ }
+ : webcamRect;
+ }
const sourceWidth =
("displayWidth" in webcamFrame && webcamFrame.displayWidth > 0
? webcamFrame.displayWidth
diff --git a/src/lib/exporter/gifExporter.ts b/src/lib/exporter/gifExporter.ts
index 9b06fcd30..1a5ef56e8 100644
--- a/src/lib/exporter/gifExporter.ts
+++ b/src/lib/exporter/gifExporter.ts
@@ -1,6 +1,7 @@
import GIF from "gif.js";
import type {
AnnotationRegion,
+ CameraFullscreenRegion,
CropRegion,
SpeedRegion,
TrimRegion,
@@ -34,6 +35,7 @@ interface GifExporterConfig {
sizePreset: GifSizePreset;
wallpaper: string;
zoomRegions: ZoomRegion[];
+ cameraFullscreenRegions?: CameraFullscreenRegion[];
trimRegions?: TrimRegion[];
speedRegions?: SpeedRegion[];
showShadow: boolean;
@@ -151,6 +153,7 @@ export class GifExporter {
height: this.config.height,
wallpaper: this.config.wallpaper,
zoomRegions: this.config.zoomRegions,
+ cameraFullscreenRegions: this.config.cameraFullscreenRegions,
showShadow: this.config.showShadow,
shadowIntensity: this.config.shadowIntensity,
showBlur: this.config.showBlur,
diff --git a/src/lib/exporter/videoExporter.ts b/src/lib/exporter/videoExporter.ts
index a1b67c5ff..2703a9437 100644
--- a/src/lib/exporter/videoExporter.ts
+++ b/src/lib/exporter/videoExporter.ts
@@ -1,5 +1,6 @@
import type {
AnnotationRegion,
+ CameraFullscreenRegion,
CropRegion,
SpeedRegion,
TrimRegion,
@@ -57,6 +58,7 @@ export interface VideoExporterConfig extends ExportConfig {
webcamVideoUrl?: string;
wallpaper: string;
zoomRegions: ZoomRegion[];
+ cameraFullscreenRegions?: CameraFullscreenRegion[];
trimRegions?: TrimRegion[];
speedRegions?: SpeedRegion[];
showShadow: boolean;
@@ -139,6 +141,8 @@ export function getSourceCopyFastPathBlockers(
if (hasActiveTimeRegions(config.trimRegions)) blockers.push("trim regions are present");
if (hasActiveSpeedRegions(config.speedRegions)) blockers.push("speed regions are present");
if (hasActiveTimeRegions(config.zoomRegions)) blockers.push("zoom regions are present");
+ if (hasActiveTimeRegions(config.cameraFullscreenRegions))
+ blockers.push("camera fullscreen regions are present");
if (hasActiveTimeRegions(config.annotationRegions))
blockers.push("annotation regions are present");
if (hasNativeCursorOverlay(config)) blockers.push("editable cursor overlay is enabled");
@@ -277,6 +281,7 @@ export class VideoExporter {
height: this.config.height,
wallpaper: this.config.wallpaper,
zoomRegions: this.config.zoomRegions,
+ cameraFullscreenRegions: this.config.cameraFullscreenRegions,
showShadow: this.config.showShadow,
shadowIntensity: this.config.shadowIntensity,
showBlur: this.config.showBlur,
diff --git a/src/lib/shortcuts.ts b/src/lib/shortcuts.ts
index 2ebdb64c5..a3eb00820 100644
--- a/src/lib/shortcuts.ts
+++ b/src/lib/shortcuts.ts
@@ -6,6 +6,7 @@ export const SHORTCUT_ACTIONS = [
"addAnnotation",
"addBlur",
"addKeyframe",
+ "addCameraFullscreen",
"deleteSelected",
"playPause",
"copySelected",
@@ -115,6 +116,7 @@ export const DEFAULT_SHORTCUTS: ShortcutsConfig = {
addAnnotation: { key: "a" },
addBlur: { key: "b" },
addKeyframe: { key: "f" },
+ addCameraFullscreen: { key: "c" },
deleteSelected: { key: "d", ctrl: true },
playPause: { key: " " },
copySelected: { key: "c", ctrl: true },
@@ -129,6 +131,7 @@ export const SHORTCUT_LABELS: Record<ShortcutAction, string> = {
addAnnotation: "Add Annotation",
addBlur: "Add Blur",
addKeyframe: "Add Keyframe",
+ addCameraFullscreen: "Add Full Camera",
deleteSelected: "Delete Selected",
playPause: "Play / Pause",
copySelected: "Copy Selected",