Skip to content

Commit a7443ec

Browse files
author
Iris
committed
Phase 1.1: also expose wasm TICKS_PER_SECOND + mediaTimeFromSeconds/roundMediaTime
MCP callers speak seconds; TimelineElement expects MediaTime (integer ticks). Expose the wasm helpers so callers don't need to import the wasm module. Ticks per second happens to be 120000 at runtime — fine granularity for split math, and matches the internal MediaTime(i64) invariant enforced by requireMediaTime() (see wasm/media-time.ts). opencut-mcp now converts all time arguments (startTime, duration, trimStart, trimEnd, sourceDuration, split time, move newStartTime) via mediaTimeFromSeconds before crossing into the editor.
1 parent eca7304 commit a7443ec

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

  • apps/web/src/app/editor/[project_id]

apps/web/src/app/editor/[project_id]/page.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,24 @@ import {
3535
getBookmarkPreviewOverlaySource,
3636
} from "@/timeline/bookmarks/index";
3737
import { EditorCore } from "@/core";
38+
import { TICKS_PER_SECOND, mediaTime, mediaTimeFromSeconds, roundMediaTime } from "@/wasm";
3839

3940
// dev-only global exposure for MCP / Playwright automation.
4041
// Access via `window.__editor` in DevTools or via Playwright `browser_evaluate`.
42+
// `__opencut` exposes wasm time helpers so external callers can construct
43+
// MediaTime values from seconds without importing the wasm module.
4144
if (typeof window !== "undefined" && process.env.NODE_ENV !== "production") {
42-
(window as unknown as { __editor: EditorCore }).__editor =
43-
EditorCore.getInstance();
45+
const w = window as unknown as {
46+
__editor: EditorCore;
47+
__opencut: {
48+
TICKS_PER_SECOND: number;
49+
mediaTime: typeof mediaTime;
50+
mediaTimeFromSeconds: typeof mediaTimeFromSeconds;
51+
roundMediaTime: typeof roundMediaTime;
52+
};
53+
};
54+
w.__editor = EditorCore.getInstance();
55+
w.__opencut = { TICKS_PER_SECOND, mediaTime, mediaTimeFromSeconds, roundMediaTime };
4456
}
4557

4658
export default function Editor() {

0 commit comments

Comments
 (0)