AI media harness for planning, generating, and editing locally
TypeScript
Select playing shots
Bitti1d7b53023933
diff --git a/src/components/workspace/SceneBoard.tsx b/src/components/workspace/SceneBoard.tsxindex c4fcafa..7819174 100644--- a/src/components/workspace/SceneBoard.tsx+++ b/src/components/workspace/SceneBoard.tsx@@ -272,7 +272,7 @@ function ShotCard({ job, shot, index, endsAt, folderPath, estimatedCompletionAt,draggable={draggable}onDragStart={onDragStart}>- <ShotThumbnail folderPath={folderPath} job={job} seconds={shot.startSeconds} endSeconds={endsAt} shotNumber={index + 1} estimatedCompletionAt={estimatedCompletionAt} cancelling={cancelling} />+ <ShotThumbnail folderPath={folderPath} job={job} seconds={shot.startSeconds} endSeconds={endsAt} shotNumber={index + 1} estimatedCompletionAt={estimatedCompletionAt} cancelling={cancelling} onPlay={onOpen} /><buttontype="button"className="shot-card__open-control"diff --git a/src/components/workspace/ShotThumbnail.test.tsx b/src/components/workspace/ShotThumbnail.test.tsxindex 79ee4d4..bb029a7 100644--- a/src/components/workspace/ShotThumbnail.test.tsx+++ b/src/components/workspace/ShotThumbnail.test.tsx@@ -144,9 +144,11 @@ describe("a shot's picture", () => {it("plays from this shot's cut and stops at the next cut", async () => {const folder = "C:\\Shot playback";const job = rendered(folder);+ const onPlay = vi.fn();await withFakeFile({ seconds: 9 }, async (seen) => {- render(<ShotThumbnail folderPath={folder} job={job} seconds={4.5} endSeconds={6} shotNumber={2} />);+ render(<ShotThumbnail folderPath={folder} job={job} seconds={4.5} endSeconds={6} shotNumber={2} onPlay={onPlay} />);fireEvent.click(await screen.findByRole("button", { name: "Play shot 2 of First scene" }));+ expect(onPlay).toHaveBeenCalledTimes(1);const video = await waitFor(() => {const found = document.querySelector("video");diff --git a/src/components/workspace/ShotThumbnail.tsx b/src/components/workspace/ShotThumbnail.tsxindex 596d7ec..bbae5d0 100644--- a/src/components/workspace/ShotThumbnail.tsx+++ b/src/components/workspace/ShotThumbnail.tsx@@ -246,7 +246,7 @@ export function formatEstimatedTimeLeft(milliseconds: number): string {return `About ${minutes}m ${seconds}s left`;}-export function ShotThumbnail({ folderPath, job, seconds, endSeconds = sceneDurationSeconds(job), shotNumber, estimatedCompletionAt = null, cancelling = false }: {+export function ShotThumbnail({ folderPath, job, seconds, endSeconds = sceneDurationSeconds(job), shotNumber, estimatedCompletionAt = null, cancelling = false, onPlay }: {folderPath: string;/** The scene this shot belongs to: it owns the file and the status. */job: GenerationJob;@@ -259,6 +259,8 @@ export function ShotThumbnail({ folderPath, job, seconds, endSeconds = sceneDuraestimatedCompletionAt?: number | null;/** Cancel was requested but the engine has not reported its terminal state. */cancelling?: boolean;+ /** Opens this shot in the editor when playback begins. */+ onPlay?: () => void;}) {const relativePath = job.status === "completed" ? job.outputRelativePath : null;const at = seconds;@@ -350,6 +352,7 @@ export function ShotThumbnail({ folderPath, job, seconds, endSeconds = sceneDuravideo.pause();setPlaying(false);} else {+ onPlay?.();window.dispatchEvent(new CustomEvent<string>(PLAY_EVENT, { detail: playbackId }));if (video.currentTime < seconds || video.currentTime >= endSeconds) video.currentTime = seconds;await playToCut(video);@@ -358,6 +361,7 @@ export function ShotThumbnail({ folderPath, job, seconds, endSeconds = sceneDura}const request = ++requestRef.current;+ onPlay?.();window.dispatchEvent(new CustomEvent<string>(PLAY_EVENT, { detail: playbackId }));setLoadingPlayback(true);setPlayFailed(false);