shots record: gameplay clips from a web build (Chromium screencast), iOS Simulator, Android emulator or a folder

This commit is contained in:
CRTkafa 2026-10-10 14:22:52 +00:00
parent 630e933427
commit 37a32033c1
4 changed files with 319 additions and 4 deletions

View file

@ -2,7 +2,7 @@
// do (see credentials.ts). The file default-exports a plain object; `import type { ShipConfig }` is optional.
import { existsSync } from 'node:fs';
import { dirname, isAbsolute, join, resolve } from 'node:path';
import { validateCapture } from '../shots/devices';
import { validateCapture, validateRecord } from '../shots/devices';
export type ProductType = 'consumable' | 'non_consumable';
@ -191,6 +191,37 @@ export interface VideoConfig {
/** cover (crop to fill, default) or contain (letterbox on `background`). */
fit?: 'cover' | 'contain';
background?: string;
/** Gameplay clips recorded by `storebound shots record` into <clips>/<lang>/NN-<name>.mp4. */
record?: VideoRecord;
}
/** How `shots record` films clips. Uses shots.capture for the web URL / simulator / emulator settings. */
export interface VideoRecord {
/** Default: shots.capture.source (web when unset). folder = only list / check the clips you put there yourself. */
source?: 'web' | 'ios-sim' | 'android-emu' | 'folder';
/** Which frame size / simulator / emulator: phone (default) or tablet. */
device?: 'phone' | 'tablet';
/** Clip name -> what to film, in order. */
clips: Record<string, ClipSpec>;
}
export interface ClipSpec {
/** Length in seconds (1-60). */
seconds: number;
/** web: URL path after shots.capture.baseUrl ("{lang}" replaced), e.g. "/?level=3&autoplay=1". */
path?: string;
/** web: JS expression polled until true before filming starts. */
waitFor?: string;
/** web: JS run before filming starts. */
eval?: string[];
/** ios-sim / android-emu: deep link opened after launch. */
url?: string;
/** ios-sim: extra launch arguments ("{lang}", "{shot}" = the clip name). */
args?: string[];
/** android-emu: intent extras for `am start`. */
extras?: Record<string, string | number | boolean>;
/** Wait after launch before filming (ms). Default 1000 (web) / 2500 (simulator, emulator). */
delayMs?: number;
}
export interface IconsConfig {
@ -350,6 +381,7 @@ export function validateConfig(c: unknown): string[] {
for (const t of v.targets ?? []) if (!['iphone', 'ipad', 'youtube', 'youtube-landscape'].includes(t)) e.push(`shots.video.targets: unknown "${t}" (iphone, ipad, youtube, youtube-landscape)`);
if (v.fit && !['cover', 'contain'].includes(v.fit)) e.push('shots.video.fit: cover | contain');
for (const id of v.captionScenes ?? []) if (!sceneIds.has(id)) e.push(`shots.video.captionScenes: unknown scene "${id}"`);
if (v.record) e.push(...validateRecord(v.record, s.capture));
}
}
if (cfg.icons) {