{"title":"Test SSAI Ad Events by Joining Markers, Decisions and Beacons","excerpt":"An ad server can count a pod as complete while finance finds impressions short. Join the playlist's break markers, the stitcher's decision, the VAST beacons and the content resume point on AdServingId, deduplicate retried beacons, and check the IN marker's duration against the media stitched.","canonicalUrl":"https://automationtester.in/blog/automation-tutorials/test-ssai-ad-event-integrity","category":{"name":"Automation Tutorials","slug":"automation-tutorials"},"tags":["video-streaming","ssai","hls","vast","ad-tracking","playwright"],"author":{"name":"Shashank Rawlani","url":"https://shashank.rawlani.com","linkedin":"https://www.linkedin.com/in/shashankrawlani/"},"datePublished":"2026-11-26T13:30:00.000Z","dateModified":"2026-11-26T13:30:00.000Z","coverImage":{"url":"https://ik.imagekit.io/automationtester/automationtester-in/blog/covers/v3/test-ssai-ad-event-integrity.webp","alt":"A green timeline runs through a dashed break holding a green slot and a grey striped slot with an orange crossed circle. Dots beacon up to a log, one twice in orange; an orange dashed bracket overshoots a green one below."},"contentHtml":"<div class=\"callout callout-info\"><strong>Quick answer:</strong> No single ad event proves a break played. Join four records per break: the playlist markers (<code>EXT-X-DATERANGE</code> with <code>SCTE35-OUT</code> and <code>SCTE35-IN</code>), the stitcher's decision for each slot, the tracking beacons the collector received, and the point where content resumed. Join on the VAST <code>AdServingId</code>, distinct for each ad in a pod. Deduplicate beacons on AdServingId plus event, never on the URL, because a retry carries a new <code>[CACHEBUSTING]</code> and <code>[TIMESTAMP]</code>. Check the IN tag's <code>DURATION</code> against the media actually stitched: RFC 8216 requires the actual duration, not the planned one.</div>\n\n<p>The ad server's report for break <code>splice-6FFFFFF0</code> shows two <code>complete</code> events for a two-ad pod: the pod completed. Finance finds one billable impression. Both read the same beacon log, and both are arithmetically correct. One of the two completes is a retry of the first creative's beacon. The second creative's rendition never arrived at the stitcher, which played a slate in its place and reported VAST error 402. The playlist also claims the break lasted 12 seconds when 10 seconds of media were stitched, so the player puts the content in-point two seconds after the content actually resumed.</p>\n\n<p>That break comes from the lab below. A check that counts <code>complete</code> beacons passes it. A correlator that joins marker, decision, beacons and resume position fails it on two rows and names the owner of each.</p>\n\n<p>This is part 6 of the streaming quality series. <a href=\"/blog/automation-tutorials/streaming-quality-model-beyond-video-starts\">Part 1</a> listed ads as one contract, splice markers joined to the beacons the player sent; this part builds that join. Playlist syntax belongs to <a href=\"/blog/automation-tutorials/validate-hls-dash-manifests-before-playback\">part 2's manifest validator</a>; here only the ad-break tags matter.</p>\n\n<div class=\"callout callout-warning\"><strong>Pinned for this lab on 2026-11-18:</strong> Node.js 26.12.1, ffmpeg 9.0.1, Playwright 1.62.1 with its bundled Chromium 151.0.7922.34, and hls.js 1.7.4, installed with <code>npm install --save-exact</code>, on macOS against <code>http://localhost</code> only, with synthetic ffmpeg lavfi media. VAST 4.3 (December 2022) is the latest published VAST; the 4.4 text in the same repository says \"Publication Date TBD\". RFC 8216bis revision 22 (1 May 2026) is an Internet-Draft, not a standard, and its printed expiry of 2 November 2026 had passed. Splice semantics here come from RFC 8216's mapping of SCTE-35, not from the SCTE-35 standard itself.</div>\n\n<h2 id=\"sae-four-records\">One break, four records, four authors</h2>\n\n<p>Every stitched break leaves four records, each from a system that can be wrong on its own:</p>\n\n<table>\n<thead><tr><th>Record</th><th>Written by</th><th>What it claims</th></tr></thead>\n<tbody>\n<tr><td>Break markers in the media playlist</td><td>Packager or stitcher</td><td>Where the break starts, how long it was planned to be, and how long it actually was</td></tr>\n<tr><td>Decision record</td><td>Stitcher, from the ad server's VAST</td><td>Which ad filled each slot, by AdServingId, and why a slot was filled with something else</td></tr>\n<tr><td>Beacon log</td><td>Collector, from player or stitcher requests</td><td>Which events fired for which ad, when, and from which side</td></tr>\n<tr><td>Player log</td><td>The player</td><td>Which segment played when, including the first content after the break</td></tr>\n</tbody>\n</table>\n\n<p>The join key is the AdServingId. VAST 4.3 requires an ad server returning an InLine ad to generate a pseudo-unique ID, put it in <code>&lt;AdServingId&gt;</code> and include it on all outgoing tracking pixels, with a distinct value for each <code>&lt;Ad&gt;</code> in a pod. The <code>[ADSERVINGID]</code> macro that puts it on a tracking URL is marked Optional in the IAB's macro list, so check that your stitcher fills it before building anything else.</p>\n\n<h2 id=\"sae-marker-rules\">Rules the break markers must obey</h2>\n\n<p>RFC 8216 maps SCTE-35 splices onto <code>EXT-X-DATERANGE</code> tags. A splice out and its splice in share one <code>ID</code>, unique to the pair, with the hexadecimal sections in <code>SCTE35-OUT</code> and <code>SCTE35-IN</code>. The rules worth testing:</p>\n\n<ul>\n<li>The OUT tag may carry <code>PLANNED-DURATION</code>, the planned length of the splice.</li>\n<li>The IN tag's <code>DURATION</code> must be the actual program duration between the out-point and the in-point, and its <code>END-DATE</code> the actual in-point. The RFC writes \"actual (not planned)\" twice.</li>\n<li>A playlist with any <code>EXT-X-DATERANGE</code> must also contain an <code>EXT-X-PROGRAM-DATE-TIME</code> tag, which maps START-DATE onto media time.</li>\n<li>Tags sharing an ID must agree on every attribute they both carry, and every variant stream must contain the same set of date ranges.</li>\n<li>A canceled splice should not appear at all.</li>\n</ul>\n\n<p>The same-ID rule has a sharp edge in hls.js 1.7.4. Its <code>DateRange</code> class merges same-ID tags, and when a shared attribute differs it logs a warning and marks the range invalid (\"Date range &lt;attribute&gt; mismatch\"). A stitcher that rounds START-DATE differently on the IN tag invalidates its own break.</p>\n\n<p>Revision 22 of the RFC 8216bis draft keeps these rules and lets a later tag omit START-DATE when an earlier tag with the same ID supplied it. Its interstitials (<code>CLASS=\"com.apple.hls.interstitial\"</code>) carry <code>X-RESUME-OFFSET</code>, which states where primary playback resumes. A stitched stream has no such attribute: the IN marker is the only statement of where the break ends.</p>\n\n<h2 id=\"sae-beacon-proof\">What a tracking beacon can and cannot prove</h2>\n\n<p>VAST 4.3 defines <code>firstQuartile</code>, <code>midpoint</code> and <code>thirdQuartile</code> as the creative having played continuously for at least 25%, 50% and 75% of its duration at normal speed, and <code>complete</code> as 100%. All <code>&lt;Impression&gt;</code> URIs for an ad, wrappers included, should fire at the same time. A beacon proves that a request reached the collector. It does not prove which ad played, that it played once, or that nobody else sent the same event.</p>\n\n<ul>\n<li><strong>Retries look like new events.</strong> The macro list defines <code>[CACHEBUSTING]</code> as a random 8-digit integer and <code>[TIMESTAMP]</code> as the time the URI is accessed, both Required on tracking pixels. A player that refills macros on retry sends a different URL each time, so URL-level deduplication keeps every retry.</li>\n<li><strong>The server may count for the player.</strong> VAST 4.3 lets a stitcher send tracking on the player's behalf, reporting an impression as the ad is sent on the stitched stream or at session end, while quoting measurement guidelines that favour client-initiated counting. The <code>[SERVERSIDE]</code> macro records the sender: 0 for the client, 1 for a server acting on the client's instruction, 2 for a server acting on its own decision.</li>\n<li><strong>Failures have codes.</strong> 402 is a timeout of the MediaFile URI, 407 a mezzanine still being transcoded (the ad is skipped), 206 a shortened break. A slot filled by something other than its creative should produce an error beacon and no impression.</li>\n</ul>\n\n<h2 id=\"sae-lab\">A two-ad pod whose second creative never arrives</h2>\n\n<p>The lab stitches a two-ad pod, planned at 6 seconds per creative, into the middle of a 16-second programme. One local server is the VAST 4.3 ad server, an ad-media origin where creative 2 never answers, and a beacon collector. Install and build the media:</p>\n\n<pre class=\"language-bash\"><code class=\"language-bash\">npm init -y\nnpm i --save-exact hls.js@1.7.4 playwright@1.62.1\nbash build-media.sh</code></pre>\n\n<pre class=\"language-bash\"><code class=\"language-bash\">#!/usr/bin/env bash\n# Synthetic media only: programme, one creative, one slate. 2 s TS segments.\nset -euo pipefail\ncd \"$(dirname \"$0\")\"\nrm -rf media &amp;&amp; mkdir -p media/content media/ads/c1 media/slate\nenc() { # $1 video src, $2 audio src, $3 seconds, $4 out dir\n  ffmpeg -hide_banner -loglevel error -f lavfi -i \"$1\" -f lavfi -i \"$2\" -t \"$3\" \\\n    -c:v libx264 -profile:v main -preset veryfast -g 60 -keyint_min 60 -sc_threshold 0 -b:v 800k -pix_fmt yuv420p \\\n    -c:a aac -b:a 96k -ac 2 -ar 48000 \\\n    -f hls -hls_time 2 -hls_playlist_type vod -hls_segment_filename \"$4/seg%02d.ts\" \"$4/index.m3u8\"\n}\nenc \"testsrc2=size=640x360:rate=30\" \"sine=frequency=440:sample_rate=48000\" 16 media/content\nenc \"testsrc=size=640x360:rate=30\"  \"sine=frequency=880:sample_rate=48000\" 6  media/ads/c1\nenc \"smptebars=size=640x360:rate=30\" \"anullsrc=r=48000:cl=stereo\"          4  media/slate</code></pre>\n\n<p>The collector writes every request to a JSON-lines file the moment it arrives. For the first <code>complete</code> it then holds the response for 2.5 seconds, longer than the player's one-second beacon timeout, so the event is recorded but the player never learns that:</p>\n\n<pre class=\"language-javascript\"><code class=\"language-javascript\">if (path === \"/t\") {\n  const q = Object.fromEntries(url.searchParams);\n  await appendFile(\"beacons.jsonl\", JSON.stringify({ at: Date.now(), ...q }) + \"\\n\");\n  if (q.e === \"complete\" &amp;&amp; holdNextComplete) {\n    holdNextComplete = false;\n    setTimeout(() =&gt; res.writeHead(204, { \"access-control-allow-origin\": \"*\" }).end(), 2500);\n    return;\n  }\n  res.writeHead(204, { \"access-control-allow-origin\": \"*\" }).end();\n  return;\n}\nif (path.startsWith(\"/ad-media/c2/\")) return; // creative 2's origin never answers</code></pre>\n\n<h3 id=\"sae-stitcher\">The stitcher and its one bug</h3>\n\n<p>The stitcher requests the pod, fetches each creative's rendition with a 1.5-second deadline, and fills a failed slot with a 4-second slate after firing the ad's <code>&lt;Error&gt;</code> URL with code 402:</p>\n\n<pre class=\"language-javascript\"><code class=\"language-javascript\">for (const ad of ads) {\n  try {\n    const r = await fetch(ad.media, { signal: AbortSignal.timeout(1500) });\n    if (!r.ok) throw new Error(`HTTP ${r.status}`);\n    decision.slots.push({ seq: ad.seq, adId: ad.id, asid: ad.asid, filled: \"creative\", media: segs(`ads/c${ad.seq}`) });\n    tracking[ad.asid] = ad.tracking;\n  } catch (e) {\n    // VAST 402: timeout of MediaFile URI. Reported server-side, then slate.\n    await fetch(fill(ad.error, { asid: ad.asid, code: 402 }));\n    decision.slots.push({ seq: ad.seq, adId: ad.id, asid: ad.asid, filled: \"slate\", reason: `402 ${e.name}`, media: segs(\"slate\") });\n  }\n}</code></pre>\n\n<p>Its bug is one line, and a common shape: the IN tag's DURATION is the sum of the creatives it was given, not the media it stitched.</p>\n\n<pre class=\"language-javascript\"><code class=\"language-javascript\">const plannedSum = ads.reduce((a, ad) =&gt; a + ad.duration, 0); // the bug\nL.push(`#EXT-X-DATERANGE:ID=\"${SPLICE}\",START-DATE=\"${iso(outAt)}\",DURATION=${plannedSum.toFixed(3)},SCTE35-IN=${IN}`);</code></pre>\n\n<p>The splice bytes are copied from RFC 8216's example in section 8.10 and never decoded. Each slot gets its own date range, with the AdServingId in an <code>X-</code> attribute, the namespace RFC 8216 reserves for client-defined attributes:</p>\n\n<pre class=\"language-text\"><code class=\"language-text\">#EXT-X-DATERANGE:ID=\"splice-6FFFFFF0\",START-DATE=\"2026-11-18T10:00:08.000Z\",PLANNED-DURATION=12.000,SCTE35-OUT=0xFC002F0000000000FF000014056FFFFFF000E011622DCAFF000052636200000000000A0008029896F50000008700000000\n#EXT-X-DATERANGE:ID=\"dec-20261118-0007-1\",CLASS=\"com.example.ssai.ad\",START-DATE=\"2026-11-18T10:00:08.000Z\",DURATION=6.000,X-COM-EXAMPLE-DECISION=\"dec-20261118-0007\",X-COM-EXAMPLE-ADSERVINGID=\"labsrv-3f1c9a2e-0001\"\n#EXT-X-DISCONTINUITY\n#EXT-X-PROGRAM-DATE-TIME:2026-11-18T10:00:08.000Z\n#EXTINF:2.000,\nmedia/ads/c1/seg00.ts\n#EXTINF:2.000,\nmedia/ads/c1/seg01.ts\n#EXTINF:2.000,\nmedia/ads/c1/seg02.ts\n#EXT-X-DATERANGE:ID=\"dec-20261118-0007-2\",CLASS=\"com.example.ssai.slate\",START-DATE=\"2026-11-18T10:00:14.000Z\",DURATION=4.000,X-COM-EXAMPLE-DECISION=\"dec-20261118-0007\",X-COM-EXAMPLE-ADSERVINGID=\"labsrv-3f1c9a2e-0002\"\n#EXT-X-DISCONTINUITY\n#EXT-X-PROGRAM-DATE-TIME:2026-11-18T10:00:14.000Z\n#EXTINF:2.000,\nmedia/slate/seg00.ts\n#EXTINF:2.000,\nmedia/slate/seg01.ts\n#EXT-X-DATERANGE:ID=\"splice-6FFFFFF0\",START-DATE=\"2026-11-18T10:00:08.000Z\",DURATION=12.000,SCTE35-IN=0xFC002A0000000000FF00000F056FFFFFF000401162802E6100000000000A0008029896F50000008700000000\n#EXT-X-DISCONTINUITY\n#EXT-X-PROGRAM-DATE-TIME:2026-11-18T10:00:18.000Z\n#EXTINF:2.000,\nmedia/content/seg04.ts</code></pre>\n\n<h3 id=\"sae-player-beacons\">The player fires its own beacons</h3>\n\n<p>The page reads <code>details.dateRanges</code> from hls.js on <code>LEVEL_LOADED</code>, and for each <code>com.example.ssai.ad</code> slot fires impression, start, the quartiles and complete from <code>timeupdate</code> as the playhead crosses each share. Macros are filled per attempt, and a failed attempt is retried once:</p>\n\n<pre class=\"language-javascript\"><code class=\"language-javascript\">async function beacon(tpl, asid, event, adPlayhead) {\n  for (let attempt = 1; attempt &lt;= 2; attempt++) {\n    const url = tpl.replaceAll(\"[ADSERVINGID]\", encodeURIComponent(asid))\n      .replaceAll(\"[ADPLAYHEAD]\", encodeURIComponent(hhmmss(adPlayhead)))\n      .replaceAll(\"[CACHEBUSTING]\", String(Math.floor(1e7 + Math.random() * 9e7)))\n      .replaceAll(\"[TIMESTAMP]\", encodeURIComponent(new Date().toISOString()))\n      .replaceAll(\"[SERVERSIDE]\", \"0\");\n    try {\n      await fetch(url, { signal: AbortSignal.timeout(1000) });\n      rec(\"beacon\", { event, asid, attempt, ok: true });\n      return;\n    } catch (e) {\n      rec(\"beacon\", { event, asid, attempt, ok: false, error: e.name });\n    }\n  }\n}</code></pre>\n\n<p>The retry is reasonable: a beacon lost to a dropped response is lost revenue. Recognising it is the correlator's job.</p>\n\n<h2 id=\"sae-output\">The count says complete; the join says one ad</h2>\n\n<p>One real-time playback in Playwright's Chromium took 31.5 seconds of wall clock; the correlator then reads the four records. The output as printed:</p>\n\n<pre class=\"language-text\"><code class=\"language-text\">$ node run.mjs\nslot 1 labsrv-3f1c9a2e-0001 -&gt; creative\nslot 2 labsrv-3f1c9a2e-0002 -&gt; slate (402 TimeoutError)\nplayed in 29.6 s with 151.0.7922.34\n$ node correlate.mjs\nnaive check: complete beacons 2, ads in pod decision 2 -&gt; PASS\n\nmarker pair       PASS  splice-6FFFFFF0: OUT at 8.000 s, IN present, same ID\nbreak duration    FAIL  IN DURATION=12.000 (PLANNED 12.000), stitched media 10.000 s\ndecision join     PASS  2 slot tags carry dec-20261118-0007, AdServingIds in pod order\nslot 1 creative   PASS  labsrv-3f1c9a2e-0001 tagged com.example.ssai.ad 6.000 s; events impression,start,firstQuartile,midpoint,thirdQuartile,complete\nslot 1 dedupe     INFO  raw 7, unique 6; complete twice, cb 24862842 then 55644167, 1001 ms apart\nslot 2 slate      PASS  labsrv-3f1c9a2e-0002 tagged com.example.ssai.slate 4.000 s; events error; decision 402 TimeoutError\nslot 2 dedupe     INFO  raw 1, unique 1\nresume programme  PASS  resumed at programme 8.000 s, left it at 8.000 s\nresume vs IN      FAIL  media/content/seg04.ts played from media 18.125 s; IN marker puts the in-point at 20.000 s\n\nbillable after correlation: impressions 1, completes 1 of 2 decided</code></pre>\n\n<p>The collector's raw lines show why a URL-level dedupe would keep both completes. Same AdServingId, same ad playhead, a different cachebuster and a timestamp one second later:</p>\n\n<pre class=\"language-json\"><code class=\"language-json\">{\"at\":1794970503543,\"e\":\"error\",\"code\":\"402\",\"asid\":\"labsrv-3f1c9a2e-0002\",\"cb\":\"44385748\",\"ts\":\"2026-11-18T02:55:03.540Z\",\"ss\":\"2\"}\n{\"at\":1794970518193,\"e\":\"complete\",\"asid\":\"labsrv-3f1c9a2e-0001\",\"ap\":\"00:00:06.000\",\"cb\":\"24862842\",\"ts\":\"2026-11-18T02:55:18.192Z\",\"ss\":\"0\"}\n{\"at\":1794970519194,\"e\":\"complete\",\"asid\":\"labsrv-3f1c9a2e-0001\",\"ap\":\"00:00:06.000\",\"cb\":\"55644167\",\"ts\":\"2026-11-18T02:55:19.192Z\",\"ss\":\"0\"}</code></pre>\n\n<p>Both completes belong to creative 1. Creative 2's only event is error 402 from the stitcher (<code>ss</code> 2), the right terminal event for an ad that never played. And the IN tag says 12 seconds where the playlist holds 10.</p>\n\n<p>The player believes the marker. hls.js merges the OUT and IN tags into one date range, and the page's log reports the break with the IN tag's duration:</p>\n\n<pre class=\"language-json\"><code class=\"language-json\">{\"type\":\"daterange\",\"ct\":0,\"id\":\"splice-6FFFFFF0\",\"start\":8,\"duration\":12}\n{\"type\":\"daterange\",\"ct\":0,\"id\":\"dec-20261118-0007-1\",\"class\":\"com.example.ssai.ad\",\"start\":8,\"duration\":6}\n{\"type\":\"daterange\",\"ct\":0,\"id\":\"dec-20261118-0007-2\",\"class\":\"com.example.ssai.slate\",\"start\":14,\"duration\":4}</code></pre>\n\n<p>An ad countdown, a no-seek-during-ads rule, or a server computing content position from that range is two seconds wrong. The resume check measures it: content segment 4 played from 18.125 s, the marker's in-point is 20.000 s. The extra 0.125 s is not the marker's fault. hls.js placed each segment after a discontinuity slightly later than the playlist arithmetic (8.003 s, 14.088 s, 18.125 s), so compare positions with a tolerance; the lab's 0.5 s is a policy, not a number from any specification.</p>\n\n<h2 id=\"sae-correlator\">Joining on AdServingId, not on the URL</h2>\n\n<p>The correlator is about 80 lines. It records every date range at its position on the playlist's media timeline (the running sum of <code>EXTINF</code>), so the IN tag's DURATION can be compared with what was stitched before the first content segment. Beacons are deduplicated on AdServingId plus event, and each slot's expected events depend on what the decision says filled it:</p>\n\n<pre class=\"language-javascript\"><code class=\"language-javascript\">const EXPECT = { creative: [\"impression\", \"start\", \"firstQuartile\", \"midpoint\", \"thirdQuartile\", \"complete\"], slate: [\"error\"] };\n\nfor (const b of mine) {\n  const key = `${b.asid}|${b.e}`;\n  if (unique.has(key)) dupes.push([unique.get(key), b]); else unique.set(key, b);\n}\nconst got = [...unique.values()].map((b) =&gt; b.e);\nconst missing = EXPECT[slot.filled].filter((e) =&gt; !got.includes(e));\nconst extra = got.filter((e) =&gt; !EXPECT[slot.filled].includes(e));\nconst early = [...unique.values()].filter((b) =&gt; SHARE[b.e] &amp;&amp; secs(b.ap) + 0.001 &lt; SHARE[b.e] * Number(tag.DURATION));</code></pre>\n\n<p>The <code>early</code> filter uses <code>[ADPLAYHEAD]</code>: a quartile reported before its share of the creative had played was fired by a clock, not by playback. The resume check makes two comparisons: programme position on each side of the break catches skipped or repeated content, and the player's position against the IN marker catches a dishonest marker.</p>\n\n<h2 id=\"sae-which-record\">Which record is lying in your break</h2>\n\n<p>Each symptom has its own cause, owner and discriminating check.</p>\n\n<h3 id=\"sae-more-completes\">More completes than impressions</h3>\n\n<p>Group beacons by AdServingId and event. Two completes for one ad, a second or so apart with different cachebusters, are a retry; the counting side owns the fix, deduplicating on AdServingId plus event (plus <code>offset</code> for <code>progress</code> events). Different AdServingIds mean two ads, and the question becomes why the decision lists one.</p>\n\n<h3 id=\"sae-slate-billed\">Impressions for a creative that never played</h3>\n\n<p>Join each slot's date range class to the decision's fill. A slot filled with slate whose AdServingId still has an impression means the stitcher tagged the slate as the creative, or fired the impression when it made the decision rather than when it stitched the media. Either way the stitcher owns it. The expected record for that slot is an error beacon (402, 407 or 206, depending on why) and nothing else.</p>\n\n<h3 id=\"sae-marker-length\">A break longer on paper than on screen</h3>\n\n<p>Sum the <code>EXTINF</code> durations from the OUT tag to the first content segment and compare with the IN tag's DURATION. A mismatch equal to a creative's length, or to the difference between creative and slate, means the stitcher wrote the planned duration. If the sum is right and the player still resumes late, look at the player's timestamp handling at the discontinuity instead.</p>\n\n<h3 id=\"sae-double-source\">Client and server both counting one ad</h3>\n\n<p>Filter one AdServingId and event and look at the <code>[SERVERSIDE]</code> value. A 0 beside a 1 or 2 means the player and the stitcher both fired it. Pick one source per event for billing and keep the other as an audit trail. Server-fired tracking also needs <code>X-Device-IP</code> and <code>X-Device-User-Agent</code> headers, which VAST 4.3 requires so that one server's traffic is not mistaken for invalid traffic.</p>\n\n<h2 id=\"sae-costs\">What this harness costs and misses</h2>\n\n<p>It runs in real time, because quartiles are defined at normal speed and a raised <code>playbackRate</code> tests a mode the definitions exclude. Each break costs its length plus startup: one representative break per pull request, a wider set nightly.</p>\n\n<p>Its dedupe rule has a policy edge. Rewinding into a stitched ad in a VOD stream can legitimately replay it under the same AdServingId; decide whether that counts before the correlator decides for you.</p>\n\n<p>It sees one player: a desktop browser through MSE, not a television app with its own timing. It does not decode SCTE-35, so a wrong <code>out_of_network_indicator</code> inside the bytes passes. And it models VOD, where content should resume exactly where it left off. In a live stream the break replaces content, so that check flips: content should resume later by the break's length, or the viewer falls behind live.</p>\n\n<h2 id=\"sae-faq\">Questions about reconciling SSAI beacons</h2>\n\n<h3 id=\"sae-faq-end-date\">Should the IN tag carry END-DATE as well as DURATION?</h3>\n<p>Either is enough, and both must then agree: RFC 8216 requires END-DATE to equal START-DATE plus DURATION when a range has both, and each must describe the actual in-point. Carrying both gives a second value to check against the summed segment durations, and a second way for the stitcher to disagree with itself.</p>\n\n<h3 id=\"sae-faq-interstitials\">Does HLS interstitial playback change any of this?</h3>\n<p>Partly. With interstitials, the client plays the ad asset itself and the draft defines <code>X-RESUME-OFFSET</code>, so the resume point is stated rather than inferred. The beacon side does not change: you still need one key per ad and deduplication on it.</p>\n\n<h3 id=\"sae-faq-errors-only\">Is a break with only error beacons a failure?</h3>\n<p>Not by itself. A pod where every creative timed out and slate filled the break should produce error beacons and no impressions. It becomes a failure when the decision says creative and the beacons say error, or the other way round.</p>\n\n<h2 id=\"sae-references\">Specifications behind the break checks</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8216.html\">RFC 8216, HTTP Live Streaming</a>. Date range attributes, the SCTE-35 mapping in section 4.3.2.7.1, and the example splice bytes in section 8.10.</li>\n<li><a href=\"https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-22\">HLS 2nd Edition Internet-Draft, revision 22</a>. START-DATE omissible on a later same-ID tag, and interstitials with <code>X-RESUME-OFFSET</code>.</li>\n<li><a href=\"https://github.com/InteractiveAdvertisingBureau/VAST4.x/blob/main/4.3.md\">IAB Tech Lab VAST 4.3</a>. Stitcher tracking and its headers, AdServingId, impression timing, quartile definitions and error codes.</li>\n<li><a href=\"https://github.com/InteractiveAdvertisingBureau/VAST4.x/blob/main/4.4.md\">IAB Tech Lab VAST 4.4 working text</a>. Still marked \"Publication Date TBD\".</li>\n<li><a href=\"https://github.com/InteractiveAdvertisingBureau/vast/blob/master/vast4macros/data/macros-data.json\">IAB Tech Lab VAST 4 macro data</a>. Definitions and support levels of the macros used here.</li>\n<li><a href=\"https://github.com/video-dev/hls.js/blob/v1.7.4/src/loader/date-range.ts\">hls.js DateRange source at v1.7.4</a>. How same-ID tags merge, and when a range turns invalid.</li>\n<li><a href=\"https://github.com/video-dev/hls.js/blob/v1.7.4/docs/API.md\">hls.js 1.7.4 API reference (docs/API.md)</a>. Date range metadata cues and interstitial playback.</li>\n</ul>\n\n<h2 id=\"sae-apply\">Reconcile one production break this week</h2>\n\n<p>Take one break from yesterday's traffic on one device family and pull the four records for it: the media playlist as served, with its <code>EXT-X-DATERANGE</code> tags; the stitcher's decision log; every beacon the collector received with that splice's AdServingIds; and, if the player logs segment changes, the first content segment after the break. Then compute four numbers: raw against unique beacons per AdServingId and event, the IN DURATION against the summed EXTINF, impressions on slots whose fill was not the creative, and the resume position against the in-point. Save the joined table beside the ticket as the evidence, so the next disagreement between the ad server and finance starts from a break both can read.</p>\n"}