import { BLUR_CAPTION_DEFAULT, BLUR_STRENGTH } from "umtool-report-to-video/clip-blur"; import { inGap } from "umtool-report-to-video/gaps"; import { cutAtSource, itemIndexAt, pieceWants, playPlan, sourceAt } from "@/lib/report/playCut.mjs"; import { EDGE_SLACK, audioSpans, decodesOf, scheduleFrom } from "@/lib/report/playSchedule.mjs"; import { drawFootageLayers, type FootageLayer } from "../footageCanvas"; import { regionsAt, type CensorRegion } from "../CensorOverlay"; import { AudioBank, type ClipSound } from "./audioBank"; import { CodecPicture, codecsAvailable } from "./codecPicture"; import { ElementPicture } from "./elementPicture"; // --------------------------------------------------------------------------- // THE PLAY VIEW'S ENGINE (umtool/docs/knobs.md, "Play the cut"): the cut // played like the finished video, edges first. // // THE CLOCK IS THE SOUND'S. Every clip's sound is decoded (audioBank.ts) and // scheduled back to back on ONE AudioContext (playSchedule.mjs): each starts // at its segment's first second and stops at its footage's last, to the // sample, at the render's edges (lib/report/cutPoints.mjs, via the plan); // a crossfade is the build's -- two linear ramps over the overlap -- and the // loudness gain, room's muted edges, the clip's own audio knobs and the mute // mark are gain automation. The cut second everything reads (the rail, the // tally, the stamps, the finale, a note's anchor) is that context's time // mapped through the plan. Cards, holds and clips with no media are silence // on the same clock. A clip whose sound is not decoded by the time it is due // holds the clock (`waiting`) at its first second; nothing is skipped. // // THE GATE (`gate`, Play's post items: PlayCut.tsx, postPreload.ts): an item // whose own player is not ready holds the clock the same way -- on the item // before's last frame while its bytes are still being fetched ahead, then at // its first second until its card is drawn and its voice can play -- so a // short item is never cut short by its loading. Every hold is counted // (`stats.waits`), and logged when it ends. // // THE PICTURE FOLLOWS THE CLOCK: by WebCodecs where the browser has it // (codecPicture.ts: the frame due at the clock, decoded ahead; a real // dissolve), else on two