Skip to content

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

Merge branch 'main' into feature/webcam-resize-slider

Garry Priambudi0e1a69a7b21a
diff --cc src/components/video-editor/SettingsPanel.tsx
index c2d66ffa3,35778ec00..daf5f4242
--- a/src/components/video-editor/SettingsPanel.tsx
+++ b/src/components/video-editor/SettingsPanel.tsx
@@@ -56,7 -55,70 +56,70 @@@ import type
ZoomDepth,
ZoomFocusMode,
} from "./types";
- import { DEFAULT_WEBCAM_SIZE_PRESET, SPEED_OPTIONS } from "./types";
-import { MAX_PLAYBACK_SPEED, SPEED_OPTIONS } from "./types";
++import { DEFAULT_WEBCAM_SIZE_PRESET, MAX_PLAYBACK_SPEED, SPEED_OPTIONS } from "./types";
+
+ function CustomSpeedInput({
+ value,
+ onChange,
+ onError,
+ }: {
+ value: number;
+ onChange: (val: number) => void;
+ onError: () => void;
+ }) {
+ const isPreset = SPEED_OPTIONS.some((o) => o.speed === value);
+ const [draft, setDraft] = useState(isPreset ? "" : String(Math.round(value)));
+ const [isFocused, setIsFocused] = useState(false);
+
+ const prevValue = useRef(value);
+ if (!isFocused && prevValue.current !== value) {
+ prevValue.current = value;
+ setDraft(isPreset ? "" : String(Math.round(value)));
+ }
+
+ const handleChange = useCallback(
+ (e: React.ChangeEvent<HTMLInputElement>) => {
+ const digits = e.target.value.replace(/\D/g, "");
+ if (digits === "") {
+ setDraft("");
+ return;
+ }
+ const num = Number(digits);
+ if (num > MAX_PLAYBACK_SPEED) {
+ onError();
+ return;
+ }
+ setDraft(digits);
+ if (num >= 1) onChange(num);
+ },
+ [onChange, onError],
+ );
+
+ const handleBlur = useCallback(() => {
+ setIsFocused(false);
+ if (!draft || Number(draft) < 1) {
+ setDraft(isPreset ? "" : String(Math.round(value)));
+ }
+ }, [draft, isPreset, value]);
+
+ return (
+ <div className="flex items-center gap-1">
+ <input
+ type="text"
+ inputMode="numeric"
+ pattern="[0-9]*"
+ placeholder="--"
+ value={draft}
+ onFocus={() => setIsFocused(true)}
+ onChange={handleChange}
+ onBlur={handleBlur}
+ onKeyDown={(e) => e.key === "Enter" && (e.target as HTMLInputElement).blur()}
+ className="w-12 bg-white/5 border border-white/10 rounded-md px-1 py-0.5 text-[11px] font-semibold text-[#d97706] text-center focus:outline-none focus:border-[#d97706]/40"
+ />
+ <span className="text-[11px] font-semibold text-slate-500">×</span>
+ </div>
+ );
+ }
const WALLPAPER_COUNT = 18;
const WALLPAPER_RELATIVE = Array.from(
diff --cc src/components/video-editor/projectPersistence.ts
index 3a1ca0f68,fad8fa37a..45513d4cd
--- a/src/components/video-editor/projectPersistence.ts
+++ b/src/components/video-editor/projectPersistence.ts
@@@ -14,8 -15,9 +15,10 @@@ import
DEFAULT_WEBCAM_LAYOUT_PRESET,
DEFAULT_WEBCAM_MASK_SHAPE,
DEFAULT_WEBCAM_POSITION,
+ DEFAULT_WEBCAM_SIZE_PRESET,
DEFAULT_ZOOM_DEPTH,
+ MAX_PLAYBACK_SPEED,
+ MIN_PLAYBACK_SPEED,
type SpeedRegion,
type TrimRegion,
type WebcamLayoutPreset,