Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Separate Video selection from scene editing

Bittied8d8285fdbf
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index ac80a87..523fd2b 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -28,7 +28,7 @@ Changes since 0.3.2.
- Retired Long Shot from scene choices; use Bridge to connect videos. Existing Long Shot scenes remain compatible.
-- Video cards match Shot sizing, show the opening playback frame and open scenes on click; playback shares Timeline's prepared players. Returning to the Video tab restores the open video.
+- Video cards match Shot sizing and show the opening playback frame. Click to select settings; double-click or choose Edit Scenes to open scenes. Playback shares Timeline's prepared players, and returning to Video restores the open video.
- Video card and popout playback preserve full rendered scene ranges and keep decoders running through background updates.
- Application Back returns from scenes to Video and from image versions to their parent bar.
- Editing generated music creates a separate draft; cards distinguish drafts from playable songs.
diff --git a/docs/scene-types.md b/docs/scene-types.md
index 436fca2..9e7a78c 100644
--- a/docs/scene-types.md
+++ b/docs/scene-types.md
@@ -1,6 +1,6 @@
# Scene types
-Videos contain ordered Scenes, which contain Shots. The Video library supports folders, grid/list views and sequential card or popout playback. Open a Video to edit its scenes; each scene remains separate in Timeline. Existing projects open with their scenes grouped in a default Video.
+Videos contain ordered Scenes, which contain Shots. The Video library supports folders, grid/list views and sequential card or popout playback. Click a Video to select its settings; double-click or choose **Edit Scenes** in the right panel or context menu to edit its scenes. Each scene remains separate in Timeline. Existing projects open with their scenes grouped in a default Video.
Video settings provide a shared prompt with reference chips, background music and a reference video. Each scene receives the reference range at its cumulative start time: a 10-second first scene uses 0–10 seconds, and the next starts at 10 seconds. Imported/generated media uses the complete asset; reference entries use their saved trim range. Reordering or resizing scenes updates these ranges for the next generation. A source that ends too early blocks generation.
diff --git a/src/components/workspace/VideoLibraryView.test.tsx b/src/components/workspace/VideoLibraryView.test.tsx
index 2a4251b..1764711 100644
--- a/src/components/workspace/VideoLibraryView.test.tsx
+++ b/src/components/workspace/VideoLibraryView.test.tsx
@@ -44,7 +44,9 @@ it("creates nested folders and videos, moves cards to a folder, and opens only t
const video = view.config().videos!.find((video) => video.title === "New video")!;
expect(video.folderId).toBe(view.config().videoFolders![0].id);
fireEvent.change(screen.getByRole("textbox", { name: "Video title" }), { target: { value: "Track one" } });
- fireEvent.click(screen.getByRole("button", { name: "Open Track one" }));
+ fireEvent.click(screen.getByRole("button", { name: "Select Track one" }));
+ expect(screen.queryByLabelText("Scenes editor")).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Edit Scenes" }));
expect(screen.getByTestId("all-scenes")).toHaveTextContent("1"); fireEvent.click(screen.getByRole("button", { name: "Add scene" }));
expect(view.config().videos!.find((item) => item.id === video.id)?.sceneIds).toEqual(["added"]);
expect(view.config().generationJobs.map((scene) => scene.id)).toEqual(["legacy", "added"]);
@@ -54,7 +56,7 @@ it("creates nested folders and videos, moves cards to a folder, and opens only t
fireEvent.drop(screen.getByRole("button", { name: "Open Album" }).closest('[role="listitem"]')!, { dataTransfer });
expect(view.config().videos!.find((item) => item.id === "video-default")?.folderId).toBe(video.folderId);
fireEvent.click(screen.getByRole("button", { name: "List view" })); fireEvent.click(screen.getByRole("button", { name: "Open Album" }));
- expect(screen.getByRole("button", { name: "Open Track one" })).toBeInTheDocument(); expect(screen.getByRole("button", { name: "Open Library" })).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "Select Track one" })).toBeInTheDocument(); expect(screen.getByRole("button", { name: "Select Library" })).toBeInTheDocument();
});
it("creates a whole-song scene sequence and opens the owner for a timeline navigation", () => {
@@ -83,14 +85,14 @@ it("restores the open video after leaving the tab, respects Back and lets scene
render(<Harness />);
const switchTab = () => fireEvent.click(screen.getByRole("button", { name: "Switch tab" }));
fireEvent.click(screen.getByRole("button", { name: "Open Collection" }));
- fireEvent.click(screen.getByRole("button", { name: "Open First" }));
+ fireEvent.doubleClick(screen.getByRole("button", { name: "Select First" }));
switchTab(); expect(screen.queryByLabelText("Scenes editor")).not.toBeInTheDocument(); switchTab();
expect(screen.getByLabelText("Scenes editor")).toHaveTextContent("a");
fireEvent.click(screen.getByRole("button", { name: "Back to Video" }));
- expect(screen.getByRole("button", { name: "Open First" })).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "Select First" })).toBeInTheDocument();
switchTab(); switchTab(); expect(screen.queryByLabelText("Scenes editor")).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Open Collection" }));
- fireEvent.click(screen.getByRole("button", { name: "Open First" }));
+ fireEvent.doubleClick(screen.getByRole("button", { name: "Select First" }));
switchTab(); fireEvent.click(screen.getByRole("button", { name: "Open scene B" }));
expect(screen.getByLabelText("Scenes editor")).toHaveTextContent("b");
switchTab(); switchTab(); expect(screen.getByLabelText("Scenes editor")).toHaveTextContent("b");
@@ -99,8 +101,8 @@ it("restores the open video after leaving the tab, respects Back and lets scene
it("removes folders without deleting their videos and removes video scenes without removing timeline media", async () => {
const config = project(); config.videoFolders = [{ id: "folder", name: "Collection" }]; config.videos = [{ ...newVideo("folder"), title: "Film", sceneIds: ["a"] }]; config.generationJobs = [createDraftGenerationJob("A", { id: "a" })];
const view = mount(config); fireEvent.contextMenu(screen.getByRole("button", { name: "Open Collection" })); fireEvent.click(screen.getByRole("menuitem", { name: "Remove folder" }));
- expect(view.config().videoFolders).toHaveLength(0); expect(screen.getByRole("button", { name: "Open Film" })).toBeInTheDocument();
- fireEvent.contextMenu(screen.getByRole("button", { name: "Open Film" })); fireEvent.click(screen.getByRole("menuitem", { name: "Remove video" }));
+ expect(view.config().videoFolders).toHaveLength(0); expect(screen.getByRole("button", { name: "Select Film" })).toBeInTheDocument();
+ fireEvent.contextMenu(screen.getByRole("button", { name: "Select Film" })); fireEvent.click(screen.getByRole("menuitem", { name: "Remove video" }));
await waitFor(() => expect(view.config().videos).toHaveLength(0)); expect(view.config().generationJobs).toHaveLength(0); expect(view.config().timeline).toEqual(config.timeline);
});
@@ -164,6 +166,29 @@ it("uses the first playback frame as the poster and keeps playback buttons separ
expect(within(inline).getByRole('button', {name: 'Pause Film'})).toBeInTheDocument();
fireEvent.click(screen.getByRole('button',{name:'Pop out Film'})); expect(screen.getByRole('dialog')).toBeInTheDocument(); expect(screen.queryByLabelText('Scenes editor')).not.toBeInTheDocument();
fireEvent.click(screen.getByRole('button',{name:'Close video preview'}));
- fireEvent.click(screen.getByRole('button',{name:'Open Film'}).closest('[role="listitem"]')!); expect(screen.getByLabelText('Scenes editor')).toBeInTheDocument();
+ const card = screen.getByRole('button',{name:'Select Film'}).closest('[role="listitem"]')!;
+ fireEvent.click(card); expect(screen.queryByLabelText('Scenes editor')).not.toBeInTheDocument();
+ fireEvent.doubleClick(card); expect(screen.getByLabelText('Scenes editor')).toBeInTheDocument();
expect(view.config().timeline).toEqual(config.timeline);
});
+
+it.each(["Grid", "List"])("selects video settings and opens scenes from the context menu in %s view", (mode) => {
+ const config = project();
+ config.videos = [{ ...newVideo(null), title: "First", sceneIds: ["a"] }, { ...newVideo(null), title: "Second", sceneIds: ["b"] }];
+ config.generationJobs = ["a", "b"].map((id) => createDraftGenerationJob(id, { id }));
+ mount(config);
+ fireEvent.click(screen.getByRole("button", { name: `${mode} view` }));
+ const second = screen.getByRole("button", { name: "Select Second" });
+ fireEvent.click(second);
+ expect(second).toHaveAttribute("aria-pressed", "true");
+ expect(screen.getByRole("textbox", { name: "Video title" })).toHaveValue("Second");
+ expect(screen.queryByLabelText("Scenes editor")).not.toBeInTheDocument();
+ const edit = within(screen.getByRole("complementary", { name: "Video settings" })).getByRole("button", { name: "Edit Scenes" });
+ expect(edit).toHaveClass("primary-button");
+ expect(edit.parentElement).toHaveClass("inspector-actions");
+ fireEvent.contextMenu(screen.getByRole("button", { name: "Select First" }));
+ expect(screen.getByRole("textbox", { name: "Video title" })).toHaveValue("First");
+ expect(screen.queryByRole("menuitem", { name: /Open scenes|Video settings/i })).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("menuitem", { name: "Edit Scenes" }));
+ expect(screen.getByLabelText("Scenes editor")).toHaveTextContent("a");
+});
diff --git a/src/components/workspace/VideoLibraryView.tsx b/src/components/workspace/VideoLibraryView.tsx
index f76f580..e70753d 100644
--- a/src/components/workspace/VideoLibraryView.tsx
+++ b/src/components/workspace/VideoLibraryView.tsx
@@ -6,7 +6,7 @@ import { mergeVideoScenes, newVideo, resolveVideoSource, songScenes, videoLibrar
import { newMusicFolder } from "../../lib/music";
import { askNative } from "../../lib/nativeShell";
import { CommandBarButton, ComboBox, ProgressRing, PropRow, PropSection, Splitter, useContextMenu, usePaneSize, type MenuEntry } from "../ui";
-import { Add16, Delete16, Film32, FolderAdd16, FolderOpen48, GridView16, ListView16, OpenExternal16, Play16 } from "../ui/icons";
+import { Add16, Delete16, Edit16, Film32, FolderAdd16, FolderOpen48, GridView16, ListView16, OpenExternal16, Play16 } from "../ui/icons";
import { GeneratorView } from "./GeneratorView";
import { VideoPlayback, videoPlaylist } from "./VideoPlayback";
import { VideoPoster } from "./VideoPoster";
@@ -121,9 +121,10 @@ export function VideoLibraryView(props: ComponentProps<typeof GeneratorView> & {
const busy = pending.length > 0;
const progress = running.reduce((sum, scene) => sum + scene.progress, 0) / Math.max(1, running.length) * 100;
return <div key={video.id} role="listitem" style={{ "--video-card-aspect": aspect } as CSSProperties} className={`music-song video-card${busy ? " video-card--busy" : ""}${selected?.id === video.id ? " music-song--selected" : ""}${playable ? "" : " music-song--draft"}`} draggable onDragStart={(event) => { event.dataTransfer.effectAllowed = "move"; event.dataTransfer.setData(VIDEO_DRAG, JSON.stringify({ projectId: config.id, videoId: video.id })); }}
- onClick={(event) => { if (!(event.target as Element).closest("button, .video-card__player")) openVideo(video); }}
- onContextMenu={(event) => { setSelectedId(video.id); menu.open(event, [{ label: "Open scenes", onSelect: () => openVideo(video) }, { label: "Video settings", onSelect: () => setSelectedId(video.id) }, ...newItems(), { separator: true }, { label: "Remove video", icon: <Delete16 />, disabled: busy, danger: true, onSelect: () => { void remove(video); } }]); }}>
- <button type="button" className="music-song__select" aria-label={`Open ${video.title}`} onFocus={() => setSelectedId(video.id)} onClick={() => openVideo(video)}>
+ onClick={(event) => { if (!(event.target as Element).closest("button, .video-card__player")) setSelectedId(video.id); }}
+ onDoubleClick={(event) => { if (!(event.target as Element).closest("button, .video-card__player")) openVideo(video); }}
+ onContextMenu={(event) => { setSelectedId(video.id); menu.open(event, [{ label: "Edit Scenes", onSelect: () => openVideo(video) }, ...newItems(), { separator: true }, { label: "Remove video", icon: <Delete16 />, disabled: busy, danger: true, onSelect: () => { void remove(video); } }]); }}>
+ <button type="button" className="music-song__select" aria-label={`Select ${video.title}`} aria-pressed={selected?.id === video.id} onFocus={() => setSelectedId(video.id)} onClick={() => setSelectedId(video.id)} onDoubleClick={() => openVideo(video)}>
<span className="music-song__art"><VideoPoster folderPath={folderPath} relativePath={first?.asset.relativePath} seconds={first?.start ?? 0} revision={props.generationCompletionTimes?.[first?.sceneId ?? ""] ?? first?.asset.createdAt} title={video.title} /></span><span className="music-song__info"><strong>{video.title}</strong><span>{scenes.length} scenes · {scenes.reduce((seconds, scene) => seconds + sceneDurationSeconds(scene), 0).toFixed(1)} s</span><span>{busy ? "Generating" : playable ? `${playable} / ${scenes.length} scenes ready` : "Draft"}</span></span>
</button>
{busy && <ProgressRing className="video-card__progress" size={20} value={progress > 0 ? progress : undefined} aria-label={`${video.title} generation progress`} />}
@@ -154,7 +155,9 @@ export function VideoLibraryView(props: ComponentProps<typeof GeneratorView> & {
<PropSection title="Scenes">
<p className="video-reference-help">{videoScenes(selected, config).map((scene, index, all) => { const start = all.slice(0, index).reduce((sum, item) => sum + sceneDurationSeconds(item), 0); return <span className="video-reference-range" key={scene.id}>{scene.title}: {start.toFixed(1)}–{(start + sceneDurationSeconds(scene)).toFixed(1)} s</span>; })}</p>
</PropSection>
- </> : <p className="music-inspector__empty">Select a video to edit its settings.</p>}</div></aside>
+ </> : <p className="music-inspector__empty">Select a video to edit its settings.</p>}</div>
+ {selected && <div className="inspector-actions"><button type="button" className="primary-button" onClick={() => openVideo(selected)}><Edit16 aria-hidden="true" />Edit Scenes</button></div>}
+ </aside>
</div>
{menu.element}
</div>;