Skip to content

feat: coordinate slate playout with interstitial ad breaks - #394

Merged
birme merged 1 commit into
masterfrom
issue-369/slate-adbreak-coordination
Sep 4, 2026
Merged

feat: coordinate slate playout with interstitial ad breaks#394
birme merged 1 commit into
masterfrom
issue-369/slate-adbreak-coordination

Conversation

@birme

@birme birme commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Changes

  • engine/session.js: add _buildAdBreakSlate(afterVod, unixTs, injectSlateLoaders). Uses HLSRepeatVod(slate.uri, slate.repetitions) so the slate run spans exactly repetitions * slate.duration / 1000s — the identical value _addInterstitialMetadata (feat: emit HLS interstitial (EXT-X-DATERANGE) tags for configured ad breaks #368) computes for PLANNED-DURATION. Attaches the interstitial DATERANGE to the slate VOD's first segment so START-DATE lands on the break boundary and the tag brackets exactly the slate run.
  • Strips the single leading EXT-X-DISCONTINUITY that HLSRepeatVod prepends, so the DATERANGE lands on the true first segment (no vodlib change / no feat: emit HLS interstitial (EXT-X-DATERANGE) tags for configured ad breaks #368 rework).
  • Gated on adBreak.enabled + a configured adBreak.slate.uri; returns null otherwise. The existing error/gap filler slate paths (_insertSlate/_loadSlate/_truncateSlate, slateUri/slateRepetitions/slateDuration) are untouched.

Integration note for reviewer

There is no ad-break scheduling/trigger mechanism anywhere in this series yet (the #367#371 breakdown does not define one; #368 emits the tag at content-VOD boundaries). Accordingly this PR delivers the slate-building + exact-alignment logic and its spec coverage, but the helper is not yet invoked from a live trigger. Please assess whether that satisfies #369's acceptance given the series state, or whether it should block.

Test plan

  • PROOF: npm run build → clean (no errors)
  • PROOF: npm test100 specs, 0 failures, 7 pending specs (baseline 94; +6 specs asserting slate spans the window, DATERANGE brackets exactly the slate (single tag, correct START-DATE/PLANNED-DURATION), alignment holds at a different size, disabled/no-slate → null, non-ad-break slate untouched)

Closes #369

🤖 Automated via Channel Engine Dev daily-backlog-pr skill

Build the ad-break filler slate from the configured adBreak.slate
(uri/repetitions/duration) via a new _buildAdBreakSlate helper and bracket
it with the #368 interstitial EXT-X-DATERANGE. The slate segment run spans
repetitions * duration/1000 seconds, matching the interstitial
PLANNED-DURATION exactly, and the DATERANGE START-DATE lands on the slate's
first segment (the break boundary) so the tag brackets exactly the slate.

The leading EXT-X-DISCONTINUITY that HLSRepeatVod prepends is stripped so the
DATERANGE attaches to the true first slate segment. Strictly gated on
adBreak.enabled and a configured adBreak.slate; when disabled or unconfigured
the helper is a no-op and the existing error/gap filler slate machinery is
untouched.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@birme birme left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr-reviewer verdict: APPROVE (with a documented limitation + follow-up recommendation)

  • PROOF: npm run build → clean; npm test100 specs, 0 failures, 7 pending specs.
  • Slate run duration equals #368's PLANNED-DURATION by construction; DATERANGE attached to the slate's first segment so it brackets exactly the slate (single tag, correct START-DATE) — proven by spec.
  • Strictly gated on adBreak.enabled + configured slate; existing error/gap filler slate paths untouched (spec-asserted). No commercial names/trademarks; operator-controlled URI (low risk); commit message conforms.

Judgment call (uncalled-in-production helper): investigated all production seams — _insertSlate is an error/gap-recovery path (wrong place), and content-VOD boundaries would force slate on every transition (wrong). AdBreakOpts carries no timing/cue field, so no legitimate trigger seam exists yet. This mirrors how #368 shipped emission with scheduling deferred. Approving as correct foundation code; recommend a follow-up issue to define the ad-break trigger and wire _buildAdBreakSlate into it.

Awareness note: alignment relies on stripping HLSRepeatVod's leading EXT-X-DISCONTINUITY via regex — coupled to vodlib output format, but guarded by the "brackets exactly the slate" spec.

@birme
birme merged commit db709f7 into master Sep 4, 2026
2 checks passed
@birme
birme deleted the issue-369/slate-adbreak-coordination branch September 4, 2026 13:53
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.

feat: coordinate slate playout with interstitial ad breaks

1 participant