Skip to content

Fork patch: Discover JS-src nested video onto host window - #8

Draft
valeriangalliat wants to merge 2 commits into
mainfrom
patch/discover-host-window
Draft

valeriangalliat wants to merge 2 commits into
mainfrom
patch/discover-host-window

Conversation

@valeriangalliat

Copy link
Copy Markdown
Collaborator

🤖 AI agent: Arcade fork patch. Do not merge.

This draft shows patch/discover-host-window against main, the upstream mirror, so the patch has one page for its diff, its revisions and its reason. Arcade's /hyperframes-update rebases the branch onto main and cherry-picks it onto arcade; this PR is not part of that flow. When a rebuild changes the patch, its git range-diff against the previous sync/<date>/discover-host-window tag is posted as a comment.

Why

A nested video with an empty src gets its real src from script after compile. Probe discovery then finds it and places it at scene-local t=0, so when its host scene does not start at 0 the video plays at the wrong time. This patch shifts discovered media by the host's offset and limit, the same way compile does. It also closes them at the end of the host's authored timing window (resolveAuthoredTimingWindow, the rule from upstream heygen-com#3975), so a runtime-src video in a shortened scene stops with the scene instead of running to the end of its file.

Upstream

Kept local. Upstream's answer to untimed media is the media_missing_data_start check error. Arcade's generated compositions silence that check.

Drop when

Not recorded yet. Likely the same as patch/discover-video-opacity: once Arcade's generator emits timed video (ARC-13573) and saved compositions no longer rely on runtime-src nested video.

Arcade

ARC-14843 · corpus scene ArcadeHQ/arcade#9987

@valeriangalliat
valeriangalliat force-pushed the patch/discover-host-window branch from 70a263a to 1f46037 Compare October 24, 2026 23:23
@valeriangalliat

valeriangalliat commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

🤖 AI agent: sync/2026-10-24 (tags moved the same day): rebased onto upstream 2e397dba5 (v0.8.194). Import conflict in probeStage.test.ts with upstream #5528: kept both imports.

First pass on this date, onto 722481214 (0.8.193): Three discovered-media branches now sit inside upstream heygen-com#5454 droppedMediaIds guard; upstream loop on discovered audio kept. Known gap: upstream heygen-com#5454 collector now handles inline hosts, host in-points and data-hf-media-start-basis; hostWindowMapper.ts does not.

The range-diff below is against sync/2026-10-05.

git range-diff sync/2026-10-05/base..sync/2026-10-05/discover-host-window sync/2026-10-24/base..sync/2026-10-24/discover-host-window
1:  21ad4c618 ! 1:  95ed1fc0b fix(producer): map discovered nested media onto the host window
    @@ packages/producer/src/services/render/stages/probeStage.test.ts: import { afterA
      import { mkdtempSync, rmSync } from "node:fs";
      import { tmpdir } from "node:os";
      import { join } from "node:path";
    -+import { MEDIA_RENDER_ID_ATTR } from "@hyperframes/core";
    - 
    - const workDir = mkdtempSync(join(tmpdir(), "hf-stage-test-"));
    - afterAll(() => rmSync(workDir, { recursive: true, force: true }));
    +-import type { RateSpec } from "@hyperframes/core";
    ++import { MEDIA_RENDER_ID_ATTR, type RateSpec } from "@hyperframes/core";
    + import { parseAudioElements, videoAudioId } from "../../../../../engine/src/services/audioMixer.js";
    + import {
    +   parseVideoElements,
     @@ packages/producer/src/services/render/stages/probeStage.test.ts: let mediaPreflightComposition: unknown;
      let afterMediaPreflight: (() => void) | null = null;
      let fileServerCloseCallCount = 0;
    @@ packages/producer/src/services/render/stages/probeStage.ts
     @@ packages/producer/src/services/render/stages/probeStage.ts: import type { RenderJob } from "../../renderOrchestrator.js";
      import { isActionableProbeFailure } from "./probeFailures.js";
      import { preflightCompositionAssetMediaTypes } from "../../assetMediaType.js";
    - import { resolveCaptureImageFormat } from "../captureImageFormat.js";
    + import { resolveCaptureImageFormat, resolveCaptureJpegQuality } from "../captureImageFormat.js";
     +import { createHostWindowMapper } from "../../hostWindowMapper.js";
      
      export interface ProbeStageInput {
        projectDir: string;
     @@ packages/producer/src/services/render/stages/probeStage.ts: export async function runProbeStage(input: ProbeStageInput): Promise<ProbeStageR
    -         const existingImageIds = new Set(composition.images.map((image) => image.id));
    +         const authoredStarts = authoredMediaStarts(compiled.html);
      
              pruneMutedBrowserMedia(composition, browserMedia, existingAudioIds);
     +        const mapHost = createHostWindowMapper(compiled.html);
    @@ packages/producer/src/services/render/stages/probeStage.ts: export async functio
              for (const el of browserMedia) {
                if (!el.src || el.src === "about:blank") continue;
     @@ packages/producer/src/services/render/stages/probeStage.ts: export async function runProbeStage(input: ProbeStageInput): Promise<ProbeStageR
    -                 }
    +                 if (audio) audio.loop = existing.loop;
                    }
    -             } else {
    +             } else if (!compiled.droppedMediaIds.has(el.id)) {
     -              // New video discovered from browser
     +              const placed = mapHost(
     +                el.id,
    @@ packages/producer/src/services/render/stages/probeStage.ts: export async functio
     +                start: placed.start,
     +                end: placed.end,
                      mediaStart: el.mediaStart,
    +                 playbackRate: el.playbackRate,
                      loop: el.loop,
    -                 hasAudio: el.hasAudio && !el.muted,
     @@ packages/producer/src/services/render/stages/probeStage.ts: export async function runProbeStage(input: ProbeStageInput): Promise<ProbeStageR
                      }
                    }
    -             } else {
    +             } else if (!compiled.droppedMediaIds.has(el.id)) {
     +              const placed = mapHost(
     +                el.id,
     +                el.start,
    @@ packages/producer/src/services/render/stages/probeStage.ts: export async functio
     +                start: placed.start,
     +                end: placed.end,
                      mediaStart: el.mediaStart,
    -                 layer: 0,
    -                 volume: el.volume,
    +                 loop: el.loop,
    +                 playbackRate: el.playbackRate,
     @@ packages/producer/src/services/render/stages/probeStage.ts: export async function runProbeStage(input: ProbeStageInput): Promise<ProbeStageR
                      }
                    }
    -             } else {
    +             } else if (!compiled.droppedMediaIds.has(el.id)) {
     +              const placed = mapHost(
     +                el.id,
     +                el.start,
2:  70a263aaa = 2:  859737fe0 fix(producer): close discovered nested media at the host's timing window

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Edit accuracy: accurate 271 (base branch 271), smooth 126 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

Unstable (3)

  • seqplainkeys-none-center-r0-root-z100: tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo false, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true
  • seqplainkeys-none-px-r0-root-z100: tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo false, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true
  • seqplainkeys-none-px-r0-nested-z100: tracking 0.07, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo false, teleport true / tracking 0.07, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.07, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true

Keep-local: empty-src videos get a runtime src after compile, so discover
was adding them at scene-local t=0. Shift by host offset/limit (same
shape compile uses). Do not upstream (silenced media_missing_data_start).
Same rule as the compile-time collector (upstream heygen-com#3975): the host's end
comes from the runtime's authored timing window, so a positive
data-duration wins over data-end and a non-positive duration is ignored.
A runtime-src video in a shortened scene stops with the scene instead of
running to its file end.
@valeriangalliat
valeriangalliat force-pushed the patch/discover-host-window branch from 1f46037 to 859737f Compare October 25, 2026 02:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant