Skip to content

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

revert(speed): restore the 100x playback cap

Etienne Lescot7e482e4dc0c7
diff --git a/src/components/ai-edition/v4/FloatingInspector.tsx b/src/components/ai-edition/v4/FloatingInspector.tsx
index 41f03e515..f7e9cb17f 100644
--- a/src/components/ai-edition/v4/FloatingInspector.tsx
+++ b/src/components/ai-edition/v4/FloatingInspector.tsx
@@ -367,8 +367,8 @@ const SPEED_PRESETS = [1, ...SPEED_OPTIONS.map((option) => option.speed)].sort((
* (`settings.speed.customPlaybackSpeed` / `maxSpeedError` / `previewFrameSteppingHint`, shipped
* in all 13 locales) but no longer any control for: the V4 shell replaced the panel that hosted
* it with a preset-only `<select>` capped at 3×, while the underlying capability goes to
- * `MAX_PLAYBACK_SPEED` (16×, the native HTMLMediaElement ceiling). Only the control was
- * missing, so this rewires it rather than adding anything new.
+ * `MAX_PLAYBACK_SPEED` (100×). Only the control was missing, so this rewires it rather than
+ * adding anything new.
*/
export function SpeedControl({
region,
diff --git a/src/components/ai-edition/v4/SpeedControl.test.tsx b/src/components/ai-edition/v4/SpeedControl.test.tsx
index 05d68be42..c510227d7 100644
--- a/src/components/ai-edition/v4/SpeedControl.test.tsx
+++ b/src/components/ai-edition/v4/SpeedControl.test.tsx
@@ -32,11 +32,11 @@ describe("SpeedControl", () => {
it("commits a free-typed speed above the preset ceiling", () => {
// The regression this control exists for: the V4 shell only offered presets up to 3×,
- // while the underlying capability reaches 16× (the native HTMLMediaElement ceiling).
+ // while the underlying capability reaches 100×.
const { updateSpeedValue, field } = renderControl(1);
- fireEvent.change(field, { target: { value: "10" } });
+ fireEvent.change(field, { target: { value: "25" } });
fireEvent.blur(field);
- expect(updateSpeedValue).toHaveBeenCalledWith("sp1", 10);
+ expect(updateSpeedValue).toHaveBeenCalledWith("sp1", 25);
});
it("commits on Enter as well as on blur, and only once", () => {
@@ -53,7 +53,7 @@ describe("SpeedControl", () => {
fireEvent.change(field, { target: { value: "500" } });
fireEvent.blur(field);
expect(updateSpeedValue).not.toHaveBeenCalled();
- expect(toastError).toHaveBeenCalledWith("speed.maxSpeedError:16");
+ expect(toastError).toHaveBeenCalledWith("speed.maxSpeedError:100");
});
it("ignores an unparseable draft without touching the region", () => {
diff --git a/src/components/video-editor/customPlaybackSpeed.test.ts b/src/components/video-editor/customPlaybackSpeed.test.ts
index f15dbde8d..eb14cf16e 100644
--- a/src/components/video-editor/customPlaybackSpeed.test.ts
+++ b/src/components/video-editor/customPlaybackSpeed.test.ts
@@ -45,25 +45,26 @@ describe("parseCustomPlaybackSpeedInput", () => {
});
it("accepts the maximum editor speed", () => {
- expect(parseCustomPlaybackSpeedInput("16")).toEqual({
+ expect(parseCustomPlaybackSpeedInput("100")).toEqual({
status: "valid",
- draft: "16",
- speed: 16,
+ draft: "100",
+ speed: 100,
});
});
- it("rejects speeds that exceed the native preview rate", () => {
- // 16.1× exceeds Chromium's playbackRate ceiling, so the editor rejects it.
+ it("accepts high speeds that exceed the native preview rate", () => {
+ // 16.1× was rejected under the old 16× cap; it must now be valid.
expect(parseCustomPlaybackSpeedInput("16.1")).toEqual({
- status: "too-fast",
+ status: "valid",
draft: "16.1",
+ speed: 16.1,
});
});
it("rejects speeds above the editor maximum", () => {
- expect(parseCustomPlaybackSpeedInput("50")).toEqual({
+ expect(parseCustomPlaybackSpeedInput("100.1")).toEqual({
status: "too-fast",
- draft: "50",
+ draft: "100.1",
});
});
});
diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.ts
index d0745cefb..627402844 100644
--- a/src/components/video-editor/projectPersistence.ts
+++ b/src/components/video-editor/projectPersistence.ts
@@ -34,8 +34,10 @@ import {
DEFAULT_ZOOM_MOTION_BLUR,
MAX_BLUR_BLOCK_SIZE,
MAX_BLUR_INTENSITY,
+ MAX_PLAYBACK_SPEED,
MIN_BLUR_BLOCK_SIZE,
MIN_BLUR_INTENSITY,
+ MIN_PLAYBACK_SPEED,
type SpeedRegion,
type TrimRegion,
type WebcamLayoutPreset,
@@ -318,13 +320,12 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro
const startMs = Math.max(0, Math.min(rawStart, rawEnd));
const endMs = Math.max(startMs + 1, rawEnd);
- // Clamp an out-of-range speed rather than discarding it: a saved 25×
- // should become the cap, not silently reset to the 1.5× default.
- // Lowering MAX_PLAYBACK_SPEED widened the reset window, so the
- // range test now only guards against non-numeric values.
- const speed = isFiniteNumber(region.speed)
- ? clampPlaybackSpeed(region.speed)
- : DEFAULT_PLAYBACK_SPEED;
+ const speed =
+ isFiniteNumber(region.speed) &&
+ region.speed >= MIN_PLAYBACK_SPEED &&
+ region.speed <= MAX_PLAYBACK_SPEED
+ ? clampPlaybackSpeed(region.speed)
+ : DEFAULT_PLAYBACK_SPEED;
return {
id: region.id,
diff --git a/src/components/video-editor/types.ts b/src/components/video-editor/types.ts
index 71c79848d..aaeac5333 100644
--- a/src/components/video-editor/types.ts
+++ b/src/components/video-editor/types.ts
@@ -390,20 +390,10 @@ export const DEFAULT_CROP_REGION: CropRegion = {
export type PlaybackSpeed = number;
export const MIN_PLAYBACK_SPEED = 0.1;
+export const MAX_PLAYBACK_SPEED = 100;
// Chromium hard-caps HTMLMediaElement.playbackRate at 16 (setting more throws
// NotSupportedError). At or below this, preview plays natively; above it, preview
// frame-steps by seeking and audio export uses an offline pitch-preserved stretch.
-// ponytail: the editor cap and the native preview cap are the same number —
-// everything above this is the export path's stretch, and the editor's input
-// parser shouldn't accept speeds the preview cannot render. A 50× entry is
-// REJECTED (the field reverts to its previous value), not clamped — see
-// `parseCustomPlaybackSpeedInput`, which returns `too-fast` above this bound.
-//
-// NOTE: this bound is enforced on the editor input only. The LLM agent tools
-// (electron/ai-edition/agent-tools.ts) still accept any positive speed, so an
-// agent-authored region can exceed it: preview clamps to MAX_NATIVE_PLAYBACK_RATE
-// while export renders the true speed.
-export const MAX_PLAYBACK_SPEED = 16;
export const MAX_NATIVE_PLAYBACK_RATE = 16;
export function clampPlaybackSpeed(speed: number): PlaybackSpeed {