@hyperframes/producer 0.9.81 → 0.9.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -324,7 +324,7 @@ function firstCompositionIdTag(html) {
324
324
  // src/services/renderOrchestrator.ts
325
325
  import { matchHtmlBodyCssHeightFirst, matchHtmlBodyCssWidthFirst } from "@hyperframes/parsers";
326
326
  import {
327
- extractMediaMetadata as extractMediaMetadata5,
327
+ extractMediaMetadata as extractMediaMetadata6,
328
328
  resolveConfig as resolveConfig2,
329
329
  closeCaptureSession as closeCaptureSession8,
330
330
  createCaptureSession as createCaptureSession8,
@@ -347,7 +347,7 @@ import {
347
347
  scaleProtocolTimeoutForComposition,
348
348
  classifyCaptureFailure as classifyCaptureFailure3,
349
349
  cloneCaptureWarning,
350
- isMemoryExhaustionError,
350
+ isMemoryExhaustionError as isMemoryExhaustionError2,
351
351
  isTransientBrowserError as isTransientBrowserError2,
352
352
  isDrawElementVerificationError,
353
353
  isDrawElementCaptureError,
@@ -2098,9 +2098,9 @@ var OWNER_FILE = "owner.json";
2098
2098
  var TRANSACTION_BACKUP = "backup";
2099
2099
  var RENDER_JOB_DIR = /^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/;
2100
2100
  function pidScope() {
2101
- const attempt = (read) => {
2101
+ const attempt = (read2) => {
2102
2102
  try {
2103
- return read();
2103
+ return read2();
2104
2104
  } catch {
2105
2105
  return void 0;
2106
2106
  }
@@ -7124,13 +7124,21 @@ import { parseHTML as parseHTML5 } from "linkedom";
7124
7124
  // src/services/bundledScripts.ts
7125
7125
  import { existsSync as existsSync8, readFileSync as readFileSync5 } from "node:fs";
7126
7126
  import { join as join17 } from "node:path";
7127
- import { gsapCdnDist } from "@hyperframes/core/gsap-cdn";
7127
+ import { GSAP_CDN_VERSION } from "@hyperframes/core/gsap-cdn";
7128
7128
  var GSAP_VENDOR_DIR_ENV = "HYPERFRAMES_GSAP_VENDOR_DIR";
7129
+ var DEFAULT_CDN_GSAP_3 = /^https:\/\/cdn\.jsdelivr\.net\/npm\/gsap@(3\.\d+\.\d+)\/dist\/([A-Za-z]+\.min\.js)$/;
7130
+ var read = (file) => existsSync8(file) ? readFileSync5(file) : null;
7129
7131
  function bundledScript(url) {
7130
7132
  const dir = process.env[GSAP_VENDOR_DIR_ENV];
7131
- if (!dir || url !== `${gsapCdnDist()}gsap.min.js`) return null;
7132
- const file = join17(dir, "gsap.min.js");
7133
- return existsSync8(file) ? readFileSync5(file) : null;
7133
+ const [, version, file] = DEFAULT_CDN_GSAP_3.exec(url) ?? [];
7134
+ if (!dir || !version || !file) return null;
7135
+ const at = version === GSAP_CDN_VERSION ? dir : join17(dir, "..", "..", `gsap@${version}`, "dist");
7136
+ return read(join17(at, file));
7137
+ }
7138
+ function bundledGsapStandIn(url) {
7139
+ const dir = process.env[GSAP_VENDOR_DIR_ENV];
7140
+ const [, , file] = DEFAULT_CDN_GSAP_3.exec(url) ?? [];
7141
+ return dir && file ? read(join17(dir, file)) : null;
7134
7142
  }
7135
7143
 
7136
7144
  // src/services/htmlCompiler.ts
@@ -7156,7 +7164,7 @@ import { MAX_AUDIO_GAIN } from "@hyperframes/core/audio-gain";
7156
7164
  import { CAPTURE_CANVAS_SELECTOR } from "@hyperframes/core/html-in-canvas";
7157
7165
  import { readPlaybackRate } from "@hyperframes/parsers/media-duration";
7158
7166
  import { resolveRateSpec } from "@hyperframes/core/speed-ramp";
7159
- import { gsapCdnDist as gsapCdnDist2, normalizeGsapBaseUrl } from "@hyperframes/core/gsap-cdn";
7167
+ import { gsapCdnDist, normalizeGsapBaseUrl } from "@hyperframes/core/gsap-cdn";
7160
7168
  import {
7161
7169
  assignBundledRuntimeCompositionIds,
7162
7170
  assignMediaRenderIds,
@@ -8302,13 +8310,13 @@ function compositionPathProblem(projectDir, filePath, assetRoot, outsideFiles) {
8302
8310
  }
8303
8311
  function readSubCompositionFile(filePath, srcPath) {
8304
8312
  assertCompositionFileSize(filePath, srcPath);
8305
- const read = readProjectFile(filePath);
8306
- if (read.kind === "missing") return { detail: "the file does not exist" };
8307
- if (read.kind === "folder") return { detail: "it is a folder, not an HTML file" };
8308
- const validity = checkSubCompositionUsability(read.text, parseSubCompHtmlForValidity);
8313
+ const read2 = readProjectFile(filePath);
8314
+ if (read2.kind === "missing") return { detail: "the file does not exist" };
8315
+ if (read2.kind === "folder") return { detail: "it is a folder, not an HTML file" };
8316
+ const validity = checkSubCompositionUsability(read2.text, parseSubCompHtmlForValidity);
8309
8317
  if (!validity.ok)
8310
8318
  return { detail: validity.detail ?? "the file is empty or could not be parsed" };
8311
- return { bytes: Buffer.byteLength(read.text), ...compositionSrcsIn(read.text) };
8319
+ return { bytes: Buffer.byteLength(read2.text), ...compositionSrcsIn(read2.text) };
8312
8320
  }
8313
8321
  function assertSubCompositionsUsable(html, projectDir, assetRoot, outsideFiles) {
8314
8322
  const budget = new CompositionExpansionBudget();
@@ -8683,11 +8691,11 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
8683
8691
  compiledSrcs.add(srcPath);
8684
8692
  assertOutsideMarkupAsked(projectDir, filePath, srcPath, assetRoot, outsideFiles);
8685
8693
  assertCompositionFileSize(filePath, srcPath);
8686
- const read = readProjectFile(filePath);
8687
- if (read.kind !== "file") {
8694
+ const read2 = readProjectFile(filePath);
8695
+ if (read2.kind !== "file") {
8688
8696
  continue;
8689
8697
  }
8690
- const rawSubHtml = normalizeCompositionSrcs(read.text, projectDir);
8698
+ const rawSubHtml = normalizeCompositionSrcs(read2.text, projectDir);
8691
8699
  const nestedVisited = new Set(visited);
8692
8700
  nestedVisited.add(filePath);
8693
8701
  workItems.push({ srcPath, filePath, rawSubHtml, nestedVisited });
@@ -8889,9 +8897,9 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
8889
8897
  assertOutsideMarkupAsked(projectDir, filePath, srcPath, assetRoot, outsideFiles);
8890
8898
  assertCompositionFileSize(filePath, srcPath);
8891
8899
  }
8892
- const read = filePath && !isPrivateCompositionFile(projectDir, filePath) ? readProjectFile(filePath) : null;
8893
- return read?.kind === "file" ? rewriteUnresolvableGsapToCdn(
8894
- normalizeCompositionSrcs(read.text, projectDir),
8900
+ const read2 = filePath && !isPrivateCompositionFile(projectDir, filePath) ? readProjectFile(filePath) : null;
8901
+ return read2?.kind === "file" ? rewriteUnresolvableGsapToCdn(
8902
+ normalizeCompositionSrcs(read2.text, projectDir),
8895
8903
  projectDir,
8896
8904
  srcPath
8897
8905
  ) : null;
@@ -9118,6 +9126,9 @@ async function inlineExternalScripts(html, budget = new CompositionExpansionBudg
9118
9126
  });
9119
9127
  const remote = new Set(externalScripts.filter((_, i) => !local[i]).map(({ src }) => src));
9120
9128
  assertRemoteFetchCount("scripts", remote.size);
9129
+ const pinned = new Set(
9130
+ externalScripts.filter(({ el }) => el.getAttribute("integrity")).map(({ src }) => src)
9131
+ );
9121
9132
  const mirror = operatorGsapMirror();
9122
9133
  const limit = createConcurrencyLimit(MAX_CONCURRENT_SCRIPT_FETCHES);
9123
9134
  const stop = new AbortController();
@@ -9140,7 +9151,16 @@ async function inlineExternalScripts(html, budget = new CompositionExpansionBudg
9140
9151
  if (!bytes) {
9141
9152
  bytes = limit(async () => {
9142
9153
  fetchSignal.throwIfAborted();
9143
- const downloaded = await downloadScript(src, mirror, fetchSignal);
9154
+ const downloaded = await downloadScript(src, mirror, fetchSignal).catch(
9155
+ (error) => {
9156
+ const standIn = pinned.has(src) || fetchSignal.aborted ? null : bundledGsapStandIn(src);
9157
+ if (!standIn) throw error;
9158
+ defaultLogger.warn(
9159
+ `[Compiler] Could not download ${src} (${error}); using the host's own GSAP instead.`
9160
+ );
9161
+ return standIn;
9162
+ }
9163
+ );
9144
9164
  charge(downloaded.byteLength);
9145
9165
  return downloaded;
9146
9166
  }, fetchSignal);
@@ -9627,7 +9647,7 @@ async function embedLocalFontFaces(html, projectDir, assetRoot, budget, log = de
9627
9647
  }
9628
9648
  function renderGsapDist() {
9629
9649
  try {
9630
- return gsapCdnDist2(void 0, normalizeGsapBaseUrl(process.env.HYPERFRAMES_GSAP_BASE_URL));
9650
+ return gsapCdnDist(void 0, normalizeGsapBaseUrl(process.env.HYPERFRAMES_GSAP_BASE_URL));
9631
9651
  } catch (cause) {
9632
9652
  throw new Error(
9633
9653
  "Invalid HYPERFRAMES_GSAP_BASE_URL: use an absolute HTTPS npm mirror root (plain HTTP only for localhost) without credentials, query, or fragment",
@@ -10515,11 +10535,14 @@ import {
10515
10535
  compositionRequiresWebGpu,
10516
10536
  createCaptureSession as createCaptureSession4,
10517
10537
  deriveBeginFrameProbeTimeTicks,
10538
+ extractMediaMetadata as extractMediaMetadata4,
10518
10539
  getCompositionDuration,
10519
10540
  getCompositionLengthSource,
10520
10541
  initializeSession as initializeSession4,
10542
+ isMemoryExhaustionError,
10521
10543
  isTransientBrowserError,
10522
10544
  probeBeginFrameLiveness,
10545
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
10523
10546
  videoAudioId
10524
10547
  } from "@hyperframes/engine";
10525
10548
  import {
@@ -10624,6 +10647,33 @@ function hasVariableBoundMedia(html, variables, variablesByComp = {}) {
10624
10647
  );
10625
10648
  });
10626
10649
  }
10650
+ async function probeVideoHold(videos, html, projectDir, compiledDir) {
10651
+ const { document: document2 } = parseHTML6(html);
10652
+ const bound = /* @__PURE__ */ new Set();
10653
+ for (const video of document2.querySelectorAll("video")) {
10654
+ if (!video.matches("[data-var-src]") && !video.querySelector("source[data-var-src]")) continue;
10655
+ const id = video.getAttribute(MEDIA_RENDER_ID_ATTR2) || video.getAttribute("id");
10656
+ if (id) bound.add(id);
10657
+ }
10658
+ const hints = await Promise.all(
10659
+ videos.map(async ({ id, src }) => {
10660
+ if (bound.has(id) || /^https?:\/\//i.test(src)) return null;
10661
+ try {
10662
+ const path = resolveProjectRelativeSrc4(src, projectDir, compiledDir);
10663
+ const { width, height } = await extractMediaMetadata4(path);
10664
+ return width > 0 && height > 0 ? { id, width, height } : null;
10665
+ } catch {
10666
+ return null;
10667
+ }
10668
+ })
10669
+ );
10670
+ const held = hints.filter((hint) => hint !== null);
10671
+ return { skipReadinessVideoIds: held.map((hint) => hint.id), videoMetadataHints: held };
10672
+ }
10673
+ function probeHoldFitsCapture(probeHeld, captureHeld) {
10674
+ const held = new Set(captureHeld);
10675
+ return (probeHeld ?? []).every((id) => held.has(id));
10676
+ }
10627
10677
  function authoredMediaStarts(html) {
10628
10678
  const { document: document2 } = parseHTML6(html);
10629
10679
  const starts = /* @__PURE__ */ new Map();
@@ -10760,6 +10810,16 @@ function reportedLengthSource(source) {
10760
10810
  const srcHash = createHash7("sha256").update(name).digest("hex").slice(0, 12);
10761
10811
  return { from: "media", tag: source.tag, trimmed: source.trimmed, srcHash };
10762
10812
  }
10813
+ var STOPPED = "Preparing the render stopped while ";
10814
+ async function probeStep(step, call) {
10815
+ try {
10816
+ return await call();
10817
+ } catch (error) {
10818
+ if (error instanceof Error && !error.message.startsWith(STOPPED) && !isMemoryExhaustionError(error))
10819
+ error.message = `${STOPPED}${step}: ${error.message}`;
10820
+ throw error;
10821
+ }
10822
+ }
10763
10823
  async function runProbeStage(input) {
10764
10824
  const {
10765
10825
  projectDir,
@@ -10832,6 +10892,12 @@ async function runProbeStage(input) {
10832
10892
  assertNotAborted();
10833
10893
  const motionBlur = job.config.motionBlur;
10834
10894
  const captureOpts = {
10895
+ ...await probeVideoHold(
10896
+ composition.videos,
10897
+ compiled.html,
10898
+ projectDir,
10899
+ join23(workDir, "compiled")
10900
+ ),
10835
10901
  recordReferenceBackground: input.recordReferenceBackground,
10836
10902
  width,
10837
10903
  height,
@@ -10870,7 +10936,8 @@ async function runProbeStage(input) {
10870
10936
  log.info(`Still waiting for browser initialization... (${elapsed}s elapsed)`);
10871
10937
  }, 3e4);
10872
10938
  try {
10873
- await initializeSession4(probeSession);
10939
+ const opening = probeSession;
10940
+ await probeStep("opening the film in the browser", () => initializeSession4(opening));
10874
10941
  } finally {
10875
10942
  clearInterval(heartbeat);
10876
10943
  }
@@ -10949,7 +11016,8 @@ async function runProbeStage(input) {
10949
11016
  null,
10950
11017
  { ...probeCfg, forceScreenshot: true }
10951
11018
  );
10952
- await initializeSession4(probeSession);
11019
+ const reopening = probeSession;
11020
+ await probeStep("opening the film in the browser", () => initializeSession4(reopening));
10953
11021
  assertNotAborted();
10954
11022
  lastBrowserConsole = probeSession.browserConsoleBuffer;
10955
11023
  }
@@ -10957,8 +11025,13 @@ async function runProbeStage(input) {
10957
11025
  const session = probeSession;
10958
11026
  if (composition.duration <= 0) {
10959
11027
  log.info("Discovering composition duration...");
10960
- const discoveredDuration = await getCompositionDuration(session);
10961
- lengthSource = reportedLengthSource(await getCompositionLengthSource(session));
11028
+ const discoveredDuration = await probeStep(
11029
+ "reading the film's length",
11030
+ () => getCompositionDuration(session)
11031
+ );
11032
+ lengthSource = reportedLengthSource(
11033
+ await probeStep("reading the film's length", () => getCompositionLengthSource(session))
11034
+ );
10962
11035
  assertNotAborted();
10963
11036
  log.info("Probed composition duration from browser", {
10964
11037
  discoveredDuration,
@@ -10972,9 +11045,9 @@ async function runProbeStage(input) {
10972
11045
  });
10973
11046
  }
10974
11047
  if (compiled.unresolvedCompositions.length > 0) {
10975
- const resolutions = await resolveCompositionDurations(
10976
- session.page,
10977
- compiled.unresolvedCompositions
11048
+ const resolutions = await probeStep(
11049
+ "reading each scene's length",
11050
+ () => resolveCompositionDurations(session.page, compiled.unresolvedCompositions)
10978
11051
  );
10979
11052
  assertNotAborted();
10980
11053
  if (resolutions.length > 0) {
@@ -10994,7 +11067,10 @@ async function runProbeStage(input) {
10994
11067
  }
10995
11068
  }
10996
11069
  log.info("Discovering media assets from browser DOM...");
10997
- const browserMedia = await discoverMediaFromBrowser(session.page);
11070
+ const browserMedia = await probeStep(
11071
+ "listing the film's videos, audio and images",
11072
+ () => discoverMediaFromBrowser(session.page)
11073
+ );
10998
11074
  assertNotAborted();
10999
11075
  if (browserMedia.length > 0) {
11000
11076
  const existingVideoIds = new Set(composition.videos.map((v) => v.id));
@@ -11132,11 +11208,14 @@ async function runProbeStage(input) {
11132
11208
  log.info("Discovering audio volume automation...", {
11133
11209
  audioCount: composition.audios.length
11134
11210
  });
11135
- const automation = await discoverAudioVolumeAutomationFromTimeline(
11136
- session.page,
11137
- composition.audios.map((audio) => audio.id),
11138
- composition.duration,
11139
- fpsToNumber6(job.config.fps)
11211
+ const automation = await probeStep(
11212
+ "reading the audio's volume changes",
11213
+ () => discoverAudioVolumeAutomationFromTimeline(
11214
+ session.page,
11215
+ composition.audios.map((audio) => audio.id),
11216
+ composition.duration,
11217
+ fpsToNumber6(job.config.fps)
11218
+ )
11140
11219
  );
11141
11220
  assertNotAborted();
11142
11221
  if (automation.length > 0) {
@@ -11155,9 +11234,9 @@ async function runProbeStage(input) {
11155
11234
  log.info("Discovering video visibility windows...", {
11156
11235
  videoCount: composition.videos.length
11157
11236
  });
11158
- const visibilityWindows = await discoverVideoVisibilityFromTimeline(
11159
- session.page,
11160
- composition.duration
11237
+ const visibilityWindows = await probeStep(
11238
+ "finding when each video is on screen",
11239
+ () => discoverVideoVisibilityFromTimeline(session.page, composition.duration)
11161
11240
  );
11162
11241
  assertNotAborted();
11163
11242
  for (const win of visibilityWindows) {
@@ -11356,7 +11435,7 @@ import {
11356
11435
  createFrameLookupTable as createFrameLookupTable3,
11357
11436
  detectTransfer,
11358
11437
  extractAllVideoFrames,
11359
- extractMediaMetadata as extractMediaMetadata4,
11438
+ extractMediaMetadata as extractMediaMetadata5,
11360
11439
  gradingKeepsSdr as gradingKeepsSdr2,
11361
11440
  isVideoPastTimelineEnd,
11362
11441
  isHdrColorSpace as isHdrColorSpace2,
@@ -11370,7 +11449,7 @@ import {
11370
11449
  resolveRestrictPageNetwork,
11371
11450
  isUrlNotPermittedError,
11372
11451
  writeUrlDownloadTelemetry as writeUrlDownloadTelemetry2,
11373
- resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
11452
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc5,
11374
11453
  runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
11375
11454
  safeVideoExtractionSourceIdentity,
11376
11455
  videoAudioId as videoAudioId2
@@ -11586,7 +11665,7 @@ function applyVideoExtractionFailurePolicy(result, policy, log) {
11586
11665
  }
11587
11666
  async function probeColorSpaceSafely(path, log) {
11588
11667
  try {
11589
- const meta = await extractMediaMetadata4(path);
11668
+ const meta = await extractMediaMetadata5(path);
11590
11669
  return meta.colorSpace;
11591
11670
  } catch (error) {
11592
11671
  log?.warn("HDR color-space probe failed; treating source as SDR", {
@@ -11632,14 +11711,14 @@ async function runExtractVideosStage(input) {
11632
11711
  log?.info("Probing video color spaces...", { videoCount: composition.videos.length });
11633
11712
  const probeFailures = await Promise.all(
11634
11713
  composition.videos.map(async (v) => {
11635
- const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
11714
+ const videoPath = resolveProjectRelativeSrc5(v.src, projectDir, compiledDir);
11636
11715
  if (!opensLocally(videoPath, assetRoots)) return null;
11637
11716
  try {
11638
11717
  const attempted = extractionPolicy.maxTransientRetries === 0 ? {
11639
- result: await extractMediaMetadata4(videoPath, { signal: abortSignal }),
11718
+ result: await extractMediaMetadata5(videoPath, { signal: abortSignal }),
11640
11719
  retries: 0
11641
11720
  } : await runVideoExtractionWithRetry2(
11642
- () => extractMediaMetadata4(videoPath, { signal: abortSignal }),
11721
+ () => extractMediaMetadata5(videoPath, { signal: abortSignal }),
11643
11722
  {
11644
11723
  signal: abortSignal,
11645
11724
  maxTransientRetries: extractionPolicy.maxTransientRetries,
@@ -11676,7 +11755,7 @@ async function runExtractVideosStage(input) {
11676
11755
  if (probesHdr && composition.images.length > 0) {
11677
11756
  const probed = await Promise.all(
11678
11757
  composition.images.map(async (img) => {
11679
- const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
11758
+ const imgPath = resolveProjectRelativeSrc5(img.src, projectDir, compiledDir);
11680
11759
  if (!opensLocally(imgPath, assetRoots)) return null;
11681
11760
  const colorSpace = await probeColorSpaceSafely(imgPath, log);
11682
11761
  if (isHdrColorSpace2(colorSpace)) {
@@ -11811,7 +11890,7 @@ function opensLocally(path, assetRoots) {
11811
11890
  return existsSync13(path) && (!assetRoots || assetRootsRefusal(path, assetRoots) === null);
11812
11891
  }
11813
11892
  function localProbeSource(src, input) {
11814
- const path = resolveProjectRelativeSrc4(src, input.projectDir, input.compiledDir);
11893
+ const path = resolveProjectRelativeSrc5(src, input.projectDir, input.compiledDir);
11815
11894
  const readFrom = input.urlByAbsentLocalPath?.get(path) ?? path;
11816
11895
  const roots = input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(input.projectDir, input.compiledDir);
11817
11896
  return isHttpUrl3(readFrom) || opensLocally(readFrom, roots) ? readFrom : null;
@@ -11842,7 +11921,7 @@ async function appendVideoAudioFromProbe(input) {
11842
11921
  videos.map(async (video) => {
11843
11922
  const readFrom = isHttpUrl3(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
11844
11923
  if (readFrom === null) return null;
11845
- const metadata = await extractMediaMetadata4(readFrom, { signal: input.signal });
11924
+ const metadata = await extractMediaMetadata5(readFrom, { signal: input.signal });
11846
11925
  const window2 = await resolveFinalFrameExtractionWindow2(
11847
11926
  readFrom,
11848
11927
  video,
@@ -11866,7 +11945,7 @@ import {
11866
11945
  buildVideoLayerInput,
11867
11946
  isHttpUrl as isHttpUrl4,
11868
11947
  qualifyVideoLayer,
11869
- resolveProjectRelativeSrc as resolveProjectRelativeSrc5
11948
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc6
11870
11949
  } from "@hyperframes/engine";
11871
11950
  var SAMPLES = 9;
11872
11951
  function inspectVideoLayout(id, w, h, time) {
@@ -11928,7 +12007,7 @@ async function planVideoLayerPassthrough(input) {
11928
12007
  if (!q.qualifies) return { reason: q.reason };
11929
12008
  const { video } = q;
11930
12009
  if (isHttpUrl4(video.src)) return { reason: "remote_source" };
11931
- const path = resolveProjectRelativeSrc5(video.src, input.projectDir, input.compiledDir);
12010
+ const path = resolveProjectRelativeSrc6(video.src, input.projectDir, input.compiledDir);
11932
12011
  if (!existsSync14(path)) return { reason: "source_missing" };
11933
12012
  const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
11934
12013
  if ("reason" in layout) return layout;
@@ -14891,7 +14970,7 @@ function isRecoverableParallelCaptureError(error) {
14891
14970
  return kind === "transient_browser" || kind === "protocol_timeout";
14892
14971
  }
14893
14972
  function describeMemoryExhaustion(error, ctx) {
14894
- if (!isMemoryExhaustionError(error)) return null;
14973
+ if (!isMemoryExhaustionError2(error)) return null;
14895
14974
  const raw = normalizeErrorMessage(error);
14896
14975
  const dims = ctx.width && ctx.height ? ` (${ctx.width}\xD7${ctx.height}${ctx.totalFrames ? `, ${ctx.totalFrames} frames` : ""})` : "";
14897
14976
  return `Render ran out of memory${dims}: ${raw}
@@ -16037,6 +16116,11 @@ async function executeRenderPipeline(input) {
16037
16116
  failureToEnforce
16038
16117
  } = extractResult;
16039
16118
  perfStages.videoExtractMs = extractResult.videoExtractMs;
16119
+ if (probeSession && !probeHoldFitsCapture(probeSession.options.skipReadinessVideoIds, videoReadinessSkipIds)) {
16120
+ const held = probeSession;
16121
+ probeSession = null;
16122
+ await closeCaptureSession8(held);
16123
+ }
16040
16124
  const coverageReports = extractionResult ? computeVideoFrameCoverage(composition.videos, extractionResult.extracted, job.config.fps) : [];
16041
16125
  const coverageThreshold = resolveVideoCoverageThreshold();
16042
16126
  const authoredTimedClipCount = countAuthoredTimedClips(compiled.html);
@@ -17058,7 +17142,7 @@ async function executeRenderPipeline(input) {
17058
17142
  totalFrames,
17059
17143
  segmentFrames,
17060
17144
  key: manifestKey,
17061
- probeFrames: (path) => probeSegmentFrameCount(path, extractMediaMetadata5)
17145
+ probeFrames: (path) => probeSegmentFrameCount(path, extractMediaMetadata6)
17062
17146
  });
17063
17147
  segmentManifest.completed = existing.completed.filter(
17064
17148
  (entry) => completedSegments.has(entry.index)
@@ -17294,7 +17378,7 @@ async function executeRenderPipeline(input) {
17294
17378
  isBeginFrameCapture: !capturePlan.forceScreenshot && !cfg.useDrawElement && parallelCaptureMode === "beginframe"
17295
17379
  }))
17296
17380
  throw err;
17297
- const isMemoryExhaustion = !isVerifyError && isMemoryExhaustionError(err);
17381
+ const isMemoryExhaustion = !isVerifyError && isMemoryExhaustionError2(err);
17298
17382
  deSelfVerifyFallback = isVerifyError;
17299
17383
  if (isVerifyError) {
17300
17384
  const t = deVerifyFallbackTelemetry(err);
@@ -17821,14 +17905,14 @@ function child2(buf, parent, type) {
17821
17905
  return found;
17822
17906
  }
17823
17907
  var SCAN_BYTES = 64 * 1024;
17824
- async function readMp4Layout(read) {
17908
+ async function readMp4Layout(read2) {
17825
17909
  const found = /* @__PURE__ */ new Map();
17826
17910
  let payload;
17827
17911
  let buf = Buffer.alloc(0);
17828
17912
  let bufAt = 0;
17829
17913
  const load = async (start, end) => {
17830
17914
  if (start >= bufAt && end <= bufAt + buf.length) return;
17831
- buf = await read(start, Math.max(end, start + SCAN_BYTES));
17915
+ buf = await read2(start, Math.max(end, start + SCAN_BYTES));
17832
17916
  bufAt = start;
17833
17917
  };
17834
17918
  for (let at = 0; !(found.has("ftyp") && found.has("moov") && payload); ) {