@dolby-optiview/ads-sdk-core 1.2.1 → 1.4.0

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.
Files changed (134) hide show
  1. package/dist/OptiViewAds.d.ts +5 -4
  2. package/dist/OptiViewAds.js +1 -1
  3. package/dist/OptiViewAdsExternalVendors.d.ts +32 -0
  4. package/dist/external-playback/index.d.ts +4 -0
  5. package/dist/external-playback/index.js +1 -0
  6. package/dist/external-playback/observeExternalPlayback.d.ts +19 -0
  7. package/dist/external-playback/observeExternalPlayback.js +1 -0
  8. package/dist/external-playback/reconnectHold.d.ts +19 -0
  9. package/dist/external-playback/reconnectHold.js +1 -0
  10. package/dist/generated/diagnosticCodes.d.ts +46 -6
  11. package/dist/generated/diagnosticCodes.js +1 -1
  12. package/dist/generated/version.d.ts +1 -1
  13. package/dist/generated/version.js +1 -1
  14. package/dist/index.d.ts +7 -5
  15. package/dist/index.js +1 -1
  16. package/dist/interfaces/AdSourceQueue.d.ts +19 -0
  17. package/dist/interfaces/AdSourceQueue.js +1 -0
  18. package/dist/interfaces/PlayerAdapter.d.ts +31 -1
  19. package/dist/internal/index.d.ts +2 -0
  20. package/dist/internal/index.js +1 -1
  21. package/dist/services/AdBreakSequencer.d.ts +33 -4
  22. package/dist/services/AdBreakSequencer.js +1 -1
  23. package/dist/services/AdPlayerController.d.ts +12 -73
  24. package/dist/services/AdPlayerController.js +1 -1
  25. package/dist/services/BreakChain.d.ts +43 -0
  26. package/dist/services/BreakChain.js +1 -0
  27. package/dist/services/BreakChainRecorder.d.ts +63 -0
  28. package/dist/services/BreakChainRecorder.js +1 -0
  29. package/dist/services/BreakPreloadLedger.d.ts +13 -0
  30. package/dist/services/BreakPreloadLedger.js +1 -0
  31. package/dist/services/BreakScheduler.d.ts +20 -6
  32. package/dist/services/BreakScheduler.js +1 -1
  33. package/dist/services/BreakTransitionTimer.d.ts +27 -2
  34. package/dist/services/BreakTransitionTimer.js +1 -1
  35. package/dist/services/CmcdAdReporter.d.ts +1 -0
  36. package/dist/services/CmcdAdReporter.js +1 -1
  37. package/dist/services/ExternalPlaybackGate.d.ts +40 -0
  38. package/dist/services/ExternalPlaybackGate.js +1 -0
  39. package/dist/services/LiveStartPushbackController.d.ts +5 -10
  40. package/dist/services/LiveStartPushbackController.js +1 -1
  41. package/dist/services/ManifestService.d.ts +2 -1
  42. package/dist/services/ManifestService.js +1 -1
  43. package/dist/services/ReloadGuard.d.ts +11 -0
  44. package/dist/services/ReloadGuard.js +1 -0
  45. package/dist/services/RewindRearm.d.ts +3 -1
  46. package/dist/services/RewindRearm.js +1 -1
  47. package/dist/services/SsaiController.js +1 -1
  48. package/dist/services/adPlayer/AdPlayerCallbacks.d.ts +63 -0
  49. package/dist/services/adPlayer/AdPlayerCallbacks.js +1 -0
  50. package/dist/services/adPlayer/AdPlayerEvents.d.ts +3 -7
  51. package/dist/services/adPlayer/AdPlayerEvents.js +1 -1
  52. package/dist/services/adPlayer/AdPlayerState.d.ts +0 -1
  53. package/dist/services/adPlayer/AdPlayerState.js +1 -1
  54. package/dist/services/adPlayer/AdPreloader.d.ts +2 -2
  55. package/dist/services/adPlayer/AdPreloader.js +1 -1
  56. package/dist/services/adPlayer/AdStage.d.ts +7 -4
  57. package/dist/services/adPlayer/AdStage.js +1 -1
  58. package/dist/services/adPlayer/AssetParameterResolver.d.ts +10 -2
  59. package/dist/services/adPlayer/AssetParameterResolver.js +1 -1
  60. package/dist/services/adPlayer/AssetPlayback.d.ts +9 -2
  61. package/dist/services/adPlayer/AssetPlayback.js +1 -1
  62. package/dist/services/adPlayer/AudioController.d.ts +58 -0
  63. package/dist/services/adPlayer/AudioController.js +1 -0
  64. package/dist/services/adPlayer/BreakSequenceDriver.d.ts +9 -3
  65. package/dist/services/adPlayer/BreakSequenceDriver.js +1 -1
  66. package/dist/services/adPlayer/ContentResumeCoordinator.d.ts +2 -0
  67. package/dist/services/adPlayer/ContentResumeCoordinator.js +1 -1
  68. package/dist/services/adPlayer/GamPodBridge.d.ts +11 -1
  69. package/dist/services/adPlayer/GamPodBridge.js +1 -1
  70. package/dist/services/adPlayer/PauseAdPresenter.d.ts +3 -1
  71. package/dist/services/adPlayer/PauseAdPresenter.js +1 -1
  72. package/dist/services/adPlayer/PreparedPresentation.js +1 -1
  73. package/dist/services/adPlayer/PresentationModeTracker.d.ts +1 -1
  74. package/dist/services/adPlayer/PresentationModeTracker.js +1 -1
  75. package/dist/services/adPlayer/SharedElementBreakPlayer.d.ts +3 -0
  76. package/dist/services/adPlayer/SharedElementBreakPlayer.js +1 -1
  77. package/dist/services/adPlayer/SuccessorQueue.d.ts +36 -0
  78. package/dist/services/adPlayer/SuccessorQueue.js +1 -0
  79. package/dist/services/adPlayer/SurfaceRevealReporter.d.ts +28 -0
  80. package/dist/services/adPlayer/SurfaceRevealReporter.js +1 -0
  81. package/dist/services/adPlayer/presentation/DomPresentationHost.d.ts +22 -0
  82. package/dist/services/adPlayer/presentation/DomPresentationHost.js +1 -0
  83. package/dist/services/adPlayer/presentation/LayoutTransform.d.ts +28 -0
  84. package/dist/services/adPlayer/presentation/LayoutTransform.js +1 -0
  85. package/dist/services/adPlayer/presentation/PresentationLayout.d.ts +19 -0
  86. package/dist/services/adPlayer/presentation/PresentationLayout.js +1 -0
  87. package/dist/services/assetParameterMacroTable.js +1 -1
  88. package/dist/services/assetParameterMacros.d.ts +9 -9
  89. package/dist/services/assetParameterMacros.js +1 -1
  90. package/dist/services/channelSwitch.d.ts +2 -2
  91. package/dist/services/externalPlaybackDiagnostic.d.ts +3 -0
  92. package/dist/services/externalPlaybackDiagnostic.js +1 -0
  93. package/dist/services/externalPlaybackGuard.d.ts +24 -0
  94. package/dist/services/externalPlaybackGuard.js +1 -0
  95. package/dist/services/parseBreakManifest.d.ts +2 -1
  96. package/dist/services/parseBreakManifest.js +1 -1
  97. package/dist/services/resolveChannelEvents.d.ts +17 -0
  98. package/dist/services/resolveChannelEvents.js +1 -0
  99. package/dist/services/resolveExternalVendorConfigurations.js +1 -1
  100. package/dist/services/resolveGamVendorConfiguration.d.ts +6 -1
  101. package/dist/services/resolveGamVendorConfiguration.js +1 -1
  102. package/dist/services/ssbStream.d.ts +39 -0
  103. package/dist/services/ssbStream.js +1 -0
  104. package/dist/services/ssbSwitchSignals.d.ts +15 -0
  105. package/dist/services/ssbSwitchSignals.js +1 -0
  106. package/dist/services/staticAssetUrl.d.ts +28 -0
  107. package/dist/services/staticAssetUrl.js +1 -0
  108. package/dist/session/AdBreakStatusTracker.d.ts +18 -0
  109. package/dist/session/AdBreakStatusTracker.js +1 -1
  110. package/dist/session/BreakLifecycle.d.ts +6 -0
  111. package/dist/session/BreakLifecycle.js +1 -1
  112. package/dist/session/SessionStarter.d.ts +6 -43
  113. package/dist/session/SessionStarter.js +1 -1
  114. package/dist/session/SessionStarterDeps.d.ts +39 -0
  115. package/dist/session/SessionStarterDeps.js +1 -0
  116. package/dist/session/SessionStarterHelpers.d.ts +36 -0
  117. package/dist/session/SessionStarterHelpers.js +1 -0
  118. package/dist/session/SessionState.d.ts +22 -2
  119. package/dist/session/SessionState.js +1 -1
  120. package/dist/session/SsbSwitch.d.ts +55 -0
  121. package/dist/session/SsbSwitch.js +1 -0
  122. package/dist/session/breakMeasurement.d.ts +16 -0
  123. package/dist/session/breakMeasurement.js +1 -0
  124. package/dist/session/contentSnapback.d.ts +13 -0
  125. package/dist/session/contentSnapback.js +1 -0
  126. package/dist/session/createExternalPlaybackGate.d.ts +19 -0
  127. package/dist/session/createExternalPlaybackGate.js +1 -0
  128. package/dist/session/sessionTick.d.ts +7 -0
  129. package/dist/session/sessionTick.js +1 -0
  130. package/dist/types/BreakManifest.d.ts +58 -5
  131. package/dist/types/Events.d.ts +21 -10
  132. package/dist/types/ExternalVendorConfiguration.d.ts +3 -1
  133. package/dist/types/OptiViewAdsConfig.d.ts +24 -8
  134. package/package.json +5 -1
@@ -1 +1 @@
1
- export const DIAGNOSTIC_CODES={"DA-SESSION-STARTED":{category:"session",level:"info",summary:"Monetization session started; manifest polling began. context: manifestUrl (stitcherUrl in SSAI mode), reported verbatim."},"DA-SESSION-ENDED":{category:"session",level:"info",summary:"Monetization session ended; polling and scheduling stopped."},"DA-ASSET-PARAMETERS-UPDATED":{category:"session",level:"info",summary:"The break manifest's session-level asset parameters changed; the merged parameters were pushed to the active GAM stream. context: source ('manifest'), keys (parameter names only, never values)."},"DA-MANIFEST-FETCH-FAILED":{category:"manifest",level:"error",summary:"Initial break-manifest fetch failed; the session could not start."},"DA-MANIFEST-POLL-FAILED":{category:"manifest",level:"warn",summary:"A manifest poll failed; the SDK keeps the last good manifest and retries."},"DA-MANIFEST-CHANNEL-CHANGED":{category:"manifest",level:"info",summary:"A polled manifest describes a different ads channel (channelId, GAM identity or timebase changed); the SDK re-aligned its ad setup and resolved delivery mode again while the session and content playback continued. context: previousChannelId, channelId, reason, manifestUrl."},"DA-MANIFEST-INTERCEPT-FAILED":{category:"manifest",level:"warn",summary:"The customer manifest-response interceptor threw; the un-modified parsed manifest was used instead."},"DA-MANIFEST-REQUEST-INTERCEPT-FAILED":{category:"manifest",level:"warn",summary:"The customer manifest-request interceptor threw; the normal network fetch of the original URL was used instead."},"DA-MANIFEST-SIGNATURE-INVALID":{category:"manifest",level:"error",summary:"The break-manifest response failed detached-JWS signature verification (missing/malformed X-Manifest-Signature, unsupported alg, unknown kid, unknown critical param, or signature mismatch); the manifest was rejected and no breaks were scheduled. context: url, reason."},"DA-PDT-MISSING":{category:"playback",level:"warn",summary:"No EXT-X-PROGRAM-DATE-TIME once content is playing (or after the startup backstop window); wallclock-timebase breaks fall back to the system clock."},"DA-ANVATO-CUE-PENDING":{category:"break",level:"info",summary:"ptsSource: 'anvatoCue' — no Anvato in-stream cue observed yet for a PTS break; the break stays pending until its cue arrives."},"DA-ANVATO-CUE-MATCHED":{category:"break",level:"info",summary:"ptsSource: 'anvatoCue' — a PTS break's start was matched to an observed Anvato cue and scheduled at the cue's media time."},"DA-ANVATO-CUE-ENTERED":{category:"break",level:"info",summary:"ptsSource: 'anvatoCue' — a break was started by the cue reaching the playhead rather than by the scheduler's 250ms tick; context carries the breakId, the cue pts and the media time it fired at, so the two start paths are distinguishable in the field."},"DA-ANVATO-CUE-OBSERVED":{category:"break",level:"info",summary:"ptsSource: 'anvatoCue' — an Anvato break-signaling (type=cue) frame was observed in the stream; context carries the cue's pts, the media time it landed at, whether the tracker recorded it, and the raw payload — so a manifest-PTS vs in-stream-PTS misalignment is observable in the field."},"DA-ANVATO-CUE-SEGMENT-ANCHORED":{category:"break",level:"warn",summary:"ptsSource: 'anvatoCue' — an Anvato emsg cue arrived without a ptsOffset from the adapter, so its break is scheduled at the cue's carrying segment start, which can be up to one segment early. Emitted once per session; context: pts, mediaTime."},"DA-ANVATO-CUE-OFFSET-REJECTED":{category:"break",level:"warn",summary:"ptsSource: 'anvatoCue' — the adapter's ptsOffset placed an Anvato cue outside its carrying segment's window (more than 0.1s before or 15s after the cue startTime), so the cue's startTime is used instead. Emitted once per cue pts; context: pts, startTime, ptsOffset, mappedTime."},"DA-ANVATO-CUE-END-MATCHED":{category:"break",level:"info",summary:"ptsSource: 'anvatoCue' — the active break's Anvato type=cue_end was observed and its length on the stream clock (cue_end pts minus the break start pts) is within 2s of the break duration. Emitted once per break; context: breakId, mediaTime (where the player reported the cue_end), lengthSec, durationSec."},"DA-ANVATO-CUE-END-REJECTED":{category:"break",level:"warn",summary:"ptsSource: 'anvatoCue' — an Anvato type=cue_end was observed for the active break but its stream-clock length differs from the break duration by more than 2s, so it is ignored and the resume keeps its computed target. Emitted once per break; context: breakId, mediaTime, lengthSec, durationSec."},"DA-PRELOAD-FAILED":{category:"preload",level:"warn",summary:"Ad preload failed; the asset will be loaded on demand at break start."},"DA-PRELOAD-MODE-RESOLVED":{category:"preload",level:"info",summary:"The configured ad preload mode was resolved for this session; context carries both the configured and the resolved mode."},"DA-PRELOAD-PATH":{category:"preload",level:"info",summary:"The preload path actually taken for a break's ad (parallel buffer / detached prefetch / first-frame warm-up on the ad player / none) and the creative container (stream vs progressive)."},"DA-BREAK-EARLY-RETURN":{category:"break",level:"info",summary:"The active break was removed from a polled manifest (early return); the break ends immediately and content resumes at break start plus the seconds already played."},"DA-BREAK-WINDOW-ESCAPED":{category:"break",level:"warn",summary:"An active wallclock break outlived its window on the stream clock (ad stall, bogus trigger position, or a re-fired completed break); the SDK ended it and returned to content. context.overrunSec says by how much."},"DA-BREAK-EVENT-UNSUPPORTED":{category:"break",level:"warn",summary:"A break is triggered by a spec event this SDK version does not schedule on this platform (web schedules `start`, `pause` and `end`; Android and iOS do not schedule `end` yet); the break was ignored. context.event names the event."},"DA-BREAK-SUPPRESSED-OVERLAP":{category:"break",level:"warn",summary:"A break was suppressed because an ad was already playing."},"DA-BREAK-TRANSITION":{category:"break",level:"info",summary:"Measured duration of a playback transition into an ad break, between two ads, between chained breaks, or back to content."},"DA-AD-SURFACE-REVEALED":{category:"break",level:"info",summary:"The ad surface became visible: how long it was held back waiting for the ad's first frame, and whether it was revealed because that frame arrived or because the wait timed out."},"DA-BREAK-CUT-LATE":{category:"break",level:"warn",summary:"timebase: 'wallclock', all platforms — content was cut more than 0.5s after the break's manifest start on the stream's Program Date Time, so the viewer saw the stream's own break (slate) instead of the ad until then; typically the ad's first frame was not ready at the cut and content kept playing under the cross-fade. The replaced window is unaffected: the resume anchor is the content time of the manifest start whatever the cut landed on. Context carries breakId, lateSec (cut minus start on the PDT axis), start (the manifest start), cutPdt (the PDT at the cut), cutAt (currentTime at the cut) and anchor; iOS/Android add waitedForAdMs when the cut waited for the ad surface."},"DA-PREROLL-CONTENT-HELD":{category:"break",level:"info",summary:"Content playback was held at session start until a pending pre-roll began, so no content is shown before the ad."},"DA-PREROLL-CONTENT-WAIT-TIMEOUT":{category:"break",level:"info",summary:"A pending pre-roll began after content readiness was not reported within the wait timeout."},"DA-PREROLL-CANCELLED-CONTENT-ERROR":{category:"break",level:"warn",summary:"A pending pre-roll was cancelled because the content failed to load before it could begin."},"DA-SHARED-ELEMENT-UNSUPPORTED":{category:"break",level:"warn",summary:"Configured shared-element insertion is unsupported on this platform (non-iPhone/iPod); fell back to overlay insertion."},"DA-SHARED-ELEMENT-RESTORE-FAILED":{category:"playback",level:"error",summary:"Content did not resume after a shared-element break: the reload/seek/play restore failed twice; the viewer is left paused on the handed-back element."},"DA-IMAGE-LOAD-FAILED":{category:"break",level:"warn",summary:"An image (companion, backdrop or image ad) could not be fetched or decoded within the timeout; the break continues without it."},"DA-PIP-TRANSFER-FAILED":{category:"break",level:"warn",summary:"The picture-in-picture window could not be moved between the content and ad elements; the break continues but the viewer may not see the ad in the PiP window."},"DA-PIP-AUTODETECT-UNAVAILABLE":{category:"break",level:"warn",summary:"No Activity could be resolved from the renderer's Context or the overlay's view tree, so picture-in-picture cannot be detected automatically; the host must call OptiViewAds.setPictureInPicture() from Activity.onPictureInPictureModeChanged or breaks will be laid out for a fullscreen surface. Android only."},"DA-CONTENT-ELEMENT-SWAPPED":{category:"break",level:"info",summary:"The content player replaced its <video> element; the SDK re-bound its presentation listeners to the new one."},"DA-PIP-FORMAT-OVERRIDE":{category:"break",level:"info",summary:"The content player is in picture-in-picture, so the break's declared format was overruled and it plays as a single fullscreen ad."},"DA-PIP-ADOPTION-STATE":{category:"break",level:"info",summary:"Native PiP reconciliation deferred or reused a layout/handoff decision. Context carries reason, active, adPlaying, applied, and asset/break IDs when available; this is not evidence that a format override occurred."},"DA-PIP-HANDOFF":{category:"break",level:"info",summary:"The picture-in-picture handoff route chosen for the ad: 'layer-swap' (the presented AVPlayerLayer is re-pointed at the ad player) or 'borrow' (the ad plays through the content player). context: route, layers. iOS only."},"DA-PIP-LAYER-SWAP":{category:"break",level:"debug",summary:"Read-back check after a PiP layer-swap: whether the presented layer still points at the ad player after the re-point. context: held, layers. iOS only."},"DA-PIP-PRESENTED":{category:"break",level:"debug",summary:"Status trace of the player on the PiP-presented layer during a layer-swap: owner (ad/content/other) and time-control-status transitions, plus ad-item ends observed while presented. context: owner/status, or errored/reachedEnd/adStatus. iOS only."},"DA-CHAIN-RESOLVER-ERROR":{category:"chaining",level:"warn",summary:"The chained-successor resolver threw; chaining was skipped for this break."},"DA-GAM-NO-ASSET-KEY":{category:"gam",level:"warn",summary:"Retired: the GAM stream identity now comes from the manifest's vendorConfiguration. Kept declared so the code is never reused; see DA-GAM-CONFIG-MISSING."},"DA-GAM-SESSION-FAILED":{category:"gam",level:"error",summary:"The GAM/IMA session failed to initialize; GAM breaks will not serve."},"DA-GAM-START-DEFERRED":{category:"gam",level:"info",summary:"The SGAI IMA stream request is deferred until the configured ad start delay has been played; context includes adStartDelaySec."},"DA-GAM-CONFIG-RESOLVED":{category:"gam",level:"info",summary:"The GAM stream identity for this session was resolved from the manifest's vendorConfiguration."},"DA-GAM-CONFIG-MISSING":{category:"gam",level:"error",summary:'The break manifest carries no usable "gam" vendorConfiguration entry; GAM assets are skipped.'},"DA-GAM-POD-IDENTITY-MISMATCH":{category:"gam",level:"error",summary:"A GAM pod asset's vendorParameters name a different network code or custom asset key than the stream session was created with; the asset is skipped because the pod request cannot serve."},"DA-GAM-POD-MID-BREAK-END":{category:"gam",level:"warn",summary:"IMA reported the ad break ended before the pod's last ad while pod stream remains; per-ad reporting continues until the pod ends."},"DA-GAM-DUPLICATE-METADATA":{category:"gam",level:"info",summary:"The stream carries the same ad marker more than once at the same time (for example in both the audio and video renditions of an fMP4 stream); the duplicate was not passed to IMA, so each ad event fires once. Reported once per stream session."},"DA-VENDOR-CONFIG-UNKNOWN-TYPE":{category:"manifest",level:"info",summary:"One or more vendorConfiguration entries declare a type this SDK version does not recognise and were ignored."},"DA-EXTERNAL-VENDOR-INVALID":{category:"manifest",level:"warn",summary:"External vendorConfiguration entries were ignored because provider was blank or assetParameters was not an object. context: count."},"DA-EXTERNAL-VENDOR-DUPLICATE":{category:"manifest",level:"warn",summary:"External vendorConfiguration entries repeated a provider; the first valid entry was used. context: providers."},"DA-CONTENT-PLAYBACK-ERROR":{category:"playback",level:"error",summary:"The content player reported a playback error."},"DA-CONTENT-RESUME-STALLED":{category:"playback",level:"warn",summary:"Content did not resume within the watchdog window after a break that paused it ended; the SDK re-issued play() once. iOS only for now."},"DA-CONTENT-RECOVERY-MODE-RESOLVED":{category:"playback",level:"info",summary:"The resolved post-break content recovery mode for the session (recreate or none); context carries configured and resolved."},"DA-CONTENT-PIPELINE-RECREATED":{category:"playback",level:"info",summary:"The content player's media pipeline was rebuilt at break end before content resumed (recovery mode recreate); context carries breakId, startTime and durationMs."},"DA-CONTENT-PIPELINE-RECREATE-FAILED":{category:"playback",level:"warn",summary:"Rebuilding the content media pipeline at break end failed or timed out — or the adapter does not implement recreateMediaPipeline() (reason 'unsupported-adapter', e.g. a wrapper adapter that does not forward it); the SDK fell back to resuming in place with seek + play; context carries breakId, startTime, reason."},"DA-AD-PLAYBACK-ERROR":{category:"playback",level:"error",summary:"The ad player reported a playback error during a break."},"DA-AD-LOAD-RETRIED":{category:"playback",level:"warn",summary:'The ad player\'s load() had not settled within the retry window of the ad-start budget and the ad element showed no progress (readyState 0, nothing buffered), so a second load() was issued for the same URI; a slow-but-progressing load is not retried. Context carries breakId, assetId, uri, elapsedMs, remainingBudgetMs. A still-stalled retry ends as DA-AD-PLAYBACK-ERROR "Ad load timeout".'},"DA-AD-URI-MISSING":{category:"playback",level:"error",summary:"The ad asset had no usable media URI, VAST tag URL or render surface; reported as CMCD adec."},"DA-AD-MEDIA-LOAD-FAILED":{category:"playback",level:"error",summary:"The ad player could not fetch the ad media (network or HTTP failure); reported as CMCD adec."},"DA-AD-MEDIA-UNSUPPORTED":{category:"playback",level:"error",summary:"The ad player could not decode the ad media or does not support its format; reported as CMCD adec."},"DA-AD-START-TIMEOUT":{category:"playback",level:"error",summary:"The ad did not load, render a first frame or start within its start budget; reported as CMCD adec."},"DA-AD-START-INTERRUPTED":{category:"playback",level:"warn",summary:"The ad element's play() was interrupted by a browser-initiated pause before the ad started (Chromium AbortError, seen on Samsung Tizen); the SDK re-issued play() once. context: breakId, error."},"DA-AD-DURATION-PREPARED":{category:"playback",level:"info",summary:"The ad media for a break was prepared and its real playable duration is now known, BEFORE the first frame. context: breakId, assetId, index, total, preparedDurationSec (the loaded media's own duration — on a GAM pod, the stitched pod's length), declaredDurationSec (what the manifest said about this asset, when it said anything) and breakDurationSec (the slot the break declares). Emitted per asset, so a multi-asset break reports one per asset and the break total is their sum. The three together separate a short break caused by a short POD from one caused by a short request or a late join."},"DA-DELIVERY-MODE-RESOLVED":{category:"session",level:"info",summary:"Delivery mode (sgai/ssai) resolved for the session at start and again on an ads-channel switch from the manifest's delivery rules (or the explicit client config), with the detected device profile."},"DA-TARGETING-VALUE-UNKNOWN":{category:"manifest",level:"warn",summary:"A targeting value is not recognized and the targeted entry does not match."},"DA-TARGETING-FIELD-UNKNOWN":{category:"manifest",level:"warn",summary:"A targeting field is not recognized and the targeted entry does not match."},"DA-TARGETING-INVALID":{category:"manifest",level:"warn",summary:"A targeting constraint is malformed or incomplete and the targeted entry does not match."},"DA-DELIVERY-MODE-UNKNOWN":{category:"session",level:"warn",summary:"The matching delivery rule carried an unrecognized mode value; sgai is used (forward compatibility)."},"DA-DELIVERY-MODE-OVERRIDDEN":{category:"session",level:"info",summary:"The manifest's delivery rules resolved a different mode, but the explicit client config takes precedence."},"DA-DELIVERY-MODE-CHANGE-IGNORED":{category:"session",level:"warn",summary:"An ordinary manifest poll resolves a different delivery mode; the mode pinned for the session stays in force. An ads-channel switch resolves the mode again."},"DA-SSAI-UNAVAILABLE":{category:"session",level:"error",summary:"The manifest selected ssai delivery but no vendor configuration can provide a stitched stream (no gam entry with an assetKey); at start the session fails, while on a channel switch the session stays in sgai."},"DA-SSAI-SESSION-FAILED":{category:"session",level:"error",summary:"The SSAI session failed to start (IMA stream init, stream id, or stitched-stream load)."},"DA-SSAI-IMA-ERROR":{category:"gam",level:"error",summary:"IMA reported an error during the SSAI stream session."},"DA-INSERTION-TYPE-RESOLVED":{category:"session",level:"info",summary:"Per-session ad insertion type resolved, and whether the integrator set it or left it unset (unset lets the manifest's resumeOffset drive the resume point)."},"DA-RESUME-OFFSET-CLAMPED":{category:"break",level:"info",summary:"The resume offset was shortened to the ad duration actually played, so the break could not skip further than the ads it delivered."},"DA-INSERTION-TYPE-IGNORED-SSAI":{category:"session",level:"warn",summary:"adInsertionType is ignored in SSAI mode; the stitcher controls ad insertion server-side."},"DA-VAST-UNSUPPORTED-FORMAT":{category:"break",level:"warn",summary:"A VAST asset appeared in an unsupported break format; VAST is only supported in single, double, and lshape_ad. The break was skipped."},"DA-ASSET-MACRO-UNKNOWN":{category:"break",level:"warn",summary:"An asset parameter value contained a macro the SDK has no value for (an unknown or unavailable OptiView macro, or a registered customer macro that returned no value); the parameter was still sent, with the macro kept as its literal token. Raised once per parameter key and macro. context: key, macro, breakId, assetId."},"DA-ASSET-PARAMETER-OMITTED":{category:"break",level:"info",summary:"An asset parameter value contained a customer macro that is empty (value `null`), so the parameter was not sent; for GAM `cust_params` only the `&`-separated pair containing the macro was dropped. Raised once per parameter key and macro (per dropped pair for GAM `cust_params`). context: key, macro, pair (GAM `cust_params` only), breakId, assetId."},"DA-VAST-SSAI-UNSUPPORTED":{category:"session",level:"warn",summary:"VAST assets are not supported in SSAI mode (VAST is SGAI-only); the asset was skipped."},"DA-VAST-IMA-ERROR":{category:"gam",level:"error",summary:"Google IMA reported an error while loading or playing a VAST (client-side / CSAI) ad."},"DA-VAST-NO-FILL":{category:"gam",level:"error",summary:"The VAST ad server returned no ad (empty response, no ads after wrappers or no assets); reported as CMCD adec."},"DA-VAST-TIMEOUT":{category:"gam",level:"error",summary:"The VAST response or its media file did not load in time; reported as CMCD adec."},"DA-VAST-MALFORMED":{category:"gam",level:"error",summary:"The VAST response could not be parsed or uses an unsupported VAST version; reported as CMCD adec."},"DA-VAST-REQUEST-FAILED":{category:"gam",level:"error",summary:"The VAST ad request failed (network error, invalid tag URL, wrapper error or too many redirects); reported as CMCD adec."},"DA-VAST-CREATIVE-FAILED":{category:"gam",level:"error",summary:"The VAST creative could not be played (no compatible media file, playback error or trafficking error); reported as CMCD adec."},"DA-VAST-IMA-SDK-MISSING":{category:"gam",level:"error",summary:"The Google IMA client-side SDK (ima3.js) is unavailable; VAST (CSAI) ads cannot be played."},"DA-PAUSE-AD-SHOWN":{category:"break",level:"info",summary:"A pause ad (full-screen image or video) was shown while content is paused."},"DA-PAUSE-AD-DISMISSED":{category:"break",level:"info",summary:"A pause ad was dismissed (content resumed, or the duration cap elapsed)."},"DA-PAUSE-AD-RESUME-ALLOWED":{category:"break",level:"info",summary:"The viewer may now resume content over the shown pause ad: the break's controls.skipOffset elapsed, or (no skipOffset) the ad was watched fully: a video creative ended, an image reached its duration cap or has none. context: breakId."},"DA-PAUSE-AD-RESUME-BLOCKED":{category:"break",level:"info",summary:"Content tried to resume while a pause ad must still be watched (controls.skipOffset not reached, or no skipOffset and the video creative has not ended / the image duration cap has not elapsed); the SDK keeps content paused. context: breakId, elapsedSec, skipOffset."},"DA-PAUSE-AD-DVR-EXPIRED":{category:"break",level:"info",summary:"The viewer paused for longer than the DVR window is deep, so the position they paused at aged out and playback resumed at the live edge instead. context: pinnedPosition, liveEdge."},"DA-PAUSE-AD-NO-ASSET":{category:"break",level:"warn",summary:"A pause break had no usable image or video asset (no first asset, unsupported media type, or no resolvable VAST creative); the pause ad was skipped."},"DA-PAUSE-AD-SSAI-UNSUPPORTED":{category:"session",level:"warn",summary:"Pause ads are SGAI-only and not supported in SSAI mode; the pause break was skipped."},"DA-MANIFEST-POLLED":{category:"manifest",level:"info",summary:"A manifest poll refresh succeeded (cadence follows the manifest polling config)."},"DA-AD-SKIPPED":{category:"playback",level:"info",summary:"The viewer skipped the active ad break (controls.skipOffset honored)."},"DA-AD-SKIP-SUPPRESSED":{category:"playback",level:"info",summary:"A skip request was suppressed (no skipOffset declared, or requested before the offset)."},"DA-AD-CLICKED":{category:"playback",level:"info",summary:"The viewer clicked the ad on screen (adclick emitted)."},"DA-LIVE-START-PUSHBACK":{category:"playback",level:"info",summary:"Initial live playback requested a backward seek to the configured target-duration distance. Context includes enabledBy (config or ptsSource), targetDurationSec, targetDurationSource, initialOffsetSec, initialOffsetTargetDurations, requestedOffsetSec, requestedOffsetTargetDurations, targetOffsetSec, targetOffsetTargetDurations, rewindSec, rewindTargetDurations, target and windowClamped. This is a request, not proof of the landing."},"DA-LIVE-START-PUSHBACK-SKIPPED":{category:"playback",level:"info",summary:"Initial live playback was left unchanged. The reason identifies a disabled adjustment (enabledBy says whether ptsSource or an explicit enabled decided it), an already sufficient offset, missing target duration or seekable range, invalid configuration, or no safe backward target. Available target-duration and offset measurements are included."},"DA-LIVE-START-PUSHBACK-LANDED":{category:"playback",level:"info",summary:"Measured initial-live seek landing. Context includes the requested target and targetDurationSec, landed, errorSec, liveEdgeAtLanding, landedOffsetSec and landedOffsetTargetDurations. A timeout or failed seek reports landed=null, never an inferred success."},"DA-RESUME-SEEK":{category:"playback",level:"info",summary:"Content was resume-seeked to the resolved post-break position (insertion type policy)."},"DA-RESUME-UNADDRESSABLE":{category:"playback",level:"warn",summary:"A break played through the content player (picture-in-picture), so content came back on a reloaded source whose timeline has its own origin, and that source published neither a program-date-time nor a seekable range to re-address the resume point against. Content stays where the reload left it — near the live edge — rather than being seeked to a position that does not exist on the new timeline. Context carries breakId, target (the position on the pre-borrow timeline) and offset."},"DA-RESUME-LANDED":{category:"playback",level:"info",summary:"Where the post-break resume-seek actually landed, measured on the seeked event rather than inferred: context carries breakId, target (the position requested), landed and errorSec (landed - target; negative means the player settled EARLIER than asked). errorSec only says whether the SEEK did what it was asked: when the live-window clamp moved the seek, policyTarget is the resume point before the clamp and policyErrorSec (landed - policyTarget) is how far the viewer really is from it. landed is null with a reason when no seeked event arrived, which is normal for a seek to the position the playhead already holds. Report-only: the SDK does not correct the position."},"DA-RESUME-PREPARED":{category:"playback",level:"info",summary:"Android, live break that resumes at its end — the paused content was parked exactly on the resume point before the hand-back, so the hand-back only plays (DA-RESUME-SEEK then reports prepared=true and issues no seek). Context carries breakId, target, source (cue_end when the stream's matched type=cue_end was known, else cue+duration) leadMs (how long before the expected hand-back it was parked) and refresh (true when content parked long before the hand-back was seeked onto the same point again, 4.5s before it). A later cue_end parks content again."},"DA-RESUME-PREPOSITIONED":{category:"playback",level:"info",summary:"The break resumed without a seek: content was moved onto its resume position DURING the break, so the transition needed no jump. Context carries breakId, target, prepositionedTo, landed, shortfallSec and exact. exact=true means it reached the policy target. exact=false means the live window never published those frames, so content was moved as close as exists — the viewer lands short, but arrives already in place rather than via a visible seek at the cut."},"DA-RESUME-PTS-MAP":{category:"playback",level:"info",summary:"ptsSource: 'anvatoCue', iOS/tvOS and web — the live resume point was mapped onto currentTime through the stream's own clock: the Anvato type=beacon tags delivered since the run-up's last seek give the currentTime ↔ stream-clock offset, and the resume point (the matched cue_end, else the cue plus the break duration) is converted with it. Reported when a mapping is first available after a seek and whenever the mapped target moves by 0.1s or more. Context carries breakId, target, landingStreamSec, landingSource (cue_end or cue+duration), offsetSec, beacons (beacons averaged), generation (how often the mapping started over since the session began), currentTime, and computedTarget with deltaSec (target - computedTarget) when a currentTime-based target exists."},"DA-RESUME-PTS-REMAP":{category:"playback",level:"warn",summary:"ptsSource: 'anvatoCue', iOS/tvOS and web — a stream beacon disagreed with the currentTime ↔ stream-clock mapping by more than 0.2s, so the player re-anchored currentTime (a variant switch or a buffer restart); the mapping starts over from that beacon and the resume point is mapped again. Reported during the resume run-up and after the hand-back. Context carries breakId, fromOffsetSec, toOffsetSec, deltaSec, currentTime and stage (run-up or after-hand-back)."},"DA-RESUME-PTS-CORRECTED":{category:"playback",level:"info",summary:"ptsSource: 'anvatoCue', iOS/tvOS and web — once per break at the hand-back, on a stream that carries Anvato beacons: whether the stream clock placed the live resume point, and by how much it moved it. applied=true: streamClockTarget is the resume point mapped through the beacons, correctionSec is streamClockTarget - computedTarget (the currentTime target, cue plus duration), and currentTimeShiftSec is how far the same stream instant moved in currentTime between the pause and the hand-back (negative: it now sits earlier), null when no beacon mapped the stream before the pause. Context also carries breakId, landingSource (cue_end or cue+duration), landingStreamSec, offsetSec, beacons, remaps (DA-RESUME-PTS-REMAP during the break) and cueEndTarget when a cue_end was matched. applied=false with a reason means no beacon arrived after the run-up's last seek, so the cue_end or currentTime target applied."},"DA-RESUME-PTS-LANDED":{category:"playback",level:"info",summary:"ptsSource: 'anvatoCue', iOS/tvOS and web — where a stream-clock resume landed, measured on the stream's own clock from the beacons delivered after the hand-back: landedStreamSec is the position content resumed from (resumedAt, the seek landing or the playhead at a seek-free hand-back) converted with that mapping, and errorSec is landedStreamSec - landingStreamSec (negative: content resumed before the stream's resume point, so slate is shown). Context carries breakId, landingStreamSec, landingSource, resumedAt, sinceHandBackSec and, when measured, landedStreamSec, errorSec, offsetSec and beacons; reason when no beacon arrived within 15s. Report-only: the SDK does not correct the position from it."},"DA-RESUME-PDT-MAP":{category:"playback",level:"info",summary:"timebase: 'wallclock', all platforms — the live resume point (the manifest start plus duration, a wallclock instant) was mapped onto currentTime through the Program Date Time the content player reports now, so a currentTime re-anchored by a seek during the break cannot move it. Reported when the run-up first reads the target and whenever the mapped target moves by 0.1s or more (remapped=true: currentTime moved against the stream). Context carries breakId, target, landingPdt (the break end, ISO-8601), pdtOffsetSec (PDT minus currentTime, seconds), currentTime, remapped, and computedTarget with deltaSec (target - computedTarget) when an anchor-based target exists."},"DA-RESUME-PDT-CORRECTED":{category:"playback",level:"info",summary:"timebase: 'wallclock', all platforms — once per break at the hand-back of a break anchored on the Program Date Time: whether the stream clock placed the live resume point, and by how much it moved it. applied=true: pdtTarget is the break end mapped through the PDT the player reports at the hand-back, correctionSec is pdtTarget - computedTarget (the anchor plus the offset) and currentTimeShiftSec is how far the same stream instant moved in currentTime between the cut and the hand-back (negative: it now sits earlier). applied=false with a reason means no PDT sample was available at the hand-back, so the anchor-based target applied. Context also carries breakId and computedTarget."},"DA-RESUME-PDT-LANDED":{category:"playback",level:"info",summary:"timebase: 'wallclock', all platforms — where a Program-Date-Time resume landed, measured on the stream's own clock from the first position sample after the hand-back: errorSec is the PDT content resumed at minus the break end (negative: content resumed before the break end, so the stream's own break is shown; positive: post-break content was skipped). Context carries breakId, landingPdt (the break end), landedPdt, landedAt (currentTime) and sinceHandBackSec; reason when no sample carried a PDT within 2s. Report-only: the SDK does not correct the position from it."},"DA-RESUME-CUE-END":{category:"playback",level:"info",summary:"ptsSource: 'anvatoCue', iOS/tvOS, web and Android — the stream's matched type=cue_end replaced the computed resume target: the slate under the ad ends there, not at cue plus the advertised duration (150.206s for a 150s break on NFL Channel), and the player can remap its timeline while content is held, so the cue_end is reported in the current mapping. Context carries breakId, computedTarget, cueEndTarget, deltaSec (cueEndTarget - computedTarget), stage (hold, playing or hand-back; Android: always hand-back) and corrected (whether an in-buffer correction seek ran). Only a policy that resumes at the break end is replaced; otherwise applied=false and only the delta is reported."},"DA-RESUME-CUE-END-LATE":{category:"playback",level:"info",summary:"ptsSource: 'anvatoCue', iOS/tvOS and Android — the break's type=cue_end was matched only after the hand-back. When it is more than 1s ahead of the playhead and buffered, content is seeked forward to it once (corrected=true); content is never seeked backward. Context carries breakId, cueEndTarget, currentTime, deltaSec (cueEndTarget - currentTime) and corrected."},"DA-RESUME-CATCHUP":{category:"playback",level:"info",summary:"Content began playing behind the ad to reach its resume point. Context carries breakId, startPos, target, remainingAdSec, publishedEnd and clampedStart — clampedStart true means the stream had not published the ideal start position, so playback began late and the alignment loop must make up the difference (the zero-live-headroom case). Its ABSENCE on a live break that resumed short means catch-up never ran at all, which is a different fault from it running and falling short."},"DA-RESUME-TARGET-CLAMPED":{category:"playback",level:"warn",summary:"The computed resume position sat outside the held live window and was clamped to the nearest end of it; context carries breakId, requested, clamped, shortfallSec and bound — 'end' when the target is ahead of the published edge, 'start' when it is behind the live window start (already evicted) — applied only when the gap is at most half the held window, otherwise DA-RESUME-START-CLAMP-SKIPPED is emitted instead. Distinct from DA-RESUME-OFFSET-CLAMPED, which shortens the OFFSET to the ad seconds actually played."},"DA-RESUME-START-CLAMP-SKIPPED":{category:"playback",level:"info",summary:"The resume target sat behind the element's live seekable start by more than half the held window, which cannot be DVR eviction (the element's seekable range disagrees with the adapter timeline); the target was left unchanged and the engine resolved the seek itself. Context carries breakId, requested, seekableStart, behindSec, windowSec and maxBehindSec."},"DA-RESUME-ALIGN-BLOCKED":{category:"playback",level:"warn",summary:"Resume alignment wanted to move content past the live edge and stood down, because no seek can reach media the stream has not published yet; content is left riding the edge and the break-end clamp places it. Context carries target, requested, safeEnd, shortfallSec and remainingSec. Emitted once per break. A persistent shortfall here means the resume target is further ahead than the feed's published edge — typically the player's view of the edge is stale, not that the seek is wrong."},"DA-CONTINUE-PLAYOUT-BEGIN":{category:"playback",level:"info",summary:"continueContentDuringBreak engaged: content keeps PLAYING through the break, hidden and muted, so no resume seek is needed. Context carries breakId, anchor, breakDurationSec and edgeDistanceSec."},"DA-CONTINUE-PLAYOUT-END":{category:"playback",level:"info",summary:"continueContentDuringBreak reached the cut. Context carries driftSec (content position minus where the break says it should be), maxDriftSec, the corrections applied, rateHonoured (false if the engine drove playbackRate itself) and driftUnrecoverable."},"DA-CONTINUE-PLAYOUT-REFUSED":{category:"playback",level:"info",summary:"continueContentDuringBreak was not used this session, so breaks pause content and resume with a seek as before. Emitted once per session; context carries the reason (disabled, not-replacement, format, shared-element, picture-in-picture, single-decoder) and the break format. Its ABSENCE on an eligible session is the signal the mode engaged."},"DA-CONTINUE-PLAYOUT-QUALITY-UNAVAILABLE":{category:"playback",level:"warn",summary:"Content continues through the replacement break without a video-quality constraint, so the content stream may retain its normal bitrate alongside the ad. Context carries breakId and reason (unsupported when the optional Web adapter method is absent, not-applied when the adapter returned false or could not apply the request)."},"DA-CONTINUE-PLAYOUT-DRIFT":{category:"playback",level:"warn",summary:"Content drifted further from the break timeline than the remaining break can remove within the playback-rate bounds, so part of it is carried into the cut. Context carries driftSec, remainingSec, the rate applied and seekIssued (always false: a corrective seek would be clipped)."},"DA-CONTINUE-PLAYOUT-ABANDONED":{category:"playback",level:"warn",summary:"Content could not be kept playing through the break, so it reverted to the pause-and-resume path mid-break. Context carries breakId, the reason and the driftSec at the moment it converted."},"DA-AD-AV-DESYNC":{category:"playback",level:"warn",summary:"The ad player's audio sink was handed a buffer whose timestamp does not continue the audio it has already been fed, so the media clock had to be re-anchored mid-ad. Video is scheduled off that clock while the audio already queued in the output track keeps draining, so every re-anchor pushes the picture further from the sound actually being heard. Context carries breakId, assetId, expectedSec, actualSec, deltaSec (negative = audio running behind the picture) and positionSec. Seen on server-stitched pods whose per-ad audio and video durations do not match; a single event near the end of a pod is the accumulated total, not an isolated glitch."},"DA-AD-PLAYOUT-SYNC":{category:"playback",level:"info",summary:"Per-break summary of ad playout health, emitted once at break end. Context carries podUri (the resolved ad media, so a stitched pod can be fetched and inspected), desyncEvents, maxDesyncSec, droppedFrames, audioUnderruns, audioFormats and videoFormats (the distinct decoder input formats seen during the break — more than one means the stitched stream changed sample rate or codec mid-pod) and frameOffsetMeanMs (mean video frame processing offset; large negative values mean frames were released late against the audio clock)."},"DA-EVENT":{category:"event",level:"info",summary:"An SDK event, recorded into the diagnostic ring buffer so exportDiagnostics() carries one unified timeline of diagnostics and playback events. Raised to error for aderror. Buffer-only: not dispatched to onDiagnostic handlers, which would duplicate the event stream they already receive."},"DA-BREAK-CONTENT-MASK":{category:"break",level:"warn",summary:"The host's content surface cannot follow view transforms (punch-through SurfaceView, e.g. react-native-video's default), so the two-box format masks the backdrop with a transparent hole over the content box instead of reframing the content view. context: format."},"DA-BREAK-FORMAT-DEGRADED":{category:"break",level:"warn",summary:"Split break reframing degraded: the host supplied no content view or sibling container for the ad."},"DA-BREAK-NO-PLAYABLE-ASSET":{category:"break",level:"warn",summary:"A break had nothing to play, so it never began: no adbreakbegin/adbreakend was emitted, content kept playing, and a public aderror (source ad, carrying the break) reports it. context.reason says why: no-variant (none declared), no-qualifying-variant (variant selection - device targeting + format playability - matched nothing and no downgrade applied), no-assets (the selected variant was empty), or lshape-content-skipped (shared-element insertion cannot render a backdrop). This is the BREAK-level outcome; when a particular variant was passed over for an unrecognised format, DA-BREAK-VARIANT-FORMAT-UNKNOWN names that format alongside it. context: breakId, reason, declaredAssetCount, format."},"DA-BREAK-VARIANT-FORMAT-UNKNOWN":{category:"break",level:"warn",summary:"A break variant declares a format this SDK version does not recognise, so it was passed over during variant selection rather than guessed at - an unknown format is never playable, because rendering it as a fullscreen single would be the most invasive possible misreading. Raised once per skipped variant: a break that still has a playable variant plays it and reports this too, so the skip is never silent, and a break left with nothing also reports DA-BREAK-NO-PLAYABLE-ASSET with reason no-qualifying-variant. An ABSENT format is treated identically to an unrecognised one. context: breakId, format (the raw manifest string; empty when the field was absent)."},"DA-AD-STALLED":{category:"playback",level:"warn",summary:"An ad began playing and then stopped advancing: the playhead did not move for the stall threshold while the ad was meant to be playing. context: assetId, breakId, playbackState, stalledForMs, positionMs, bufferedAheadMs, reason."},"DA-AD-FOREGROUND-RESUMED":{category:"playback",level:"info",summary:"An in-flight ad resumed after the app returned to the foreground; context carries the suspended duration and ad position at resume."},"DA-AD-FOCUS-LOST":{category:"playback",level:"warn",summary:"The overlay ad lost permanent audio focus during an active break; the host player must not reclaim focus while the SDK ad is on screen. context: breakId, transient, reason."},"DA-AD-FOCUS-GRANTED":{category:"playback",level:"info",summary:"The overlay ad was granted media audio focus for the break, so system focus semantics (call, duck, permanent loss) apply to ad playback. context: breakId, cause, alreadyHeld."},"DA-AD-FOCUS-DENIED":{category:"playback",level:"warn",summary:"The platform refused the overlay ad's media audio-focus request, so the break plays with no focus of its own: another app's audio can mix over the ad, and a call can neither duck nor pause it. context: breakId, cause."},"DA-AD-FOCUS-ABANDONED":{category:"playback",level:"info",summary:"The overlay ad gave media audio focus back, so the content player's own focus request finds a clean stack. context: breakId, cause."},"DA-BREAK-ABANDONED":{category:"lifecycle",level:"warn",summary:"A break was still in flight when the session was torn down (endSession, destroy, or a startSession over an active session). context: breakId, cause, phase, unbalancedAdBegin, adIndex, totalAds, assetId."},"DA-RENDERER-UNAVAILABLE":{category:"lifecycle",level:"error",summary:"The renderer could not render a break because a required piece of it was not attached (e.g. no ad player), after the SDK had already emitted adbreakbegin — so the break began and will never end. context: breakId, missing."},"DA-SESSION-STARTING":{category:"session",level:"info",summary:"A step of startSession() was entered: begin, manifest-fetch, gam-init or scheduling. Emitted on entry, so the last one recorded names the step a hung startSession never finished. context: step, manifestUrl, elapsedMs. The URL is reported verbatim; the redacted config summary carries only its origin (config.manifestOrigin)."}};
1
+ export const DIAGNOSTIC_CODES={"DA-SESSION-STARTED":{category:"session",level:"info",summary:"Monetization session started; manifest polling began. context: manifestUrl (stitcherUrl in SSAI mode), reported verbatim."},"DA-SESSION-ENDED":{category:"session",level:"info",summary:"Monetization session ended; polling and scheduling stopped."},"DA-ASSET-PARAMETERS-UPDATED":{category:"session",level:"info",summary:"The break manifest's session-level asset parameters changed; the merged parameters were pushed to the active GAM stream. context: source ('manifest'), keys (parameter names only, never values)."},"DA-MANIFEST-FETCH-FAILED":{category:"manifest",level:"error",summary:"Initial break-manifest fetch failed; the session could not start."},"DA-MANIFEST-POLL-FAILED":{category:"manifest",level:"warn",summary:"A manifest poll failed; the SDK keeps the last good manifest and retries."},"DA-MANIFEST-CHANNEL-CHANGED":{category:"manifest",level:"info",summary:"A polled manifest describes a different ads channel (channelId, GAM identity or timebase changed); the SDK re-aligned its ad setup and resolved delivery mode again while the session and content playback continued. context: previousChannelId, channelId, reason, manifestUrl."},"DA-MANIFEST-INTERCEPT-FAILED":{category:"manifest",level:"warn",summary:"The customer manifest-response interceptor threw; the un-modified parsed manifest was used instead."},"DA-MANIFEST-REQUEST-INTERCEPT-FAILED":{category:"manifest",level:"warn",summary:"The customer manifest-request interceptor threw; the normal network fetch of the original URL was used instead."},"DA-MANIFEST-SIGNATURE-INVALID":{category:"manifest",level:"error",summary:"The break-manifest response failed detached-JWS signature verification (missing/malformed X-Manifest-Signature, unsupported alg, unknown kid, unknown critical param, or signature mismatch); the manifest was rejected and no breaks were scheduled. context: url, reason."},"DA-MANIFEST-EVENT-INVALID":{category:"manifest",level:"warn",summary:"A channel event was ignored because its time window or configuration is invalid, or because events are unsupported for the manifest timebase. context: eventId and index when available."},"DA-PDT-MISSING":{category:"playback",level:"warn",summary:"No EXT-X-PROGRAM-DATE-TIME once content is playing (or after the startup backstop window); wallclock-timebase breaks fall back to the system clock."},"DA-ANVATO-CUE-PENDING":{category:"break",level:"info",summary:"ptsSource: 'anvatoCue' — no Anvato in-stream cue observed yet for a PTS break; the break stays pending until its cue arrives."},"DA-ANVATO-CUE-MATCHED":{category:"break",level:"info",summary:"ptsSource: 'anvatoCue' — a PTS break's start was matched to an observed Anvato cue and scheduled at the cue's media time."},"DA-ANVATO-CUE-ENTERED":{category:"break",level:"info",summary:"ptsSource: 'anvatoCue' — a break was started by the cue reaching the playhead rather than by the scheduler's 250ms tick; context carries the breakId, the cue pts and the media time it fired at, so the two start paths are distinguishable in the field."},"DA-ANVATO-CUE-OBSERVED":{category:"break",level:"info",summary:"ptsSource: 'anvatoCue' — an Anvato break-signaling (type=cue) frame was observed in the stream; context carries the cue's pts, the media time it landed at, whether the tracker recorded it, and the raw payload — so a manifest-PTS vs in-stream-PTS misalignment is observable in the field."},"DA-ANVATO-CUE-SEGMENT-ANCHORED":{category:"break",level:"warn",summary:"ptsSource: 'anvatoCue' — an Anvato emsg cue arrived without a ptsOffset from the adapter, so its break is scheduled at the cue's carrying segment start, which can be up to one segment early. Emitted once per session; context: pts, mediaTime."},"DA-ANVATO-CUE-OFFSET-REJECTED":{category:"break",level:"warn",summary:"ptsSource: 'anvatoCue' — the adapter's ptsOffset placed an Anvato cue outside its carrying segment's window (more than 0.1s before or 15s after the cue startTime), so the cue's startTime is used instead. Emitted once per cue pts; context: pts, startTime, ptsOffset, mappedTime."},"DA-ANVATO-CUE-END-MATCHED":{category:"break",level:"info",summary:"ptsSource: 'anvatoCue' — the active break's Anvato type=cue_end was observed and its length on the stream clock (cue_end pts minus the break start pts) is within 2s of the break duration. Emitted once per break; context: breakId, mediaTime (where the player reported the cue_end), lengthSec, durationSec."},"DA-ANVATO-CUE-END-REJECTED":{category:"break",level:"warn",summary:"ptsSource: 'anvatoCue' — an Anvato type=cue_end was observed for the active break but its stream-clock length differs from the break duration by more than 2s, so it is ignored and the resume keeps its computed target. Emitted once per break; context: breakId, mediaTime, lengthSec, durationSec."},"DA-PRELOAD-FAILED":{category:"preload",level:"warn",summary:"Ad preload failed; the asset will be loaded on demand at break start."},"DA-PRELOAD-MODE-RESOLVED":{category:"preload",level:"info",summary:"The configured ad preload mode was resolved for this session; context carries both the configured and the resolved mode."},"DA-PRELOAD-PATH":{category:"preload",level:"info",summary:"The preload path actually taken for a break's ad (parallel buffer / detached prefetch / first-frame warm-up on the ad player / none) and the creative container (stream vs progressive)."},"DA-BREAK-EARLY-RETURN":{category:"break",level:"info",summary:"The active break was removed from a polled manifest (early return); the break ends immediately and content resumes at break start plus the seconds already played."},"DA-BREAK-WINDOW-ESCAPED":{category:"break",level:"warn",summary:"An active wallclock break outlived its window on the stream clock (ad stall, bogus trigger position, or a re-fired completed break); the SDK ended it and returned to content. context.overrunSec says by how much."},"DA-BREAK-EVENT-UNSUPPORTED":{category:"break",level:"warn",summary:"A break is triggered by a spec event this SDK version does not schedule on this platform (web schedules `start`, `pause` and `end`; Android and iOS do not schedule `end` yet); the break was ignored. context.event names the event."},"DA-BREAK-SUPPRESSED-OVERLAP":{category:"break",level:"warn",summary:"A break was suppressed because an ad was already playing."},"DA-BREAK-TRANSITION":{category:"break",level:"info",summary:"Measured duration of a playback transition into an ad break, between two ads, between chained breaks, or back to content. A break-to-break switch runs from the outgoing ad's end to the incoming ad's first frame and adds path (queued, late-queued or cold) and, when the incoming ad was buffered, leadMs. On web an ad-to-ad switch adds path (queued or cold) and leadMs too."},"DA-BREAK-CHAIN":{category:"chaining",level:"info",summary:"Summary of one chain of back-to-back breaks, emitted once when content plays again (or the chain is flushed): chainId, per break its id, scheduledStart, plannedDurationSec, beganAtMs, endedAtMs, playedSec, announcedDuringChain and path, per switch its gapMs and path, contentResumeMs and totalMs."},"DA-AD-SURFACE-REVEALED":{category:"break",level:"info",summary:"The ad surface became visible: how long it was held back waiting for the ad's first frame, and whether it was revealed because that frame arrived or because the wait timed out. On web, an ad shown before its first frame reports reason shown-before-frame with visibleGapMs, the time on screen without a picture."},"DA-BREAK-CUT-LATE":{category:"break",level:"warn",summary:"timebase: 'wallclock', all platforms — content was cut more than 0.5s after the break's manifest start on the stream's Program Date Time, so the viewer saw the stream's own break (slate) instead of the ad until then; typically the ad's first frame was not ready at the cut and content kept playing under the cross-fade. The replaced window is unaffected: the resume anchor is the content time of the manifest start whatever the cut landed on. Context carries breakId, lateSec (cut minus start on the PDT axis), start (the manifest start), cutPdt (the PDT at the cut), cutAt (currentTime at the cut) and anchor; iOS/Android add waitedForAdMs when the cut waited for the ad surface."},"DA-PREROLL-CONTENT-HELD":{category:"break",level:"info",summary:"Content playback was held at session start until a pending pre-roll began, so no content is shown before the ad."},"DA-PREROLL-CONTENT-WAIT-TIMEOUT":{category:"break",level:"info",summary:"A pending pre-roll began after content readiness was not reported within the wait timeout."},"DA-PREROLL-CANCELLED-CONTENT-ERROR":{category:"break",level:"warn",summary:"A pending pre-roll was cancelled because the content failed to load before it could begin."},"DA-SHARED-ELEMENT-UNSUPPORTED":{category:"break",level:"warn",summary:"Configured shared-element insertion is unsupported on this platform (non-iPhone/iPod); fell back to overlay insertion."},"DA-SHARED-ELEMENT-RESTORE-FAILED":{category:"playback",level:"error",summary:"Content did not resume after a shared-element break: the reload/seek/play restore failed twice; the viewer is left paused on the handed-back element."},"DA-IMAGE-LOAD-FAILED":{category:"break",level:"warn",summary:"An image (companion, backdrop or image ad) could not be fetched or decoded within the timeout; the break continues without it."},"DA-PIP-TRANSFER-FAILED":{category:"break",level:"warn",summary:"The picture-in-picture window could not be moved between the content and ad elements; the break continues but the viewer may not see the ad in the PiP window."},"DA-PIP-AUTODETECT-UNAVAILABLE":{category:"break",level:"warn",summary:"No Activity could be resolved from the renderer's Context or the overlay's view tree, so picture-in-picture cannot be detected automatically; the host must call OptiViewAds.setPictureInPicture() from Activity.onPictureInPictureModeChanged or breaks will be laid out for a fullscreen surface. Android only."},"DA-CONTENT-ELEMENT-SWAPPED":{category:"break",level:"info",summary:"The content player replaced its <video> element; the SDK re-bound its presentation listeners to the new one."},"DA-PIP-FORMAT-OVERRIDE":{category:"break",level:"info",summary:"The content player is in picture-in-picture, so the break's declared format was overruled and it plays as a single fullscreen ad."},"DA-PIP-ADOPTION-STATE":{category:"break",level:"info",summary:"Native PiP reconciliation deferred or reused a layout/handoff decision. Context carries reason, active, adPlaying, applied, and asset/break IDs when available; this is not evidence that a format override occurred."},"DA-PIP-HANDOFF":{category:"break",level:"info",summary:"The picture-in-picture handoff route chosen for the ad: 'layer-swap' (the presented AVPlayerLayer is re-pointed at the ad player) or 'borrow' (the ad plays through the content player). context: route, layers. iOS only."},"DA-PIP-LAYER-SWAP":{category:"break",level:"debug",summary:"Read-back check after a PiP layer-swap: whether the presented layer still points at the ad player after the re-point. context: held, layers. iOS only."},"DA-PIP-PRESENTED":{category:"break",level:"debug",summary:"Status trace of the player on the PiP-presented layer during a layer-swap: owner (ad/content/other) and time-control-status transitions, plus ad-item ends observed while presented. context: owner/status, or errored/reachedEnd/adStatus. iOS only."},"DA-CHAIN-RESOLVER-ERROR":{category:"chaining",level:"warn",summary:"The chained-successor resolver threw; chaining was skipped for this break."},"DA-GAM-NO-ASSET-KEY":{category:"gam",level:"warn",summary:"Retired: the GAM stream identity now comes from the manifest's vendorConfiguration. Kept declared so the code is never reused; see DA-GAM-CONFIG-MISSING."},"DA-GAM-SESSION-FAILED":{category:"gam",level:"error",summary:"The GAM/IMA session failed to initialize; GAM breaks will not serve."},"DA-GAM-SESSION-PRELOADED":{category:"gam",level:"info",summary:"A GAM/IMA session was preloaded for the next event; context includes the event boundary and GAM pod identity."},"DA-GAM-START-DEFERRED":{category:"gam",level:"info",summary:"The SGAI IMA stream request is deferred until the configured ad start delay has been played; context includes adStartDelaySec."},"DA-GAM-CONFIG-RESOLVED":{category:"gam",level:"info",summary:"The GAM stream identity for this session was resolved from the manifest's vendorConfiguration."},"DA-GAM-CONFIG-MISSING":{category:"gam",level:"error",summary:'The break manifest carries no usable "gam" vendorConfiguration entry; GAM assets are skipped.'},"DA-GAM-POD-IDENTITY-MISMATCH":{category:"gam",level:"error",summary:"A GAM pod asset's vendorParameters name a different network code or custom asset key than the stream session was created with; the asset is skipped because the pod request cannot serve."},"DA-GAM-POD-MID-BREAK-END":{category:"gam",level:"warn",summary:"IMA reported the ad break ended before the pod's last ad while pod stream remains; per-ad reporting continues until the pod ends."},"DA-GAM-DUPLICATE-METADATA":{category:"gam",level:"info",summary:"The stream carries the same ad marker more than once at the same time (for example in both the audio and video renditions of an fMP4 stream); the duplicate was not passed to IMA, so each ad event fires once. Reported once per stream session."},"DA-VENDOR-CONFIG-UNKNOWN-TYPE":{category:"manifest",level:"info",summary:"One or more vendorConfiguration entries declare a type this SDK version does not recognise and were ignored."},"DA-EXTERNAL-VENDOR-INVALID":{category:"manifest",level:"warn",summary:"External vendorConfiguration entries were ignored because provider was blank or assetParameters was not an object. context: count."},"DA-EXTERNAL-VENDOR-DUPLICATE":{category:"manifest",level:"warn",summary:"External vendorConfiguration entries repeated a provider; the first valid entry was used. context: providers."},"DA-CONTENT-PLAYBACK-ERROR":{category:"playback",level:"error",summary:"The content player reported a playback error."},"DA-EXTERNAL-PLAYBACK-CHANGED":{category:"playback",level:"info",summary:"The content player's external (AirPlay) playback state changed; context carries the new state and the target."},"DA-EXTERNAL-PLAYBACK-BLOCKED":{category:"playback",level:"warn",summary:"AirPlay was requested while an ad break is active or about to start; the content player stays on the device and the request is retried when the break ends."},"DA-SSB-SWITCH-FAILED":{category:"playback",level:"warn",summary:"Switching the content player to the SSB stream for AirPlay failed (context.reason: no-restore-source, load-error, load-timeout, external-not-active or receiver-paused); the SDK restores the previous content."},"DA-SSB-RESTORE-FAILED":{category:"playback",level:"error",summary:"The previous content source could not be reloaded after the SSB stream (AirPlay ended or the switch failed); the session stays in ssb delivery until the app reloads its content."},"DA-EXTERNAL-PLAYBACK-ALLOWED":{category:"playback",level:"info",summary:"An AirPlay request passed the ad-break guard; context.trigger says whether it was the request itself or the retry after a break."},"DA-CONTENT-RESUME-STALLED":{category:"playback",level:"warn",summary:"Content did not resume within the watchdog window after a break that paused it ended; the SDK re-issued play() once. iOS only for now."},"DA-CONTENT-RECOVERY-MODE-RESOLVED":{category:"playback",level:"info",summary:"The resolved post-break content recovery mode for the session (recreate or none); context carries configured and resolved."},"DA-CONTENT-PIPELINE-RECREATED":{category:"playback",level:"info",summary:"The content player's media pipeline was rebuilt at break end before content resumed (recovery mode recreate); context carries breakId, startTime and durationMs."},"DA-CONTENT-PIPELINE-RECREATE-FAILED":{category:"playback",level:"warn",summary:"Rebuilding the content media pipeline at break end failed or timed out — or the adapter does not implement recreateMediaPipeline() (reason 'unsupported-adapter', e.g. a wrapper adapter that does not forward it); the SDK fell back to resuming in place with seek + play; context carries breakId, startTime, reason."},"DA-AD-PLAYBACK-ERROR":{category:"playback",level:"error",summary:"The ad player reported a playback error during a break."},"DA-AD-LOAD-RETRIED":{category:"playback",level:"warn",summary:'The ad player\'s load() had not settled within the retry window of the ad-start budget and the ad element showed no progress (readyState 0, nothing buffered), so a second load() was issued for the same URI; a slow-but-progressing load is not retried. Context carries breakId, assetId, uri, elapsedMs, remainingBudgetMs. A still-stalled retry ends as DA-AD-PLAYBACK-ERROR "Ad load timeout".'},"DA-AD-URI-MISSING":{category:"playback",level:"error",summary:"The ad asset had no usable media URI, VAST tag URL or render surface; reported as CMCD adec."},"DA-AD-MEDIA-LOAD-FAILED":{category:"playback",level:"error",summary:"The ad player could not fetch the ad media (network or HTTP failure); reported as CMCD adec."},"DA-AD-MEDIA-UNSUPPORTED":{category:"playback",level:"error",summary:"The ad player could not decode the ad media or does not support its format; reported as CMCD adec."},"DA-AD-START-TIMEOUT":{category:"playback",level:"error",summary:"The ad did not load, render a first frame or start within its start budget; reported as CMCD adec."},"DA-AD-START-INTERRUPTED":{category:"playback",level:"warn",summary:"The ad element's play() was interrupted by a browser-initiated pause before the ad started (Chromium AbortError, seen on Samsung Tizen); the SDK re-issued play() once. context: breakId, error."},"DA-AD-DURATION-PREPARED":{category:"playback",level:"info",summary:"The ad media for a break was prepared and its real playable duration is now known, BEFORE the first frame. context: breakId, assetId, index, total, preparedDurationSec (the loaded media's own duration — on a GAM pod, the stitched pod's length), declaredDurationSec (what the manifest said about this asset, when it said anything) and breakDurationSec (the slot the break declares). Emitted per asset, so a multi-asset break reports one per asset and the break total is their sum. The three together separate a short break caused by a short POD from one caused by a short request or a late join."},"DA-DELIVERY-MODE-RESOLVED":{category:"session",level:"info",summary:"Delivery mode (sgai/ssai/ssb) resolved for the session at start and again on an ads-channel switch from the manifest's delivery rules (or the explicit client config), with the detected device profile; context.source is external-playback or external-playback-ended when AirPlay switched the session to the SSB stream and back."},"DA-TARGETING-VALUE-UNKNOWN":{category:"manifest",level:"warn",summary:"A targeting value is not recognized and the targeted entry does not match."},"DA-TARGETING-FIELD-UNKNOWN":{category:"manifest",level:"warn",summary:"A targeting field is not recognized and the targeted entry does not match."},"DA-TARGETING-INVALID":{category:"manifest",level:"warn",summary:"A targeting constraint is malformed or incomplete and the targeted entry does not match."},"DA-DELIVERY-MODE-UNKNOWN":{category:"session",level:"warn",summary:"The matching delivery rule carried an unrecognized mode value; sgai is used (forward compatibility)."},"DA-DELIVERY-MODE-OVERRIDDEN":{category:"session",level:"info",summary:"The manifest's delivery rules resolved a different mode, but the explicit client config takes precedence."},"DA-DELIVERY-MODE-CHANGE-IGNORED":{category:"session",level:"warn",summary:"An ordinary manifest poll resolves a different delivery mode; the mode pinned for the session stays in force. An ads-channel switch resolves the mode again."},"DA-SSAI-UNAVAILABLE":{category:"session",level:"error",summary:"The manifest selected ssai delivery but no vendor configuration can provide a stitched stream (no gam entry with an assetKey); at start the session fails, while on a channel switch the session stays in sgai."},"DA-SSAI-SESSION-FAILED":{category:"session",level:"error",summary:"The SSAI session failed to start (IMA stream init, stream id, or stitched-stream load)."},"DA-SSAI-IMA-ERROR":{category:"gam",level:"error",summary:"IMA reported an error during the SSAI stream session."},"DA-INSERTION-TYPE-RESOLVED":{category:"session",level:"info",summary:"Per-session ad insertion type resolved, and whether the integrator set it or left it unset (unset lets the manifest's resumeOffset drive the resume point)."},"DA-RESUME-OFFSET-CLAMPED":{category:"break",level:"info",summary:"The resume offset was shortened to the ad duration actually played, so the break could not skip further than the ads it delivered."},"DA-INSERTION-TYPE-IGNORED-SSAI":{category:"session",level:"warn",summary:"adInsertionType is ignored in SSAI mode; the stitcher controls ad insertion server-side."},"DA-VAST-UNSUPPORTED-FORMAT":{category:"break",level:"warn",summary:"A VAST asset appeared in an unsupported break format; VAST is only supported in single, double, and lshape_ad. The break was skipped."},"DA-ASSET-MACRO-UNKNOWN":{category:"break",level:"warn",summary:"An asset parameter value contained a macro the SDK has no value for (an unknown or unavailable OptiView macro, or a registered customer macro that returned no value); the parameter was still sent, with the macro kept as its literal token. Raised once per parameter key and macro. context: key, macro, breakId, assetId."},"DA-ASSET-PARAMETER-OMITTED":{category:"break",level:"info",summary:"An asset parameter value contained a customer macro that is empty (value `null`), so the parameter was not sent; for GAM `cust_params`, and for a static-asset value with a literal `&`, only the `&`-separated pair containing the macro was dropped. Raised once per parameter key and macro (per dropped pair when the value is split into pairs). context: key, macro, pair (split values only), breakId, assetId."},"DA-VAST-SSAI-UNSUPPORTED":{category:"session",level:"warn",summary:"VAST assets are not supported in SSAI mode (VAST is SGAI-only); the asset was skipped."},"DA-VAST-IMA-ERROR":{category:"gam",level:"error",summary:"Google IMA reported an error while loading or playing a VAST (client-side / CSAI) ad."},"DA-VAST-NO-FILL":{category:"gam",level:"error",summary:"The VAST ad server returned no ad (empty response, no ads after wrappers or no assets); reported as CMCD adec."},"DA-VAST-TIMEOUT":{category:"gam",level:"error",summary:"The VAST response or its media file did not load in time; reported as CMCD adec."},"DA-VAST-MALFORMED":{category:"gam",level:"error",summary:"The VAST response could not be parsed or uses an unsupported VAST version; reported as CMCD adec."},"DA-VAST-REQUEST-FAILED":{category:"gam",level:"error",summary:"The VAST ad request failed (network error, invalid tag URL, wrapper error or too many redirects); reported as CMCD adec."},"DA-VAST-CREATIVE-FAILED":{category:"gam",level:"error",summary:"The VAST creative could not be played (no compatible media file, playback error or trafficking error); reported as CMCD adec."},"DA-VAST-IMA-SDK-MISSING":{category:"gam",level:"error",summary:"The Google IMA client-side SDK (ima3.js) is unavailable; VAST (CSAI) ads cannot be played."},"DA-PAUSE-AD-SHOWN":{category:"break",level:"info",summary:"A pause ad (full-screen image or video) was shown while content is paused."},"DA-PAUSE-AD-DISMISSED":{category:"break",level:"info",summary:"A pause ad was dismissed (content resumed, or the duration cap elapsed)."},"DA-PAUSE-AD-RESUME-ALLOWED":{category:"break",level:"info",summary:"The viewer may now resume content over the shown pause ad: the break's controls.skipOffset elapsed, or (no skipOffset) the ad was watched fully: a video creative ended, an image reached its duration cap or has none. context: breakId."},"DA-PAUSE-AD-RESUME-BLOCKED":{category:"break",level:"info",summary:"Content tried to resume while a pause ad must still be watched (controls.skipOffset not reached, or no skipOffset and the video creative has not ended / the image duration cap has not elapsed); the SDK keeps content paused. context: breakId, elapsedSec, skipOffset."},"DA-PAUSE-AD-DVR-EXPIRED":{category:"break",level:"info",summary:"The viewer paused for longer than the DVR window is deep, so the position they paused at aged out and playback resumed at the live edge instead. context: pinnedPosition, liveEdge."},"DA-PAUSE-AD-NO-ASSET":{category:"break",level:"warn",summary:"A pause break had no usable image or video asset (no first asset, unsupported media type, or no resolvable VAST creative); the pause ad was skipped."},"DA-PAUSE-AD-SSAI-UNSUPPORTED":{category:"session",level:"warn",summary:"Pause ads are SGAI-only and not supported in SSAI mode; the pause break was skipped."},"DA-MANIFEST-POLLED":{category:"manifest",level:"info",summary:"A manifest poll refresh succeeded (cadence follows the manifest polling config)."},"DA-AD-SKIPPED":{category:"playback",level:"info",summary:"The viewer skipped the active ad break (controls.skipOffset honored)."},"DA-AD-SKIP-SUPPRESSED":{category:"playback",level:"info",summary:"A skip request was suppressed (no skipOffset declared, or requested before the offset)."},"DA-AD-CLICKED":{category:"playback",level:"info",summary:"The viewer clicked the ad on screen (adclick emitted)."},"DA-LIVE-START-PUSHBACK":{category:"playback",level:"info",summary:"Initial live playback requested a backward seek to the configured target-duration distance. Context includes enabledBy (always config), targetDurationSec, targetDurationSource, initialOffsetSec, initialOffsetTargetDurations, requestedOffsetSec, requestedOffsetTargetDurations, targetOffsetSec, targetOffsetTargetDurations, rewindSec, rewindTargetDurations, target and windowClamped. This is a request, not proof of the landing."},"DA-LIVE-START-PUSHBACK-SKIPPED":{category:"playback",level:"info",summary:"Initial live playback was left unchanged. The reason identifies a disabled adjustment (liveStartPushback.enabled is not true; enabledBy is always config), an already sufficient offset, missing target duration or seekable range, invalid configuration, or no safe backward target. Available target-duration and offset measurements are included."},"DA-LIVE-START-PUSHBACK-LANDED":{category:"playback",level:"info",summary:"Measured initial-live seek landing. Context includes the requested target and targetDurationSec, landed, errorSec, liveEdgeAtLanding, landedOffsetSec and landedOffsetTargetDurations. A timeout or failed seek reports landed=null, never an inferred success."},"DA-RESUME-SEEK":{category:"playback",level:"info",summary:"Content was resume-seeked to the resolved post-break position (insertion type policy)."},"DA-RESUME-UNADDRESSABLE":{category:"playback",level:"warn",summary:"A break played through the content player (picture-in-picture), so content came back on a reloaded source whose timeline has its own origin, and that source published neither a program-date-time nor a seekable range to re-address the resume point against. Content stays where the reload left it — near the live edge — rather than being seeked to a position that does not exist on the new timeline. Context carries breakId, target (the position on the pre-borrow timeline) and offset."},"DA-RESUME-LANDED":{category:"playback",level:"info",summary:"Where the post-break resume-seek actually landed, measured on the seeked event rather than inferred: context carries breakId, target (the position requested), landed and errorSec (landed - target; negative means the player settled EARLIER than asked). errorSec only says whether the SEEK did what it was asked: when the live-window clamp moved the seek, policyTarget is the resume point before the clamp and policyErrorSec (landed - policyTarget) is how far the viewer really is from it. landed is null with a reason when no seeked event arrived, which is normal for a seek to the position the playhead already holds. Report-only: the SDK does not correct the position."},"DA-RESUME-PREPARED":{category:"playback",level:"info",summary:"Android, live break that resumes at its end — the paused content was parked exactly on the resume point before the hand-back, so the hand-back only plays (DA-RESUME-SEEK then reports prepared=true and issues no seek). Context carries breakId, target, source (cue_end when the stream's matched type=cue_end was known, else cue+duration) leadMs (how long before the expected hand-back it was parked) and refresh (true when content parked long before the hand-back was seeked onto the same point again, 4.5s before it). A later cue_end parks content again."},"DA-RESUME-PREPOSITIONED":{category:"playback",level:"info",summary:"The break resumed without a seek: content was moved onto its resume position DURING the break, so the transition needed no jump. Context carries breakId, target, prepositionedTo, landed, shortfallSec and exact. exact=true means it reached the policy target. exact=false means the live window never published those frames, so content was moved as close as exists — the viewer lands short, but arrives already in place rather than via a visible seek at the cut."},"DA-RESUME-PTS-MAP":{category:"playback",level:"info",summary:"ptsSource: 'anvatoCue', iOS/tvOS and web — the live resume point was mapped onto currentTime through the stream's own clock: the Anvato type=beacon tags delivered since the run-up's last seek give the currentTime ↔ stream-clock offset, and the resume point (the matched cue_end, else the cue plus the break duration) is converted with it. Reported when a mapping is first available after a seek and whenever the mapped target moves by 0.1s or more. Context carries breakId, target, landingStreamSec, landingSource (cue_end or cue+duration), offsetSec, beacons (beacons averaged), generation (how often the mapping started over since the session began), currentTime, and computedTarget with deltaSec (target - computedTarget) when a currentTime-based target exists."},"DA-RESUME-PTS-REMAP":{category:"playback",level:"warn",summary:"ptsSource: 'anvatoCue', iOS/tvOS and web — a stream beacon disagreed with the currentTime ↔ stream-clock mapping by more than 0.2s, so the player re-anchored currentTime (a variant switch or a buffer restart); the mapping starts over from that beacon and the resume point is mapped again. Reported during the resume run-up and after the hand-back. Context carries breakId, fromOffsetSec, toOffsetSec, deltaSec, currentTime and stage (run-up or after-hand-back)."},"DA-RESUME-PTS-CORRECTED":{category:"playback",level:"info",summary:"ptsSource: 'anvatoCue', iOS/tvOS and web — once per break at the hand-back, on a stream that carries Anvato beacons: whether the stream clock placed the live resume point, and by how much it moved it. applied=true: streamClockTarget is the resume point mapped through the beacons, correctionSec is streamClockTarget - computedTarget (the currentTime target, cue plus duration), and currentTimeShiftSec is how far the same stream instant moved in currentTime between the pause and the hand-back (negative: it now sits earlier), null when no beacon mapped the stream before the pause. Context also carries breakId, landingSource (cue_end or cue+duration), landingStreamSec, offsetSec, beacons, remaps (DA-RESUME-PTS-REMAP during the break) and cueEndTarget when a cue_end was matched. applied=false with a reason means no beacon arrived after the run-up's last seek, so the cue_end or currentTime target applied."},"DA-RESUME-PTS-LANDED":{category:"playback",level:"info",summary:"ptsSource: 'anvatoCue', iOS/tvOS and web — where a stream-clock resume landed, measured on the stream's own clock from the beacons delivered after the hand-back: landedStreamSec is the position content resumed from (resumedAt, the seek landing or the playhead at a seek-free hand-back) converted with that mapping, and errorSec is landedStreamSec - landingStreamSec (negative: content resumed before the stream's resume point, so slate is shown). Context carries breakId, landingStreamSec, landingSource, resumedAt, sinceHandBackSec and, when measured, landedStreamSec, errorSec, offsetSec and beacons; reason when no beacon arrived within 15s. Report-only: the SDK does not correct the position from it."},"DA-RESUME-PDT-MAP":{category:"playback",level:"info",summary:"timebase: 'wallclock', all platforms — the live resume point (the manifest start plus duration, a wallclock instant) was mapped onto currentTime through the Program Date Time the content player reports now, so a currentTime re-anchored by a seek during the break cannot move it. Reported when the run-up first reads the target and whenever the mapped target moves by 0.1s or more (remapped=true: currentTime moved against the stream). Context carries breakId, target, landingPdt (the break end, ISO-8601), pdtOffsetSec (PDT minus currentTime, seconds), currentTime, remapped, and computedTarget with deltaSec (target - computedTarget) when an anchor-based target exists."},"DA-RESUME-PDT-CORRECTED":{category:"playback",level:"info",summary:"timebase: 'wallclock', all platforms — once per break at the hand-back of a break anchored on the Program Date Time: whether the stream clock placed the live resume point, and by how much it moved it. applied=true: pdtTarget is the break end mapped through the PDT the player reports at the hand-back, correctionSec is pdtTarget - computedTarget (the anchor plus the offset) and currentTimeShiftSec is how far the same stream instant moved in currentTime between the cut and the hand-back (negative: it now sits earlier). applied=false with a reason means no PDT sample was available at the hand-back, so the anchor-based target applied. Context also carries breakId and computedTarget."},"DA-RESUME-PDT-LANDED":{category:"playback",level:"info",summary:"timebase: 'wallclock', all platforms — where a Program-Date-Time resume landed, measured on the stream's own clock from the first position sample after the hand-back: errorSec is the PDT content resumed at minus the break end (negative: content resumed before the break end, so the stream's own break is shown; positive: post-break content was skipped). Context carries breakId, landingPdt (the break end), landedPdt, landedAt (currentTime) and sinceHandBackSec; reason when no sample carried a PDT within 2s. Report-only: the SDK does not correct the position from it."},"DA-RESUME-CUE-END":{category:"playback",level:"info",summary:"ptsSource: 'anvatoCue', iOS/tvOS, web and Android — the stream's matched type=cue_end replaced the computed resume target: the slate under the ad ends there, not at cue plus the advertised duration (150.206s for a 150s break on NFL Channel), and the player can remap its timeline while content is held, so the cue_end is reported in the current mapping. Context carries breakId, computedTarget, cueEndTarget, deltaSec (cueEndTarget - computedTarget), stage (hold, playing or hand-back; Android: always hand-back) and corrected (whether an in-buffer correction seek ran). Only a policy that resumes at the break end is replaced; otherwise applied=false and only the delta is reported."},"DA-RESUME-CUE-END-LATE":{category:"playback",level:"info",summary:"ptsSource: 'anvatoCue', iOS/tvOS and Android — the break's type=cue_end was matched only after the hand-back. When it is more than 1s ahead of the playhead and buffered, content is seeked forward to it once (corrected=true); content is never seeked backward. Context carries breakId, cueEndTarget, currentTime, deltaSec (cueEndTarget - currentTime) and corrected."},"DA-RESUME-CATCHUP":{category:"playback",level:"info",summary:"Content began playing behind the ad to reach its resume point. Context carries breakId, startPos, target, remainingAdSec, publishedEnd and clampedStart — clampedStart true means the stream had not published the ideal start position, so playback began late and the alignment loop must make up the difference (the zero-live-headroom case). Its ABSENCE on a live break that resumed short means catch-up never ran at all, which is a different fault from it running and falling short."},"DA-RESUME-TARGET-CLAMPED":{category:"playback",level:"warn",summary:"The computed resume position sat outside the held live window and was clamped to the nearest end of it; context carries breakId, requested, clamped, shortfallSec and bound — 'end' when the target is ahead of the published edge, 'start' when it is behind the live window start (already evicted) — applied only when the gap is at most half the held window, otherwise DA-RESUME-START-CLAMP-SKIPPED is emitted instead. Distinct from DA-RESUME-OFFSET-CLAMPED, which shortens the OFFSET to the ad seconds actually played."},"DA-RESUME-START-CLAMP-SKIPPED":{category:"playback",level:"info",summary:"The resume target sat behind the element's live seekable start by more than half the held window, which cannot be DVR eviction (the element's seekable range disagrees with the adapter timeline); the target was left unchanged and the engine resolved the seek itself. Context carries breakId, requested, seekableStart, behindSec, windowSec and maxBehindSec."},"DA-RESUME-ALIGN-BLOCKED":{category:"playback",level:"warn",summary:"Resume alignment wanted to move content past the live edge and stood down, because no seek can reach media the stream has not published yet; content is left riding the edge and the break-end clamp places it. Context carries target, requested, safeEnd, shortfallSec and remainingSec. Emitted once per break. A persistent shortfall here means the resume target is further ahead than the feed's published edge — typically the player's view of the edge is stale, not that the seek is wrong."},"DA-CONTINUE-PLAYOUT-BEGIN":{category:"playback",level:"info",summary:"continueContentDuringBreak engaged: content keeps PLAYING through the break, hidden and muted, so no resume seek is needed. Context carries breakId, anchor, breakDurationSec and edgeDistanceSec."},"DA-CONTINUE-PLAYOUT-END":{category:"playback",level:"info",summary:"continueContentDuringBreak reached the cut. Context carries driftSec (content position minus where the break says it should be), maxDriftSec, the corrections applied, rateHonoured (false if the engine drove playbackRate itself) and driftUnrecoverable."},"DA-CONTINUE-PLAYOUT-REFUSED":{category:"playback",level:"info",summary:"continueContentDuringBreak was not used this session, so breaks pause content and resume with a seek as before. Emitted once per session; context carries the reason (disabled, not-replacement, format, shared-element, picture-in-picture, single-decoder) and the break format. Its ABSENCE on an eligible session is the signal the mode engaged."},"DA-CONTINUE-PLAYOUT-QUALITY-UNAVAILABLE":{category:"playback",level:"warn",summary:"Content continues through the replacement break without a video-quality constraint, so the content stream may retain its normal bitrate alongside the ad. Context carries breakId and reason (unsupported when the optional Web adapter method is absent, not-applied when the adapter returned false or could not apply the request)."},"DA-CONTINUE-PLAYOUT-DRIFT":{category:"playback",level:"warn",summary:"Content drifted further from the break timeline than the remaining break can remove within the playback-rate bounds, so part of it is carried into the cut. Context carries driftSec, remainingSec, the rate applied and seekIssued (always false: a corrective seek would be clipped)."},"DA-CONTINUE-PLAYOUT-ABANDONED":{category:"playback",level:"warn",summary:"Content could not be kept playing through the break, so it reverted to the pause-and-resume path mid-break. Context carries breakId, the reason and the driftSec at the moment it converted."},"DA-AD-AV-DESYNC":{category:"playback",level:"warn",summary:"The ad player's audio sink was handed a buffer whose timestamp does not continue the audio it has already been fed, so the media clock had to be re-anchored mid-ad. Video is scheduled off that clock while the audio already queued in the output track keeps draining, so every re-anchor pushes the picture further from the sound actually being heard. Context carries breakId, assetId, expectedSec, actualSec, deltaSec (negative = audio running behind the picture) and positionSec. Seen on server-stitched pods whose per-ad audio and video durations do not match; a single event near the end of a pod is the accumulated total, not an isolated glitch."},"DA-AD-PLAYOUT-SYNC":{category:"playback",level:"info",summary:"Per-break summary of ad playout health, emitted once at break end. Context carries podUri (the resolved ad media, so a stitched pod can be fetched and inspected), desyncEvents, maxDesyncSec, droppedFrames, audioUnderruns, audioFormats and videoFormats (the distinct decoder input formats seen during the break — more than one means the stitched stream changed sample rate or codec mid-pod) and frameOffsetMeanMs (mean video frame processing offset; large negative values mean frames were released late against the audio clock)."},"DA-EVENT":{category:"event",level:"info",summary:"An SDK event, recorded into the diagnostic ring buffer so exportDiagnostics() carries one unified timeline of diagnostics and playback events. Raised to error for aderror. Buffer-only: not dispatched to onDiagnostic handlers, which would duplicate the event stream they already receive."},"DA-BREAK-CONTENT-MASK":{category:"break",level:"warn",summary:"The host's content surface cannot follow view transforms (punch-through SurfaceView, e.g. react-native-video's default), so the two-box format masks the backdrop with a transparent hole over the content box instead of reframing the content view. context: format."},"DA-BREAK-FORMAT-DEGRADED":{category:"break",level:"warn",summary:"Split break reframing degraded: the host supplied no content view or sibling container for the ad."},"DA-BREAK-NO-PLAYABLE-ASSET":{category:"break",level:"warn",summary:"A break had nothing to play, so it never began: no adbreakbegin/adbreakend was emitted, content kept playing, and a public aderror (source ad, carrying the break) reports it. context.reason says why: no-variant (none declared), no-qualifying-variant (variant selection - device targeting + format playability - matched nothing and no downgrade applied), no-assets (the selected variant was empty), or lshape-content-skipped (shared-element insertion cannot render a backdrop). This is the BREAK-level outcome; when a particular variant was passed over for an unrecognised format, DA-BREAK-VARIANT-FORMAT-UNKNOWN names that format alongside it. context: breakId, reason, declaredAssetCount, format."},"DA-BREAK-VARIANT-FORMAT-UNKNOWN":{category:"break",level:"warn",summary:"A break variant declares a format this SDK version does not recognise, so it was passed over during variant selection rather than guessed at - an unknown format is never playable, because rendering it as a fullscreen single would be the most invasive possible misreading. Raised once per skipped variant: a break that still has a playable variant plays it and reports this too, so the skip is never silent, and a break left with nothing also reports DA-BREAK-NO-PLAYABLE-ASSET with reason no-qualifying-variant. An ABSENT format is treated identically to an unrecognised one. context: breakId, format (the raw manifest string; empty when the field was absent)."},"DA-AD-STALLED":{category:"playback",level:"warn",summary:"An ad began playing and then stopped advancing: the playhead did not move for the stall threshold while the ad was meant to be playing. context: assetId, breakId, playbackState, stalledForMs, positionMs, bufferedAheadMs, reason."},"DA-AD-FOREGROUND-RESUMED":{category:"playback",level:"info",summary:"An in-flight ad resumed after the app returned to the foreground; context carries the suspended duration and ad position at resume."},"DA-AD-FOCUS-LOST":{category:"playback",level:"warn",summary:"The overlay ad lost permanent audio focus during an active break; the host player must not reclaim focus while the SDK ad is on screen. context: breakId, transient, reason."},"DA-AD-FOCUS-GRANTED":{category:"playback",level:"info",summary:"The overlay ad was granted media audio focus for the break, so system focus semantics (call, duck, permanent loss) apply to ad playback. context: breakId, cause, alreadyHeld."},"DA-AD-FOCUS-DENIED":{category:"playback",level:"warn",summary:"The platform refused the overlay ad's media audio-focus request, so the break plays with no focus of its own: another app's audio can mix over the ad, and a call can neither duck nor pause it. context: breakId, cause."},"DA-AD-FOCUS-ABANDONED":{category:"playback",level:"info",summary:"The overlay ad gave media audio focus back, so the content player's own focus request finds a clean stack. context: breakId, cause."},"DA-BREAK-ABANDONED":{category:"lifecycle",level:"warn",summary:"A break was still in flight when the session was torn down (endSession, destroy, or a startSession over an active session). context: breakId, cause, phase, unbalancedAdBegin, adIndex, totalAds, assetId."},"DA-RENDERER-UNAVAILABLE":{category:"lifecycle",level:"error",summary:"The renderer could not render a break because a required piece of it was not attached (e.g. no ad player), after the SDK had already emitted adbreakbegin — so the break began and will never end. context: breakId, missing."},"DA-SESSION-STARTING":{category:"session",level:"info",summary:"A step of startSession() was entered: begin, manifest-fetch, gam-init or scheduling. Emitted on entry, so the last one recorded names the step a hung startSession never finished. context: step, manifestUrl, elapsedMs. The URL is reported verbatim; the redacted config summary carries only its origin (config.manifestOrigin)."}};
@@ -2,4 +2,4 @@
2
2
  * SDK version embedded in diagnostic reports.
3
3
  * Stamped from the monorepo lockstep version (lerna.json) by the taxonomy generator.
4
4
  */
5
- export declare const SDK_VERSION = "1.2.1";
5
+ export declare const SDK_VERSION = "1.4.0";
@@ -1 +1 @@
1
- export const SDK_VERSION="1.2.1";
1
+ export const SDK_VERSION="1.4.0";
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { OptiViewAds } from './OptiViewAds';
2
2
  export { OptiViewAdsExternalVendors, type OptiViewAdsExternalVendorsConfig, } from './OptiViewAdsExternalVendors';
3
- export type { PlayerAdapter, PlayerAdapterEvent, PlayerAdapterEventHandler, TimedMetadataCue, VideoQuality, } from './interfaces/PlayerAdapter';
4
- export type { BreakManifest, Break, BreakPosition, EventTrigger, BreakVariant, SingleBreakVariant, DoubleBreakVariant, LshapeAdBreakVariant, LshapeContentBreakVariant, OverlayBreakVariant, AssetWithCompanion, OverlayPosition, OverlaySize, Asset, StaticAsset, VastAsset, VendorAsset, Polling, Controls, Targeting, OsVersionRange, Interaction, AssetUri, DeliveryRule, VendorConfiguration, VendorConfigurationBase, GamVendorConfiguration, GamSgaiConfiguration, GamSsaiConfiguration, } from './types/BreakManifest';
3
+ export type { ExternalPlaybackChange, ExternalPlaybackState, ExternalPlaybackTarget, PlayerAdapter, PlayerAdapterEvent, PlayerAdapterEventHandler, TimedMetadataCue, VideoQuality, } from './interfaces/PlayerAdapter';
4
+ export type { BreakManifest, Break, BreakPosition, EventTrigger, BreakVariant, SingleBreakVariant, DoubleBreakVariant, LshapeAdBreakVariant, LshapeContentBreakVariant, OverlayBreakVariant, AssetWithCompanion, OverlayPosition, OverlaySize, Asset, StaticAsset, VastAsset, VendorAsset, Polling, Controls, Targeting, OsVersionRange, Interaction, AssetUri, DeliveryRule, ChannelEvent, VendorConfiguration, VendorConfigurationBase, GamVendorConfiguration, GamSgaiConfiguration, GamSsaiConfiguration, GamSsbConfiguration, ExternalVendorConfigurationEntry, } from './types/BreakManifest';
5
5
  export type { ExternalVendorConfiguration } from './types/ExternalVendorConfiguration';
6
6
  export { BreakFormat, AssetType, MediaType, Vendor, Timebase, DeviceType, Platform, Os, DeliveryMode, BreakEvent, } from './types/BreakManifest';
7
7
  export { isStaticAsset, isVastAsset, isVendorAsset, isGamVendorConfiguration, isEventTrigger, isPauseBreak, } from './types/BreakManifest';
@@ -10,7 +10,7 @@ export type { DeliveryModeDecision } from './services/resolveDeliveryMode';
10
10
  export type { StitchedStreamVendor } from './services/resolveDeliveryMode';
11
11
  export type { DeviceProfile, TargetingIssue, TargetingMatch } from './services/matchTargeting';
12
12
  export { matchTargeting } from './services/matchTargeting';
13
- export type { OptiViewAdsConfig, LiveStartPushbackConfig, OptiViewAdsMode, PtsSource, GamConfig, SessionConfig, SsaiSessionConfig, StartSessionConfig, CreateAdAdapter, AdPreloadMode, AdBreakContentRecovery, AdInsertionMode, AdInsertionType, SsaiConfig, DoubleBoxAudio, ChainingConfig, ResolvedChaining, TuneInConfig, ResolvedTuneIn, ManifestResponseInterceptor, ManifestInterceptContext, ManifestRequestInterceptor, ManifestRequestContext, ManifestRequest, ManifestMockResponse, ManifestRequestInterceptorResult, } from './types/OptiViewAdsConfig';
13
+ export type { OptiViewAdsConfig, LiveStartPushbackConfig, OptiViewAdsMode, SessionDeliveryMode, PtsSource, GamConfig, SessionConfig, SsaiSessionConfig, StartSessionConfig, CreateAdAdapter, AdPreloadMode, AdBreakContentRecovery, AdInsertionMode, AdInsertionType, SsaiConfig, DoubleBoxAudio, ChainingConfig, ResolvedChaining, TuneInConfig, ResolvedTuneIn, ManifestResponseInterceptor, ManifestInterceptContext, ManifestRequestInterceptor, ManifestRequestContext, ManifestRequest, ManifestMockResponse, ManifestRequestInterceptorResult, } from './types/OptiViewAdsConfig';
14
14
  export { DEFAULT_MODE, DEFAULT_AD_PRELOAD_MODE, DEFAULT_AD_BREAK_CONTENT_RECOVERY, DEFAULT_AD_INSERTION_MODE, DEFAULT_CHAINING, resolveChaining, DEFAULT_TUNE_IN, resolveTuneIn, DEFAULT_PDT_GRACE_SECONDS, resolvePdtGraceSeconds, } from './types/OptiViewAdsConfig';
15
15
  export type { StitcherMasterUrlParams } from './services/StitcherUrlBuilder';
16
16
  export { buildStitcherMasterUrl } from './services/StitcherUrlBuilder';
@@ -45,9 +45,11 @@ export type { GamPodAdInfo, GamPodAdStep, GamPodCurrentAd } from './services/Gam
45
45
  export { GamPodAdTracker, derivePodAdAsset } from './services/GamPodAdTracker';
46
46
  export type { DiagnosticEvent, DiagnosticHandler, DiagnosticReport, ConfigSummary, DiagnosticCategory, DiagnosticLevel, DiagnosticCodeInfo, KnownDiagnosticCode, } from './diagnostics';
47
47
  export { DIAGNOSTIC_CODES, getDiagnosticCodeInfo, DiagnosticBuffer, DEFAULT_DIAGNOSTIC_BUFFER_SIZE, SDK_VERSION, } from './diagnostics';
48
- export type { DiagnosticsConfig, BreakWarningsConfig } from './types/OptiViewAdsConfig';
48
+ export type { DiagnosticsConfig, BreakWarningsConfig, ExternalPlaybackConfig, } from './types/OptiViewAdsConfig';
49
49
  export { parseBreakManifest, SUPPORTED_MANIFEST_MAJOR_VERSION, } from './services/parseBreakManifest';
50
+ export { resolveActiveEvent, resolveEventManifest, nextEventBoundaryMs, } from './services/resolveChannelEvents';
51
+ export type { ChannelEventIssue } from './services/resolveChannelEvents';
50
52
  export { fetchWithTimeout, AUX_FETCH_TIMEOUT_MS } from './services/fetchWithTimeout';
51
53
  export type { GamVendorParameters } from './services/GamPodUrlBuilder';
52
54
  export { buildGamPodUrl, isGamVendorParameters } from './services/GamPodUrlBuilder';
53
- export type { OptiViewAdsEventType, OptiViewAdsEventHandler, OptiViewAdsEventMap, OptiViewAdsEvent, AdBreakBeginEvent, AdBreakEndEvent, AdBreakSkippedEvent, AdBreakSkipReason, AdBeginEvent, AdEndEvent, AdErrorEvent, AdFirstQuartileEvent, AdMidpointEvent, AdThirdQuartileEvent, AdTimeupdateEvent, WaitingEvent, PlayingEvent, VolumeChangeEvent, AdClickEvent, PlaybackSource, AdBreakPhase, AdBreakStatus, AdBreakStatusEvent, AdChannelChangeEvent, AdChannelChangeReason, } from './types/Events';
55
+ export type { OptiViewAdsEventType, OptiViewAdsEventHandler, OptiViewAdsEventMap, OptiViewAdsEvent, AdBreakBeginEvent, AdBreakEndEvent, AdBreakSkippedEvent, AdBreakSkipReason, AdBeginEvent, AdEndEvent, AdErrorEvent, AdFirstQuartileEvent, AdMidpointEvent, AdThirdQuartileEvent, AdTimeupdateEvent, WaitingEvent, PlayingEvent, VolumeChangeEvent, AdClickEvent, PlaybackSource, AdBreakPhase, AdBreakStatus, AdBreakStatusEvent, AdChannelChangeEvent, AdChannelChangeReason, ExternalVendorConfigurationChangeEvent, } from './types/Events';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{OptiViewAds}from"./OptiViewAds";export{OptiViewAdsExternalVendors}from"./OptiViewAdsExternalVendors";export{BreakFormat,AssetType,MediaType,Vendor,Timebase,DeviceType,Platform,Os,DeliveryMode,BreakEvent}from"./types/BreakManifest";export{isStaticAsset,isVastAsset,isVendorAsset,isGamVendorConfiguration,isEventTrigger,isPauseBreak}from"./types/BreakManifest";export{resolveDeliveryMode,resolveStitchedStreamVendor,SsaiUnavailableError}from"./services/resolveDeliveryMode";export{matchTargeting}from"./services/matchTargeting";export{DEFAULT_MODE,DEFAULT_AD_PRELOAD_MODE,DEFAULT_AD_BREAK_CONTENT_RECOVERY,DEFAULT_AD_INSERTION_MODE,DEFAULT_CHAINING,resolveChaining,DEFAULT_TUNE_IN,resolveTuneIn,DEFAULT_PDT_GRACE_SECONDS,resolvePdtGraceSeconds}from"./types/OptiViewAdsConfig";export{buildStitcherMasterUrl}from"./services/StitcherUrlBuilder";export{GamStreamManager}from"./services/GamStreamManager";export{OPTIVIEW_ASSET_PARAMETER_MACROS}from"./services/assetParameterMacros";export{VastAdManager,isImaCsaiSdkAvailable}from"./services/VastAdManager";export{SsaiController}from"./services/SsaiController";export{resolvePreloadMode,isSingleDecoderUserAgent}from"./services/detectPreloadMode";export{detectDeviceProfile}from"./services/detectDeviceType";export{resolveContentRecovery,isRecreateAfterBreakUserAgent}from"./services/detectContentRecovery";export{resolveInsertionMode,isSharedElementUserAgent,detectMediaSourceCapabilities}from"./services/detectInsertionMode";export{systemClock}from"./services/BreakScheduler";export{MetadataCueTracker,isAnvatoCue,isId3InEmsgScheme,anvatoPayloadFromCue,parseAnvatoPayload,ANVATO_ID3_DESCRIPTION,ANVATO_ID3_MIME_TYPE,ANVATO_EMSG_SCHEME_ID_URI,ID3_IN_EMSG_SCHEME_ID_URIS,PTS_MATCH_TOLERANCE_SECONDS}from"./services/MetadataCueTracker";export{PauseAdController}from"./services/PauseAdController";export{parseVastCompanionImage}from"./services/parseVastCompanion";export{AdBreakSequencer,selectVariant,extractAssets,assetsOfVariant,resolveBreakFormat,breakPlanEmptyReason}from"./services/AdBreakSequencer";export{selectVariantDetailed,playableFormatsFor,variantsOf,RENDERABLE_BREAK_FORMATS,KNOWN_BREAK_FORMATS}from"./services/selectVariant";export{GamPodAdTracker,derivePodAdAsset}from"./services/GamPodAdTracker";export{DIAGNOSTIC_CODES,getDiagnosticCodeInfo,DiagnosticBuffer,DEFAULT_DIAGNOSTIC_BUFFER_SIZE,SDK_VERSION}from"./diagnostics";export{parseBreakManifest,SUPPORTED_MANIFEST_MAJOR_VERSION}from"./services/parseBreakManifest";export{fetchWithTimeout,AUX_FETCH_TIMEOUT_MS}from"./services/fetchWithTimeout";export{buildGamPodUrl,isGamVendorParameters}from"./services/GamPodUrlBuilder";
1
+ export{OptiViewAds}from"./OptiViewAds";export{OptiViewAdsExternalVendors}from"./OptiViewAdsExternalVendors";export{BreakFormat,AssetType,MediaType,Vendor,Timebase,DeviceType,Platform,Os,DeliveryMode,BreakEvent}from"./types/BreakManifest";export{isStaticAsset,isVastAsset,isVendorAsset,isGamVendorConfiguration,isEventTrigger,isPauseBreak}from"./types/BreakManifest";export{resolveDeliveryMode,resolveStitchedStreamVendor,SsaiUnavailableError}from"./services/resolveDeliveryMode";export{matchTargeting}from"./services/matchTargeting";export{DEFAULT_MODE,DEFAULT_AD_PRELOAD_MODE,DEFAULT_AD_BREAK_CONTENT_RECOVERY,DEFAULT_AD_INSERTION_MODE,DEFAULT_CHAINING,resolveChaining,DEFAULT_TUNE_IN,resolveTuneIn,DEFAULT_PDT_GRACE_SECONDS,resolvePdtGraceSeconds}from"./types/OptiViewAdsConfig";export{buildStitcherMasterUrl}from"./services/StitcherUrlBuilder";export{GamStreamManager}from"./services/GamStreamManager";export{OPTIVIEW_ASSET_PARAMETER_MACROS}from"./services/assetParameterMacros";export{VastAdManager,isImaCsaiSdkAvailable}from"./services/VastAdManager";export{SsaiController}from"./services/SsaiController";export{resolvePreloadMode,isSingleDecoderUserAgent}from"./services/detectPreloadMode";export{detectDeviceProfile}from"./services/detectDeviceType";export{resolveContentRecovery,isRecreateAfterBreakUserAgent}from"./services/detectContentRecovery";export{resolveInsertionMode,isSharedElementUserAgent,detectMediaSourceCapabilities}from"./services/detectInsertionMode";export{systemClock}from"./services/BreakScheduler";export{MetadataCueTracker,isAnvatoCue,isId3InEmsgScheme,anvatoPayloadFromCue,parseAnvatoPayload,ANVATO_ID3_DESCRIPTION,ANVATO_ID3_MIME_TYPE,ANVATO_EMSG_SCHEME_ID_URI,ID3_IN_EMSG_SCHEME_ID_URIS,PTS_MATCH_TOLERANCE_SECONDS}from"./services/MetadataCueTracker";export{PauseAdController}from"./services/PauseAdController";export{parseVastCompanionImage}from"./services/parseVastCompanion";export{AdBreakSequencer,selectVariant,extractAssets,assetsOfVariant,resolveBreakFormat,breakPlanEmptyReason}from"./services/AdBreakSequencer";export{selectVariantDetailed,playableFormatsFor,variantsOf,RENDERABLE_BREAK_FORMATS,KNOWN_BREAK_FORMATS}from"./services/selectVariant";export{GamPodAdTracker,derivePodAdAsset}from"./services/GamPodAdTracker";export{DIAGNOSTIC_CODES,getDiagnosticCodeInfo,DiagnosticBuffer,DEFAULT_DIAGNOSTIC_BUFFER_SIZE,SDK_VERSION}from"./diagnostics";export{parseBreakManifest,SUPPORTED_MANIFEST_MAJOR_VERSION}from"./services/parseBreakManifest";export{resolveActiveEvent,resolveEventManifest,nextEventBoundaryMs}from"./services/resolveChannelEvents";export{fetchWithTimeout,AUX_FETCH_TIMEOUT_MS}from"./services/fetchWithTimeout";export{buildGamPodUrl,isGamVendorParameters}from"./services/GamPodUrlBuilder";
@@ -0,0 +1,19 @@
1
+ import type { PlayerAdapter } from './PlayerAdapter';
2
+ /**
3
+ * Optional capability of the SDK's own web ad player: buffer the next ad behind the playing one,
4
+ * so a back-to-back break starts without a reload. Internal; no compatibility promise.
5
+ */
6
+ export interface AdSourceQueue {
7
+ /**
8
+ * Buffers `url` behind the playing ad. Resolves `true` once it is appended behind it, `false` when
9
+ * that is not possible (the caller keeps the cold path). `onLost` fires at most once when an
10
+ * accepted source can no longer be used; never after {@link takeQueued} or {@link clearQueued}.
11
+ */
12
+ queueNext(url: string, onLost: () => void): Promise<boolean>;
13
+ /** Makes the queued `url` the current source without `load()`; `false` when it is not queued. */
14
+ takeQueued(url: string): boolean;
15
+ /** Drops the queued source; media appended behind the playing ad never reaches the screen. */
16
+ clearQueued(): void;
17
+ }
18
+ /** Whether `player` can queue the next ad behind the playing one. */
19
+ export declare function hasAdSourceQueue(player: PlayerAdapter | null | undefined): player is PlayerAdapter & AdSourceQueue;
@@ -0,0 +1 @@
1
+ export function hasAdSourceQueue(e){const u=e;return"function"==typeof u?.queueNext&&"function"==typeof u.takeQueued&&"function"==typeof u.clearQueued}
@@ -1,8 +1,26 @@
1
1
  /**
2
2
  * Events a PlayerAdapter must support. `timedmetadata` is capability-style: adapters that
3
3
  * can surface in-stream markers (HLS ID3 / EXT-X-DATERANGE, DASH emsg) emit it per marker.
4
+ * `externalplaybackchange` is capability-style too: adapters that can detect AirPlay emit an
5
+ * {@link ExternalPlaybackChange} whenever the content player's external playback state changes.
4
6
  * @category Player Integration */
5
- export type PlayerAdapterEvent = 'timeupdate' | 'ended' | 'error' | 'seeked' | 'volumechange' | 'waiting' | 'playing' | 'pause' | 'timedmetadata';
7
+ export type PlayerAdapterEvent = 'timeupdate' | 'ended' | 'error' | 'seeked' | 'volumechange' | 'waiting' | 'playing' | 'pause' | 'timedmetadata' | 'externalplaybackchange';
8
+ /**
9
+ * External (AirPlay) playback state of the content player. `connecting` is a hint: the route moved
10
+ * to an AirPlay output, but video may or may not follow (screen mirroring and audio-only targets
11
+ * look the same). `active` is authoritative: the receiver renders the video. `inactive` follows either.
12
+ * On iOS, a closed gate while the route stays on AirPlay reads `connecting`.
13
+ * @category Player Integration */
14
+ export type ExternalPlaybackState = 'connecting' | 'active' | 'inactive';
15
+ /** What the external playback target is, when the platform tells. @category Player Integration */
16
+ export type ExternalPlaybackTarget = 'airplay' | 'unknown';
17
+ /** Payload of `externalplaybackchange`. @category Player Integration */
18
+ export interface ExternalPlaybackChange {
19
+ /** The new state. */
20
+ state: ExternalPlaybackState;
21
+ /** The kind of target the content is routed to. */
22
+ target: ExternalPlaybackTarget;
23
+ }
6
24
  /**
7
25
  * One in-stream timed-metadata marker (payload of `timedmetadata`). Minimal, player-agnostic:
8
26
  * - `id3`: HLS ID3 — parsed text `frames` and/or undecoded `raw` bytes.
@@ -207,6 +225,18 @@ export interface PlayerAdapter {
207
225
  * passing `null` restores the exact prior selection.
208
226
  */
209
227
  setVideoQuality?(quality: VideoQuality | null): boolean;
228
+ /**
229
+ * Current external (AirPlay) playback state of the content player; `undefined` when the adapter
230
+ * cannot detect it. Changes are announced with the `externalplaybackchange` event.
231
+ */
232
+ readonly externalPlaybackState?: ExternalPlaybackState | undefined;
233
+ /**
234
+ * Allow or block external VIDEO playback (AirPlay). The SDK calls it on the content player
235
+ * while a server-side beaconing stream is available, and with `false` once on every separate
236
+ * ad adapter from `createAdAdapter(container)` right after `prepareForAdPlayback`, so an ad
237
+ * can never take the content's AirPlay route. Omit when unsupported.
238
+ */
239
+ setExternalPlaybackAllowed?(allowed: boolean): void;
210
240
  /** Clean up resources when the SDK is destroyed. */
211
241
  destroy(): void;
212
242
  }
@@ -1 +1,3 @@
1
1
  export { preparePresentation, getPreparedPresentation, disposePreparedPresentation } from '../services/adPlayer/PreparedPresentation';
2
+ export { hasAdSourceQueue } from '../interfaces/AdSourceQueue';
3
+ export type { AdSourceQueue } from '../interfaces/AdSourceQueue';
@@ -1 +1 @@
1
- export{preparePresentation,getPreparedPresentation,disposePreparedPresentation}from"../services/adPlayer/PreparedPresentation";
1
+ export{preparePresentation,getPreparedPresentation,disposePreparedPresentation}from"../services/adPlayer/PreparedPresentation";export{hasAdSourceQueue}from"../interfaces/AdSourceQueue";
@@ -7,7 +7,8 @@ import { type VariantSelectionInputs } from './selectVariant';
7
7
  * outcomes, so the event contract has one source of truth across platforms (`conformance/`).
8
8
  * - `lshape_content` shows a backdrop with no ad video: only `adbreakbegin`/`adbreakend`.
9
9
  * - Shared-element plays only the first asset as a single fullscreen ad; `lshape_content` is skipped.
10
- * - Chaining is overlay-only: the finished break `adbreakend`s and the successor `adbreakbegin`s at once.
10
+ * - Chaining: the finished break `adbreakend`s and the successor `adbreakbegin`s at once. While the
11
+ * last ad plays, `prepare-successor` names the successor's first ad so a renderer can buffer it.
11
12
  */
12
13
  /** The insertion mode the sequencer needs, after `adaptive` has been resolved. */
13
14
  export type EffectiveInsertionMode = 'overlay' | 'shared-element';
@@ -39,13 +40,27 @@ export type AdBreakAction =
39
40
  | {
40
41
  kind: 'render-backdrop';
41
42
  }
42
- /** The break has fully ended (no chain): tear down and resume content. */
43
+ /** The break has fully ended (no chain): tear down, discard any prepared successor, resume content. */
43
44
  | {
44
45
  kind: 'end-break';
45
46
  }
46
47
  /** Nothing to do; the driver awaits the next outcome (asset end/error/timer). */
47
48
  | {
48
49
  kind: 'await';
50
+ }
51
+ /**
52
+ * While the break's last ad plays: buffer `asset`, the first ad the chain plays next (of
53
+ * `break`), behind it. Replaces any successor prepared before. A driver may ignore it.
54
+ */
55
+ | {
56
+ kind: 'prepare-successor';
57
+ break: Break;
58
+ asset: Asset;
59
+ }
60
+ /** The prepared successor `breakId` will not play next: discard it. */
61
+ | {
62
+ kind: 'drop-successor';
63
+ breakId: string;
49
64
  };
50
65
  /** An outcome the driver reports back to advance the sequence. */
51
66
  export type AdBreakOutcome =
@@ -68,6 +83,10 @@ export type AdBreakOutcome =
68
83
  /** The break's max-duration timer elapsed, cutting the break short. */
69
84
  | {
70
85
  kind: 'break-elapsed';
86
+ }
87
+ /** The chained successor of the current break appeared, changed or disappeared. */
88
+ | {
89
+ kind: 'successor-changed';
71
90
  };
72
91
  /**
73
92
  * Why a break produced no ad: `no-variant`, `no-qualifying-variant` (none passed device
@@ -118,12 +137,14 @@ export declare class AdBreakSequencer {
118
137
  private readonly insertionMode;
119
138
  private readonly chainResolver;
120
139
  private readonly selection;
140
+ private readonly successorResolver;
121
141
  private currentBreak;
122
142
  private plan;
123
143
  private assetIndex;
124
144
  /** True once the current asset emitted `adbegin` and has not yet settled. */
125
145
  private assetStarted;
126
- constructor(insertionMode: EffectiveInsertionMode, chainResolver?: ChainResolver, selection?: VariantSelectionInputs);
146
+ /** Break id named by the last `prepare-successor` of the current break, until it is dropped or the break ends. */
147
+ private preparedSuccessorId;
127
148
  /** The SELECTED (or downgrade-candidate) variant's format, not the first declared variant's. */
128
149
  private planFormat;
129
150
  /** Emits `adbreakbegin` and returns the first action; a break with nothing to play is retired without beginning. */
@@ -136,11 +157,19 @@ export declare class AdBreakSequencer {
136
157
  private startAction;
137
158
  /** Advance the sequence with a driver outcome. */
138
159
  onOutcome(outcome: AdBreakOutcome): AdBreakTransition;
160
+ /**
161
+ * Only while the break's last ad plays: an earlier queued item would play before the break's
162
+ * own next ad. Drops a prepared successor that the chain no longer plays next.
163
+ */
164
+ private successorAction;
165
+ private playingLastAsset;
166
+ /** The first ad the chain plays after `breakInfo`; successors with nothing to play are passed over, as the advance does. */
167
+ private firstSuccessorAd;
139
168
  /** The `adend` owed to an ad that began but has not settled, when a break is cut short. */
140
169
  private inFlightAdendPrefix;
141
170
  private onAssetStarted;
142
171
  /** A failure emits `aderror` then `adend` regardless; then advance or finalize. */
143
172
  private onAssetSettled;
144
- /** Emit `adbreakend`; an overlay chained successor `adbreakbegin`s at once through the held overlay. */
173
+ /** Emit `adbreakend`; a chained successor `adbreakbegin`s at once through the held ad surface. */
145
174
  private finalizeBreak;
146
175
  }
@@ -1 +1 @@
1
- import{BreakFormat as t}from"../types/BreakManifest";import{KNOWN_BREAK_FORMATS as e,selectVariantDetailed as s,variantsOf as a}from"./selectVariant";export function selectVariant(t,a){return s(t,a??{playableFormats:e}).selected}export function resolveBreakFormat(t,e){return selectVariant(t,e)?.format}export function assetsOfVariant(e){if(!e)return[];switch(e.format){case t.SINGLE:case t.DOUBLE:case t.LSHAPE_AD:case t.LSHAPE_CONTENT:case t.OVERLAY:return e.assets;default:return[]}}export function extractAssets(t,e){return assetsOfVariant(selectVariant(t,e))}export function breakPlanEmptyReason(t,e,s={}){const a=r(t,e,s);return"empty"===a.mode?a.reason??null:null}function r(r,n,i={}){if(0===a(r).length)return{mode:"empty",reason:"no-variant",variant:null};const o=s(r,{deviceType:i.deviceType,deviceProfile:i.deviceProfile,playableFormats:"shared-element"===n?e:i.playableFormats}),d=o.selected,l=d??o.deviceQualified;if(!l)return{mode:"empty",reason:"no-qualifying-variant",variant:null};if("shared-element"===n){if(l.format===t.LSHAPE_CONTENT)return{mode:"empty",reason:"lshape-content-skipped",variant:l};const e=assetsOfVariant(l)[0];return e?{mode:"shared-single",asset:e,variant:l}:{mode:"empty",reason:"no-assets",variant:l}}if(d){if(d.format===t.LSHAPE_CONTENT)return{mode:"overlay-backdrop",variant:d};const e=assetsOfVariant(d);return e.length>0?{mode:"overlay-assets",assets:e,variant:d}:{mode:"empty",reason:"no-assets",variant:d}}if(l.format===t.LSHAPE_CONTENT)return{mode:"overlay-backdrop",variant:l};const h=assetsOfVariant(l)[0];return h?{mode:"overlay-assets",assets:[h],variant:l}:{mode:"empty",reason:"no-assets",variant:l}}export class AdBreakSequencer{constructor(t,e=()=>null,s={}){this.insertionMode=t,this.chainResolver=e,this.selection=s,this.currentBreak=null,this.plan={mode:"empty"},this.assetIndex=0,this.assetStarted=!1}planFormat(){return"variant"in this.plan?this.plan.variant?.format:void 0}beginBreak(t){if(this.currentBreak=t,this.plan=r(t,this.insertionMode,this.selection),this.assetIndex=0,this.assetStarted=!1,"empty"===this.plan.mode)return this.retireEmptyBreak(t,[],this.noticeFor(t));return{steps:[{type:"adbreakbegin",break:t,format:this.planFormat()}],action:this.startAction(this.plan)}}noticeFor(t){return"empty"===this.plan.mode&&this.plan.reason?[{breakId:t.id,reason:this.plan.reason,format:this.plan.variant?.format,declaredAssetCount:a(t).reduce((t,e)=>t+assetsOfVariant(e).length,0)}]:[]}retireEmptyBreak(t,e,s){const a=[...e,{type:"aderror",break:t,format:this.planFormat()}],n="overlay"===this.insertionMode?this.chainResolver(t.id):null;return n?(this.currentBreak=n,this.plan=r(n,this.insertionMode,this.selection),this.assetIndex=0,this.assetStarted=!1,"empty"===this.plan.mode?this.retireEmptyBreak(n,a,[...s,...this.noticeFor(n)]):(a.push({type:"adbreakbegin",break:n,format:this.planFormat()}),{steps:a,action:this.startAction(this.plan),noPlayableAsset:s})):(this.currentBreak=null,{steps:a,action:{kind:"end-break"},noPlayableAsset:s})}startAction(t){switch(t.mode){case"overlay-assets":return{kind:"play-asset",asset:t.assets[0],index:0,total:t.assets.length};case"overlay-backdrop":return{kind:"render-backdrop"};case"shared-single":return{kind:"play-shared",asset:t.asset}}}onOutcome(t){if(!this.currentBreak)return{steps:[],action:{kind:"await"}};const e=this.currentBreak;switch(t.kind){case"asset-started":return this.onAssetStarted(e);case"asset-ended":return this.onAssetSettled(e,!1);case"asset-errored":return this.onAssetSettled(e,!0);case"backdrop-elapsed":case"break-elapsed":return this.finalizeBreak(this.inFlightAdendPrefix(e))}}inFlightAdendPrefix(t){if(!this.assetStarted)return[];const e=this.planFormat();return"overlay-assets"===this.plan.mode?[{type:"adend",break:t,format:e,asset:this.plan.assets[this.assetIndex],adIndex:this.assetIndex,totalAds:this.plan.assets.length}]:"shared-single"===this.plan.mode?[{type:"adend",break:t,format:e,asset:this.plan.asset,adIndex:0,totalAds:1}]:[]}onAssetStarted(t){if("overlay-assets"===this.plan.mode){const e=this.plan.assets.length,s=this.plan.assets[this.assetIndex];return this.assetStarted=!0,{steps:[{type:"adbegin",break:t,format:this.planFormat(),asset:s,adIndex:this.assetIndex,totalAds:e}],action:{kind:"await"}}}return"shared-single"===this.plan.mode?(this.assetStarted=!0,{steps:[{type:"adbegin",break:t,format:this.planFormat(),asset:this.plan.asset,adIndex:0,totalAds:1}],action:{kind:"await"}}):{steps:[],action:{kind:"await"}}}onAssetSettled(t,e){if(this.assetStarted=!1,"shared-single"===this.plan.mode){const s=[],a=this.plan.asset,r=this.planFormat();return e&&s.push({type:"aderror",break:t,format:r,asset:a,adIndex:0,totalAds:1}),s.push({type:"adend",break:t,format:r,asset:a,adIndex:0,totalAds:1}),this.finalizeBreak(s)}if("overlay-assets"!==this.plan.mode)return{steps:[],action:{kind:"await"}};const s=this.plan.assets.length,a=this.plan.assets[this.assetIndex],r=[],n=this.planFormat();return e&&r.push({type:"aderror",break:t,format:n,asset:a,adIndex:this.assetIndex,totalAds:s}),r.push({type:"adend",break:t,format:n,asset:a,adIndex:this.assetIndex,totalAds:s}),this.assetIndex+=1,this.assetIndex<s?{steps:r,action:{kind:"play-asset",asset:this.plan.assets[this.assetIndex],index:this.assetIndex,total:s}}:this.finalizeBreak(r)}finalizeBreak(t,e=[]){const s=t=>e.length>0?{...t,noPlayableAsset:e}:t,a=this.currentBreak;if(!a)return s({steps:t,action:{kind:"end-break"}});const n=[...t,{type:"adbreakend",break:a,format:this.planFormat()}],i="overlay"===this.insertionMode?this.chainResolver(a.id):null;return i?(this.currentBreak=i,this.plan=r(i,this.insertionMode,this.selection),this.assetIndex=0,this.assetStarted=!1,"empty"===this.plan.mode?this.retireEmptyBreak(i,n,[...e,...this.noticeFor(i)]):(n.push({type:"adbreakbegin",break:i,format:this.planFormat()}),s({steps:n,action:this.startAction(this.plan)}))):(this.currentBreak=null,s({steps:n,action:{kind:"end-break"}}))}}
1
+ import{BreakFormat as e}from"../types/BreakManifest";import{KNOWN_BREAK_FORMATS as t,selectVariantDetailed as s,variantsOf as a}from"./selectVariant";export function selectVariant(e,a){return s(e,a??{playableFormats:t}).selected}export function resolveBreakFormat(e,t){return selectVariant(e,t)?.format}export function assetsOfVariant(t){if(!t)return[];switch(t.format){case e.SINGLE:case e.DOUBLE:case e.LSHAPE_AD:case e.LSHAPE_CONTENT:case e.OVERLAY:return t.assets;default:return[]}}export function extractAssets(e,t){return assetsOfVariant(selectVariant(e,t))}export function breakPlanEmptyReason(e,t,s={}){const a=r(e,t,s);return"empty"===a.mode?a.reason??null:null}function r(r,n,i={}){if(0===a(r).length)return{mode:"empty",reason:"no-variant",variant:null};const o=s(r,{deviceType:i.deviceType,deviceProfile:i.deviceProfile,playableFormats:"shared-element"===n?t:i.playableFormats}),d=o.selected,l=d??o.deviceQualified;if(!l)return{mode:"empty",reason:"no-qualifying-variant",variant:null};if("shared-element"===n){if(l.format===e.LSHAPE_CONTENT)return{mode:"empty",reason:"lshape-content-skipped",variant:l};const t=assetsOfVariant(l)[0];return t?{mode:"shared-single",asset:t,variant:l}:{mode:"empty",reason:"no-assets",variant:l}}if(d){if(d.format===e.LSHAPE_CONTENT)return{mode:"overlay-backdrop",variant:d};const t=assetsOfVariant(d);return t.length>0?{mode:"overlay-assets",assets:t,variant:d}:{mode:"empty",reason:"no-assets",variant:d}}if(l.format===e.LSHAPE_CONTENT)return{mode:"overlay-backdrop",variant:l};const h=assetsOfVariant(l)[0];return h?{mode:"overlay-assets",assets:[h],variant:l}:{mode:"empty",reason:"no-assets",variant:l}}export class AdBreakSequencer{constructor(e,t=()=>null,s={},a=t){this.insertionMode=e,this.chainResolver=t,this.selection=s,this.successorResolver=a,this.currentBreak=null,this.plan={mode:"empty"},this.assetIndex=0,this.assetStarted=!1,this.preparedSuccessorId=null}planFormat(){return"variant"in this.plan?this.plan.variant?.format:void 0}beginBreak(e){if(this.currentBreak=e,this.plan=r(e,this.insertionMode,this.selection),this.assetIndex=0,this.assetStarted=!1,this.preparedSuccessorId=null,"empty"===this.plan.mode)return this.retireEmptyBreak(e,[],this.noticeFor(e));return{steps:[{type:"adbreakbegin",break:e,format:this.planFormat()}],action:this.startAction(this.plan)}}noticeFor(e){return"empty"===this.plan.mode&&this.plan.reason?[{breakId:e.id,reason:this.plan.reason,format:this.plan.variant?.format,declaredAssetCount:a(e).reduce((e,t)=>e+assetsOfVariant(t).length,0)}]:[]}retireEmptyBreak(e,t,s){const a=[...t,{type:"aderror",break:e,format:this.planFormat()}],n=this.chainResolver(e.id);return n?(this.currentBreak=n,this.plan=r(n,this.insertionMode,this.selection),this.assetIndex=0,this.assetStarted=!1,this.preparedSuccessorId=null,"empty"===this.plan.mode?this.retireEmptyBreak(n,a,[...s,...this.noticeFor(n)]):(a.push({type:"adbreakbegin",break:n,format:this.planFormat()}),{steps:a,action:this.startAction(this.plan),noPlayableAsset:s})):(this.currentBreak=null,{steps:a,action:{kind:"end-break"},noPlayableAsset:s})}startAction(e){switch(e.mode){case"overlay-assets":return{kind:"play-asset",asset:e.assets[0],index:0,total:e.assets.length};case"overlay-backdrop":return{kind:"render-backdrop"};case"shared-single":return{kind:"play-shared",asset:e.asset}}}onOutcome(e){if(!this.currentBreak)return{steps:[],action:{kind:"await"}};const t=this.currentBreak;switch(e.kind){case"asset-started":return this.onAssetStarted(t);case"asset-ended":return this.onAssetSettled(t,!1);case"asset-errored":return this.onAssetSettled(t,!0);case"backdrop-elapsed":case"break-elapsed":return this.finalizeBreak(this.inFlightAdendPrefix(t));case"successor-changed":return{steps:[],action:this.successorAction(t)}}}successorAction(e){if(!this.playingLastAsset())return{kind:"await"};const t=this.firstSuccessorAd(e);if(t)return this.preparedSuccessorId=t.break.id,{kind:"prepare-successor",break:t.break,asset:t.asset};const s=this.preparedSuccessorId;return null===s?{kind:"await"}:(this.preparedSuccessorId=null,{kind:"drop-successor",breakId:s})}upcomingAsset(){return this.currentBreak&&"overlay-assets"===this.plan.mode?this.plan.assets[this.assetIndex+1]??null:null}playingLastAsset(){return!!this.assetStarted&&("shared-single"===this.plan.mode||"overlay-assets"===this.plan.mode&&this.assetIndex===this.plan.assets.length-1)}firstSuccessorAd(e){const t=new Set([e.id]);let s=this.successorResolver(e.id);for(;s&&!t.has(s.id);){t.add(s.id);const e=r(s,this.insertionMode,this.selection);if("overlay-assets"===e.mode)return{break:s,asset:e.assets[0]};if("shared-single"===e.mode)return{break:s,asset:e.asset};if("empty"!==e.mode)return null;s=this.successorResolver(s.id)}return null}inFlightAdendPrefix(e){if(!this.assetStarted)return[];const t=this.planFormat();return"overlay-assets"===this.plan.mode?[{type:"adend",break:e,format:t,asset:this.plan.assets[this.assetIndex],adIndex:this.assetIndex,totalAds:this.plan.assets.length}]:"shared-single"===this.plan.mode?[{type:"adend",break:e,format:t,asset:this.plan.asset,adIndex:0,totalAds:1}]:[]}onAssetStarted(e){if("overlay-assets"===this.plan.mode){const t=this.plan.assets.length,s=this.plan.assets[this.assetIndex];return this.assetStarted=!0,{steps:[{type:"adbegin",break:e,format:this.planFormat(),asset:s,adIndex:this.assetIndex,totalAds:t}],action:this.successorAction(e)}}return"shared-single"===this.plan.mode?(this.assetStarted=!0,{steps:[{type:"adbegin",break:e,format:this.planFormat(),asset:this.plan.asset,adIndex:0,totalAds:1}],action:this.successorAction(e)}):{steps:[],action:{kind:"await"}}}onAssetSettled(e,t){if(this.assetStarted=!1,"shared-single"===this.plan.mode){const s=[],a=this.plan.asset,r=this.planFormat();return t&&s.push({type:"aderror",break:e,format:r,asset:a,adIndex:0,totalAds:1}),s.push({type:"adend",break:e,format:r,asset:a,adIndex:0,totalAds:1}),this.finalizeBreak(s)}if("overlay-assets"!==this.plan.mode)return{steps:[],action:{kind:"await"}};const s=this.plan.assets.length,a=this.plan.assets[this.assetIndex],r=[],n=this.planFormat();return t&&r.push({type:"aderror",break:e,format:n,asset:a,adIndex:this.assetIndex,totalAds:s}),r.push({type:"adend",break:e,format:n,asset:a,adIndex:this.assetIndex,totalAds:s}),this.assetIndex+=1,this.assetIndex<s?{steps:r,action:{kind:"play-asset",asset:this.plan.assets[this.assetIndex],index:this.assetIndex,total:s}}:this.finalizeBreak(r)}finalizeBreak(e,t=[]){const s=e=>t.length>0?{...e,noPlayableAsset:t}:e,a=this.currentBreak;if(!a)return s({steps:e,action:{kind:"end-break"}});const n=[...e,{type:"adbreakend",break:a,format:this.planFormat()}];this.preparedSuccessorId=null;const i=this.chainResolver(a.id);return i?(this.currentBreak=i,this.plan=r(i,this.insertionMode,this.selection),this.assetIndex=0,this.assetStarted=!1,"empty"===this.plan.mode?this.retireEmptyBreak(i,n,[...t,...this.noticeFor(i)]):(n.push({type:"adbreakbegin",break:i,format:this.planFormat()}),s({steps:n,action:this.startAction(this.plan)}))):(this.currentBreak=null,s({steps:n,action:{kind:"end-break"}}))}}