Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Project FPS select in the Program Monitor header (next to aspect presets) —
pick 24 / 25 / 30 / 50 / 60 fps; writes `project.fps` and persists like canvas
size. Non-preset rates appear as Custom.
- Preview playback speed — a monitor toolbar toggle plus **J**/**K**/**L** shortcuts cycle the preview player through 1×, 1.5×, 2×, and 4× (L faster, J slower, K play/pause and reset to 1×). It rides on top of each clip's own speed and is forced back to 1× during export, so renders always come out at real time.

## [1.6.0] - 2026-07-14
Expand Down
7 changes: 6 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Examples in `library/svg/`: `sparkles.svg` (loop), `lower-third.svg`,
```jsonc
{
"name": "My Edit",
"width": 1280, "height": 720, "fps": 30, // canvas/export settings
"width": 1280, "height": 720, "fps": 30, // timeline + export rate (UI: Program Monitor FPS select)
"background": "#000000", // canvas color behind all clips (optional)
"revision": 7, // bump on every write!
"markers": [ { "t": 2.5 }, { "t": 5.0, "label": "drop" } ],
Expand Down Expand Up @@ -523,6 +523,11 @@ or simply `transitionOut: {type:"fade", duration:3}`.
**Vertical reel**: set project `width:1080, height:1920`; use the UI's safe-area
guides (▦) to keep captions out of platform UI zones.

**Project frame rate**: set `fps` in `project.json` (or the Program Monitor FPS
dropdown — 24 / 25 / 30 / 50 / 60). Preview stepping, timecode frames, Fast/
Realtime export, and `/api/export/begin` all use this value; pass the same
`fps` when starting an export via the API.

## Export

Export is user-driven (Export button → dialog). Two engines: **Fast** (browser
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ same time.
audio at the playhead (useful when stepping frame-by-frame). Scrubbing or
frame-step retargets the held slice; meters stay live. **Play** / **Pause**
turns it off.
- Canvas aspect presets (16:9, 9:16 reels, 4:5, 1:1) + safe-area guides
- Canvas aspect presets (16:9, 9:16 reels, 4:5, 1:1) + project FPS select
(24 / 25 / 30 / 50 / 60; non-preset rates show as Custom) + safe-area guides
- **Program Monitor zoom** — mouse-wheel over the preview zooms the composition
toward the cursor (fit → up to **2 screen pixels per canvas pixel**). Magnified
view uses **native scrollbars** so overflow stays reachable; middle-click or
Expand Down
29 changes: 24 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const ASPECT_PRESETS = [
{ label: "4:5 · IG 1080×1350", w: 1080, h: 1350 },
{ label: "1:1 · 1080×1080", w: 1080, h: 1080 },
];
const FPS_PRESETS = [24, 25, 30, 50, 60];
const WAVE_PEAKS_PER_SEC = 50;
const TRACK_IDS = new Set(TRACKS.map((t) => t.id));
// Audio lanes available for a video's per-channel linked audio (index = props.audioChannel).
Expand Down Expand Up @@ -319,8 +320,8 @@ const els = {
btnAudioHold: $("btnAudioHold"),
exportOverlay: $("exportOverlay"), exportProgress: $("exportProgress"),
exportTitle: $("exportTitle"), exportNote: $("exportNote"),
projectName: $("projectName"), monitorRes: $("monitorRes"),
aspectSel: $("aspectSel"), btnGuides: $("btnGuides"), btnZoom100: $("btnZoom100"),
projectName: $("projectName"),
aspectSel: $("aspectSel"), fpsSel: $("fpsSel"), btnGuides: $("btnGuides"), btnZoom100: $("btnZoom100"),
safeOverlay: $("safeOverlay"), btnSpeed: $("btnSpeed"),
monitorStage: $("monitorStage"), monitorScroll: $("monitorScroll"),
monitorZoomInner: $("monitorZoomInner"), kfGraphs: $("kfGraphs"),
Expand Down Expand Up @@ -612,8 +613,8 @@ function applyProject(data) {
for (const el of runtime.clipEls.values()) { try { el.pause(); el.src = ""; } catch { } }
runtime.clipEls.clear(); runtime.clipGain.clear();
els.preview.width = project.width; els.preview.height = project.height;
els.monitorRes.textContent = `${project.width} × ${project.height} · ${project.fps}fps`;
syncAspectSel();
syncFpsSel();
pruneSelection(); // keep the selection across external reloads where possible
state.dirtyTimeline = true;
renderBin(); renderInspector();
Expand Down Expand Up @@ -5568,24 +5569,42 @@ els.binTabs.addEventListener("contextmenu", (e) => {
openProjectTabMenu(e.clientX, e.clientY);
});

/* ── Canvas aspect presets + safe-area guides ── */
/* ── Canvas aspect presets + project FPS + safe-area guides ── */
function syncAspectSel() {
if (!els.aspectSel) return;
const i = ASPECT_PRESETS.findIndex((a) => a.w === project.width && a.h === project.height);
els.aspectSel.innerHTML =
ASPECT_PRESETS.map((a, j) => `<option value="${j}" ${j === i ? "selected" : ""}>${a.label}</option>`).join("") +
(i < 0 ? `<option value="custom" selected>Custom · ${project.width}×${project.height}</option>` : "");
Comment on lines 5573 to 5578

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Avoid interpolating project dimensions into innerHTML.

project.width and project.height come from loaded project data and are inserted directly into the custom option label. Build <option> elements and assign textContent instead; this avoids malformed or imported project data being interpreted as markup.

Proposed fix
 function syncAspectSel() {
   if (!els.aspectSel) return;
   const i = ASPECT_PRESETS.findIndex((a) => a.w === project.width && a.h === project.height);
-  els.aspectSel.innerHTML =
-    ASPECT_PRESETS.map((a, j) => `<option value="${j}" ${j === i ? "selected" : ""}>${a.label}</option>`).join("") +
-    (i < 0 ? `<option value="custom" selected>Custom · ${project.width}×${project.height}</option>` : "");
+  const options = ASPECT_PRESETS.map((a, j) => {
+    const option = document.createElement("option");
+    option.value = String(j);
+    option.textContent = a.label;
+    option.selected = j === i;
+    return option;
+  });
+  if (i < 0) {
+    const option = document.createElement("option");
+    option.value = "custom";
+    option.textContent = `Custom · ${project.width}×${project.height}`;
+    option.selected = true;
+    options.push(option);
+  }
+  els.aspectSel.replaceChildren(...options);
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function syncAspectSel() {
if (!els.aspectSel) return;
const i = ASPECT_PRESETS.findIndex((a) => a.w === project.width && a.h === project.height);
els.aspectSel.innerHTML =
ASPECT_PRESETS.map((a, j) => `<option value="${j}" ${j === i ? "selected" : ""}>${a.label}</option>`).join("") +
(i < 0 ? `<option value="custom" selected>Custom · ${project.width}×${project.height}</option>` : "");
function syncAspectSel() {
if (!els.aspectSel) return;
const i = ASPECT_PRESETS.findIndex((a) => a.w === project.width && a.h === project.height);
const options = ASPECT_PRESETS.map((a, j) => {
const option = document.createElement("option");
option.value = String(j);
option.textContent = a.label;
option.selected = j === i;
return option;
});
if (i < 0) {
const option = document.createElement("option");
option.value = "custom";
option.textContent = `Custom · ${project.width}×${project.height}`;
option.selected = true;
options.push(option);
}
els.aspectSel.replaceChildren(...options);
}
🧰 Tools
🪛 ast-grep (0.45.0)

[warning] 5575-5577: Avoid assigning untrusted data to innerHTML/outerHTML or document.write
Context: els.aspectSel.innerHTML =
ASPECT_PRESETS.map((a, j) => <option value="${j}" ${j === i ? "selected" : ""}>${a.label}</option>).join("") +
(i < 0 ? <option value="custom" selected>Custom · ${project.width}×${project.height}</option> : "")
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').

(inner-outer-html)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app.js` around lines 5573 - 5578, Update syncAspectSel so option labels are
assigned through textContent rather than interpolating project.width and
project.height into innerHTML. Build the ASPECT_PRESETS options and the custom
option as DOM option elements, preserving selection behavior and the existing
custom label.

Source: Linters/SAST tools

}
function syncFpsSel() {
if (!els.fpsSel) return;
const fps = Number(project.fps);
const i = FPS_PRESETS.findIndex((v) => v === fps);
els.fpsSel.innerHTML =
FPS_PRESETS.map((v, j) => `<option value="${j}" ${j === i ? "selected" : ""}>${v} fps</option>`).join("") +
(i < 0 && Number.isFinite(fps) && fps > 0
? `<option value="custom" selected>Custom · ${fps} fps</option>`
: "");
}
els.aspectSel.addEventListener("change", () => {
const a = ASPECT_PRESETS[+els.aspectSel.value];
if (!a) return;
project.width = a.w; project.height = a.h;
els.preview.width = a.w; els.preview.height = a.h;
els.monitorRes.textContent = `${a.w} × ${a.h} · ${project.fps}fps`;
syncAspectSel();
seekMediaWhilePaused();
scheduleSave();
});
els.fpsSel?.addEventListener("change", () => {
const v = FPS_PRESETS[+els.fpsSel.value];
if (!(v > 0)) return;
project.fps = v;
syncFpsSel();
state.dirtyTimeline = true;
seekMediaWhilePaused();
scheduleSave();
});
els.btnGuides.addEventListener("click", () => {
state.guides = !state.guides;
els.btnGuides.classList.toggle("on", state.guides);
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
</span>
<span class="panel-head-actions">
<select id="aspectSel" class="head-select" title="Canvas aspect preset"></select>
<select id="fpsSel" class="head-select" title="Project frame rate"></select>
<button class="btn tiny toggle" id="btnGuides" title="Toggle safe-area guides">▦ Safe</button>
<span class="dim" id="monitorRes">1280 × 720 · 30fps</span>
</span>
</div>
<div class="monitor-stage" id="monitorStage">
Expand Down
1 change: 1 addition & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,7 @@ body.track-size-s .clip.selected {
font: 12px "Segoe UI", sans-serif;
max-width: 170px;
}
#fpsSel.head-select { max-width: 88px; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep custom FPS values readable.

Custom · 29.97 fps is wider than the 88px limit, so the selected value can be clipped and hide the actual project rate. Use a shorter display label or allow enough width for common custom values.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@style.css` at line 923, Update the `#fpsSel.head-select` styling so custom FPS
values such as “Custom · 29.97 fps” remain fully readable, either by increasing
max-width to accommodate common values or by using a shorter selected-value
label while preserving the existing selector behavior.


/* ── Safe-area guides (positioned over the canvas by JS) ── */
#safeOverlay {
Expand Down
Loading