Create polished demo videos without editing skills. Mac/Windows/Linux
Merge branch 'main' into codex/feature/camera-crop
aeifc54b0f2bba0
diff --cc src/components/video-editor/VideoPlayback.tsxindex 8e1af423,99362abb..e9fce7e6--- a/src/components/video-editor/VideoPlayback.tsx+++ b/src/components/video-editor/VideoPlayback.tsx@@@ -362,11 -369,12 +373,16 @@@ const VideoPlayback = forwardRef<VideoPconst webcamVideoRef = useRef<HTMLVideoElement | null>(null);const webcamBubbleRef = useRef<HTMLDivElement | null>(null);const webcamBubbleInnerRef = useRef<HTMLDivElement | null>(null);+ const [webcamVideoDimensions, setWebcamVideoDimensions] = useState<{+ width: number;+ height: number;+ } | null>(null);const captionBoxRef = useRef<HTMLDivElement | null>(null);+ const captionEditInputRef = useRef<HTMLTextAreaElement | null>(null);+ const captionEditSessionRef = useRef<CaptionEditSession | null>(null);+ const [captionEditSession, setCaptionEditSession] = useState<CaptionEditSession | null>(+ null,+ );const currentTimeRef = useRef(0);const zoomRegionsRef = useRef<ZoomRegion[]>([]);const selectedZoomIdRef = useRef<string | null>(null);@@@ -515,46 -671,8 +679,46 @@@});return () => cancelAnimationFrame(frame);- }, [activeCaptionLayout, autoCaptionSettings]);+ }, [activeCaptionLayout, autoCaptionSettings, captionEditSizeKey, isCaptionEditing]);const motionBlurStateRef = useRef<MotionBlurState>(createMotionBlurState());+ const webcamEnabled = webcam?.enabled ?? false;+ const webcamMargin = webcam?.margin ?? 24;+ const webcamSize = webcam?.size ?? DEFAULT_WEBCAM_SIZE;+ const webcamReactToZoom = webcam?.reactToZoom ?? DEFAULT_WEBCAM_REACT_TO_ZOOM;+ const webcamPositionPreset = webcam?.positionPreset ?? webcam?.corner ?? "bottom-right";+ const webcamPositionX = webcam?.positionX ?? 1;+ const webcamPositionY = webcam?.positionY ?? 1;+ const webcamCorner = webcam?.corner ?? "bottom-right";+ const webcamCornerRadius = webcam?.cornerRadius ?? DEFAULT_WEBCAM_CORNER_RADIUS;+ const webcamShadow = webcam?.shadow ?? DEFAULT_WEBCAM_SHADOW;+ const webcamTimeOffsetMs = webcam?.timeOffsetMs;+ const webcamCropRegion = webcam?.cropRegion;+ const webcamMirror = webcam?.mirror ?? false;+ const webcamCropPreviewContentStyle = useMemo<React.CSSProperties>(() => {+ if (!webcamVideoDimensions) {+ return { opacity: 0 };+ }++ const { sx, sy, sw, sh } = getWebcamCropSourceRect(+ webcamCropRegion,+ webcamVideoDimensions.width,+ webcamVideoDimensions.height,+ );+ const coverScale = Math.max(1 / sw, 1 / sh);+ const drawWidth = webcamVideoDimensions.width * coverScale;+ const drawHeight = webcamVideoDimensions.height * coverScale;+ const drawX = (1 - sw * coverScale) / 2 - sx * coverScale;+ const drawY = (1 - sh * coverScale) / 2 - sy * coverScale;++ return {+ left: `${drawX * 100}%`,+ top: `${drawY * 100}%`,+ width: `${drawWidth * 100}%`,+ height: `${drawHeight * 100}%`,+ maxWidth: "none",+ willChange: "left, top, width, height",+ };+ }, [webcamCropRegion, webcamVideoDimensions]);const applyWebcamBubbleLayout = useCallback((zoomScale: number) => {