@dolby-optiview/ads-sdk-core 1.0.0 → 1.1.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 (77) hide show
  1. package/README.md +68 -0
  2. package/dist/OptiViewAds.d.ts +1 -0
  3. package/dist/OptiViewAds.js +1 -1
  4. package/dist/diagnostics/recordEventTimeline.d.ts +3 -0
  5. package/dist/diagnostics/recordEventTimeline.js +1 -0
  6. package/dist/generated/diagnosticCodes.d.ts +96 -1
  7. package/dist/generated/diagnosticCodes.js +1 -1
  8. package/dist/generated/version.d.ts +1 -1
  9. package/dist/generated/version.js +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/interfaces/PlayerAdapter.d.ts +33 -0
  12. package/dist/internal/index.d.ts +1 -1
  13. package/dist/internal/index.js +1 -1
  14. package/dist/services/AdPlayerController.d.ts +3 -0
  15. package/dist/services/AdPlayerController.js +1 -1
  16. package/dist/services/BreakScheduler.d.ts +5 -2
  17. package/dist/services/BreakScheduler.js +1 -1
  18. package/dist/services/CmcdAdReporter.d.ts +10 -0
  19. package/dist/services/CmcdAdReporter.js +1 -1
  20. package/dist/services/GamPodAdTracker.d.ts +12 -1
  21. package/dist/services/GamPodAdTracker.js +1 -1
  22. package/dist/services/LensReporter.d.ts +3 -1
  23. package/dist/services/LensReporter.js +1 -1
  24. package/dist/services/LiveStartPushbackController.d.ts +36 -0
  25. package/dist/services/LiveStartPushbackController.js +1 -0
  26. package/dist/services/MetadataCueTracker.d.ts +15 -0
  27. package/dist/services/MetadataCueTracker.js +1 -1
  28. package/dist/services/VastAdManager.js +1 -1
  29. package/dist/services/adPlayer/AdPlayerState.d.ts +11 -0
  30. package/dist/services/adPlayer/AdPlayerState.js +1 -1
  31. package/dist/services/adPlayer/AdPreloader.d.ts +9 -1
  32. package/dist/services/adPlayer/AdPreloader.js +1 -1
  33. package/dist/services/adPlayer/AdStage.d.ts +5 -0
  34. package/dist/services/adPlayer/AdStage.js +1 -1
  35. package/dist/services/adPlayer/AssetPlayback.d.ts +15 -1
  36. package/dist/services/adPlayer/AssetPlayback.js +1 -1
  37. package/dist/services/adPlayer/ContentResumeCoordinator.d.ts +39 -0
  38. package/dist/services/adPlayer/ContentResumeCoordinator.js +1 -1
  39. package/dist/services/adPlayer/GamPodBridge.d.ts +7 -0
  40. package/dist/services/adPlayer/GamPodBridge.js +1 -1
  41. package/dist/services/adPlayer/PreparedPresentation.d.ts +32 -0
  42. package/dist/services/adPlayer/PreparedPresentation.js +1 -0
  43. package/dist/services/adPlayer/SharedElementBreakPlayer.d.ts +8 -0
  44. package/dist/services/adPlayer/SharedElementBreakPlayer.js +1 -1
  45. package/dist/services/adPlayer/classifyMediaError.d.ts +9 -0
  46. package/dist/services/adPlayer/classifyMediaError.js +1 -0
  47. package/dist/services/adPlayer/liveEdge.d.ts +29 -0
  48. package/dist/services/adPlayer/liveEdge.js +1 -1
  49. package/dist/services/anvatoCueRuntime.d.ts +7 -0
  50. package/dist/services/anvatoCueRuntime.js +1 -1
  51. package/dist/services/classifyImaAdError.d.ts +6 -0
  52. package/dist/services/classifyImaAdError.js +1 -0
  53. package/dist/services/html5ImaErrorNames.d.ts +2 -0
  54. package/dist/services/html5ImaErrorNames.js +1 -0
  55. package/dist/services/lensBackend.d.ts +1 -1
  56. package/dist/services/resolveLiveStartPushback.d.ts +1 -0
  57. package/dist/services/resolveLiveStartPushback.js +1 -0
  58. package/dist/session/AdBreakStatusTracker.js +1 -1
  59. package/dist/session/BreakLifecycle.js +1 -1
  60. package/dist/session/SessionStarter.d.ts +1 -0
  61. package/dist/session/SessionStarter.js +1 -1
  62. package/dist/types/AdError.d.ts +12 -0
  63. package/dist/types/AdError.js +1 -0
  64. package/dist/types/OptiViewAdsConfig.d.ts +17 -0
  65. package/dist/types/VendorAdError.d.ts +6 -5
  66. package/dist/types/VendorAdError.js +1 -1
  67. package/dist/vendor/lens-sdk/THIRD-PARTY-NOTICES.txt +1 -1
  68. package/dist/vendor/lens-sdk/index.d.ts +1 -1
  69. package/dist/vendor/lens-sdk/index.js +1 -1
  70. package/dist/vendor/lens-sdk/lens-core-uGZfZpQy.js +1 -0
  71. package/dist/vendor/lens-sdk/lens.d.ts +2 -0
  72. package/dist/vendor/lens-sdk/teardown.d.ts +13 -0
  73. package/dist/vendor/lens-sdk/transport.d.ts +11 -2
  74. package/dist/vendor/lens-sdk/types.d.ts +56 -5
  75. package/dist/vendor/lens-sdk/validation.d.ts +4 -1
  76. package/package.json +1 -1
  77. package/dist/vendor/lens-sdk/lens-core-Q5lbQGMC.js +0 -1
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # @dolby-optiview/ads-sdk-core
2
+
3
+ Player-agnostic core of the OptiView Ads SDK for the web: break manifest
4
+ polling and verification, break scheduling, ad playback and event reporting.
5
+ It never imports player code; content and ad players are driven through the
6
+ `PlayerAdapter` interface.
7
+
8
+ Most applications do not install this package directly:
9
+ `@dolby-optiview/ads-sdk` depends on it and adds a default ad player. Use the
10
+ core on its own when you supply both the content adapter and the ad player
11
+ adapter yourself, for example with a custom `PlayerAdapter`.
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @dolby-optiview/ads-sdk-core @dolby-optiview/ads-sdk-adapter-hlsjs hls.js
17
+ ```
18
+
19
+ Replace the adapter with `@dolby-optiview/ads-sdk-adapter-shaka` or
20
+ `@dolby-optiview/ads-sdk-adapter-theoplayer` for those players.
21
+
22
+ ## Quick start
23
+
24
+ With the bare core, `createAdAdapter` is required:
25
+
26
+ ```typescript
27
+ import Hls from 'hls.js';
28
+ import { OptiViewAds } from '@dolby-optiview/ads-sdk-core';
29
+ import { HlsJsAdapter } from '@dolby-optiview/ads-sdk-adapter-hlsjs';
30
+
31
+ const video = document.getElementById('video') as HTMLVideoElement;
32
+ const hls = new Hls();
33
+ hls.attachMedia(video);
34
+
35
+ const sdk = new OptiViewAds({
36
+ player: new HlsJsAdapter(hls, video),
37
+ container: document.getElementById('container')!,
38
+ createAdAdapter: (adContainer) => {
39
+ const adVideo = document.createElement('video');
40
+ adContainer.appendChild(adVideo);
41
+ const adHls = new Hls();
42
+ adHls.attachMedia(adVideo);
43
+ return new HlsJsAdapter(adHls, adVideo);
44
+ },
45
+ });
46
+
47
+ await sdk.startSession({
48
+ manifestUrl: 'https://manifest.example.com/v1/your-org/channels/your-channel',
49
+ });
50
+ hls.loadSource('https://example.com/content.m3u8');
51
+ video.play();
52
+ ```
53
+
54
+ ## Custom adapters
55
+
56
+ Implement `PlayerAdapter` (exported as a type from this package) to connect a
57
+ player that has no ready-made adapter. The adapter reports playback state,
58
+ program date time and in-stream metadata to the core and receives load, play,
59
+ pause and seek commands.
60
+
61
+ ## Documentation
62
+
63
+ - [OptiView Ads SDK documentation](https://optiview.dolby.com/docs/ads/player-integration/optiview-ads-sdk/)
64
+ - Entry package: `@dolby-optiview/ads-sdk`
65
+
66
+ ## License
67
+
68
+ See <https://optiview.dolby.com/policies/terms-of-service/>.
@@ -39,6 +39,7 @@ export declare class OptiViewAds {
39
39
  /** The SDK version, readable without constructing an instance. @category Diagnostics */
40
40
  static get version(): string;
41
41
  private player;
42
+ private readonly liveStartPushback;
42
43
  /** Releases the scheduler's reload guard after a content error — see onContentError. */
43
44
  private contentErrorReloadGuard;
44
45
  /** How long a content error brackets scheduler position samples as reload noise. */
@@ -1 +1 @@
1
- import{DEFAULT_MODE as e,DEFAULT_AD_PRELOAD_MODE as t,DEFAULT_AD_BREAK_CONTENT_RECOVERY as s,DEFAULT_AD_INSERTION_MODE as r,DEFAULT_AD_BREAK_CUT_SAFETY_MARGIN_SEC as i,DEFAULT_DOUBLE_BOX_AUDIO as a,resolveChaining as o,resolveTuneIn as n,resolveBreakWarnings as d,resolvePdtGraceSeconds as l}from"./types/OptiViewAdsConfig";import{SsaiController as h}from"./services/SsaiController";import{resolvePreloadMode as c}from"./services/detectPreloadMode";import{resolveContentRecovery as u}from"./services/detectContentRecovery";import{emitResolvedModeDiagnostics as m}from"./services/resolvedModeDiagnostics";import{isSingleSurfaceWebDevice as p,resolveInsertionMode as g}from"./services/detectInsertionMode";import{ManifestService as k}from"./services/ManifestService";import{BreakScheduler as f,systemClock as y}from"./services/BreakScheduler";import{MetadataCueTracker as S}from"./services/MetadataCueTracker";import{armBreakFromPresentedCue as A,diagnoseAnvatoCueObserved as v,notedManifestBreakIds as C}from"./services/anvatoCueRuntime";import{AdPlayerController as b}from"./services/AdPlayerController";import{effectiveFormat as P}from"./services/pictureInPicture";import{resolveBreakFormat as w}from"./services/AdBreakSequencer";import{connectPauseAd as B}from"./services/adPlayer/connectPauseAd";import{BreakTransitionTimer as T}from"./services/BreakTransitionTimer";import{LensReporter as I}from"./services/LensReporter";import{CmcdAdReporter as R}from"./services/CmcdAdReporter";import{DiagnosticBuffer as D}from"./diagnostics/DiagnosticBuffer";import{DIAGNOSTIC_CODES as E}from"./diagnostics/errorCodes";import{SDK_VERSION as O}from"./generated/version";import{playbackErrorContext as M}from"./diagnostics/playbackErrorContext";import{debugLog as L}from"./diagnostics/debugLog";import{AdBreakStatusTracker as x}from"./session/AdBreakStatusTracker";import{BreakLifecycle as G}from"./session/BreakLifecycle";import{SessionStarter as H}from"./session/SessionStarter";import{SessionState as V}from"./session/SessionState";export class OptiViewAds{static get version(){return O}constructor(h){if(this.contentErrorReloadGuard=null,this.CONTENT_ERROR_RELOAD_GUARD_MS=5e3,this.eventHandlers=new Map,this.diagnosticHandlers=new Set,this.destroyed=!1,this.continueContentDuringBreak=!1,this.state=new V,this.metadataCueTracker=null,this.anvatoObservedLogged=new Set,this.seenManifestBreakIds=new Set,this.player=h.player,this.debug=h.debug??!1,this.mode=h.mode??e,this.hasExplicitMode=void 0!==h.mode,this.lensReporter=new I((...e)=>this.log(...e)),this.cmcdAdReporter=new R(()=>this.lensReporter.handle,(...e)=>this.log(...e)),this.adBreakStatusTracker=new x({emit:(e,t)=>this.emit(e,t),effectiveFormatOf:e=>this.effectiveFormatOf(e),secondsUntilBreak:e=>this.breakScheduler?.getSecondsUntilBreak(e)??void 0,breakTransitionTimer:()=>this.breakTransitionTimer}),this.onContentSeeked=()=>{const e=this.breakScheduler?.getActiveBreak();if(!e?.controls?.snapback)return;if(this.state.snapbackSeekInFlight)return void(this.state.snapbackSeekInFlight=!1);const t="number"==typeof e.start?e.start:this.player.currentTime;Math.abs(this.player.currentTime-t)<=.5||(this.log("Snapback: seek detected during locked break, snapping back to break start"),this.state.snapbackSeekInFlight=!0,this.player.seek(t))},this.onContentWaiting=()=>{this.adPlayerController?.isAdPlaying()||this.emit("waiting",{type:"waiting",timestamp:Date.now(),source:"content"})},this.onContentPlaying=()=>{this.adPlayerController?.isAdPlaying()||(this.breakScheduler?.markPlaybackStart(),this.breakTransitionTimer?.settle("out-of-break"),!1!==this.pauseAdController?.onResume()?this.emit("playing",{type:"playing",timestamp:Date.now(),source:"content"}):this.player.pause())},this.onContentPause=()=>{this.adPlayerController?.isAdPlaying()||this.breakScheduler?.isAdStartDelayActive()||this.pauseAdController?.onPause()},this.onContentEnded=()=>{this.adPlayerController?.isAdPlaying()||this.breakScheduler?.markPlaybackEnd()},this.onContentError=e=>{this.sessionStarter?.cancelHeldImmediatePreRollOnContentError();const t=this.toPlaybackError(e,"Content playback error");this.diagnose("DA-CONTENT-PLAYBACK-ERROR",t.message,M(e)),this.breakScheduler?.setContentReloading(!0),this.contentErrorReloadGuard&&clearTimeout(this.contentErrorReloadGuard),this.contentErrorReloadGuard=setTimeout(()=>{this.contentErrorReloadGuard=null,this.breakScheduler?.setContentReloading(!1)},this.CONTENT_ERROR_RELOAD_GUARD_MS),this.emit("aderror",{type:"aderror",timestamp:Date.now(),source:"content",error:t})},this.onTimedMetadata=e=>{if(!e)return;const t=e,s=this.metadataCueTracker?.handleCue(t)??!1;v(t,s,this.metadataCueTracker,this.anvatoObservedLogged,this.player.currentTime,(e,t,s)=>this.diagnose(e,t,s)),"presented"===t.phase&&A(t,this.metadataCueTracker,this.breakScheduler)},this.continueContentDuringBreak=h.continueContentDuringBreak??!1,"ssai"===this.mode)return void this.initSsai(h);if(!h.createAdAdapter)throw new Error("[OptiViewAds] createAdAdapter is required. Use the @dolby-optiview/ads-sdk package for a default HLS.js ad player, or supply your own createAdAdapter factory.");this.state.steeredSsaiOptions={maxBitrate:h.maxBitrate,autoplay:h.autoplay??!1,streamActivityMonitorId:h.gam?.streamActivityMonitorId};const P=c(h.adPreload??t),w=h.adBreakContentRecovery??s,E=u(w),O=g(h.adInsertion??r),L=o(h.chaining),F=n(h.tuneIn),$=d(h.breakWarnings),q=l(h.pdtGraceSeconds);"anvatoCue"===h.ptsSource&&(this.metadataCueTracker=new S),this.diagnosticBuffer=new D(h.diagnostics?.bufferSize),this.breakTransitionTimer=new T(e=>{this.diagnose("DA-BREAK-TRANSITION",`Transition ${e.kind} took ${e.durationMs}ms`,{transition:e.kind,durationMs:e.durationMs,breakId:e.breakId,adPreload:P,adInsertion:O,...e.phases?{phases:e.phases}:{}})}),this.state.configSummary={mode:this.mode,adPreload:P,adBreakContentRecovery:E,adInsertion:O,chaining:{enabled:L.enabled,maxGapSeconds:L.maxGapSeconds},tuneIn:{enabled:F.enabled,minBreakDurationSeconds:F.minBreakDurationSeconds},breakWarnings:{seconds:$.seconds},ptsSource:h.ptsSource??"mediaTime",continueContentDuringBreak:this.continueContentDuringBreak,gam:h.gam?{hasAssetParameters:!1,streamActivityMonitorId:h.gam.streamActivityMonitorId}:void 0},m({adPreload:h.adPreload??t,adInsertion:h.adInsertion??r,adBreakContentRecovery:w},{preloadMode:P,insertionMode:O,contentRecovery:E},(e,t,s)=>this.diagnose(e,t,s)),this.manifestService=new k(this.debug,h.interceptManifestResponse,(e,t,s)=>this.diagnose(e,t,s),h.interceptManifestRequest),this.breakScheduler=new f(this.player,this.debug,L,void 0,F,(e,t,s)=>this.diagnose(e,t,s),$,this.metadataCueTracker,q),this.adPlayerController=new b(h.player,h.container,h.playerContainer,h.createAdAdapter,this.debug,h.gam,P,O,h.adBreakCutSafetyMarginSec??i,h.doubleBoxAudio??a,p("undefined"!=typeof navigator?navigator.userAgent:"","undefined"!=typeof navigator?navigator.maxTouchPoints??0:0),y,E),this.adPlayerController.setTransitionPhaseReporter(this.debug?e=>this.breakTransitionTimer?.phase(e):null),this.adPlayerController.setChainResolver(L.enabled?e=>this.breakScheduler.getChainedSuccessor(e):null),this.adPlayerController.initialize();const N=(e,t)=>void 0===e||void 0===t?{}:{adIndex:e,totalAds:t};this.adPlayerController.setGamEventCallbacks({onAdFirstQuartile:(e,t,s,r)=>{this.emit("adfirstquartile",{type:"adfirstquartile",timestamp:Date.now(),break:e,format:this.effectiveFormatOf(e),asset:t,...N(s,r)})},onAdMidpoint:(e,t,s,r)=>{this.emit("admidpoint",{type:"admidpoint",timestamp:Date.now(),break:e,format:this.effectiveFormatOf(e),asset:t,...N(s,r)})},onAdThirdQuartile:(e,t,s,r)=>{this.emit("adthirdquartile",{type:"adthirdquartile",timestamp:Date.now(),break:e,format:this.effectiveFormatOf(e),asset:t,...N(s,r)})}}),this.adPlayerController.setDiagnoseHandler((e,t,s)=>{this.diagnose(e,t,s)}),this.pauseAdController=B(this.adPlayerController,{debug:this.debug,diagnose:(e,t,s)=>this.diagnose(e,t,s)}),this.adPlayerController.setVolumeChangeCallback((e,t)=>{this.emit("volumechange",{type:"volumechange",timestamp:Date.now(),muted:e,volume:t})}),this.breakLifecycle=new G(this.state,{adPlayerController:this.adPlayerController,breakScheduler:this.breakScheduler,manifestService:this.manifestService,breakTransitionTimer:this.breakTransitionTimer,cmcdAdReporter:this.cmcdAdReporter,adBreakStatusTracker:this.adBreakStatusTracker,emit:(e,t)=>this.emit(e,t),diagnose:(e,t,s)=>this.diagnose(e,t,s),log:(...e)=>this.log(...e),effectiveFormatOf:e=>this.effectiveFormatOf(e),onBreakSettled:()=>this.sessionStarter?.applyPendingChannelSwitch()}),this.sessionStarter=new H(this.state,{player:this.player,debug:this.debug,mode:this.mode,hasExplicitMode:this.hasExplicitMode,continueContentDuringBreak:this.continueContentDuringBreak,manifestService:this.manifestService,breakScheduler:this.breakScheduler,adPlayerController:this.adPlayerController,pauseAdController:this.pauseAdController,breakLifecycle:this.breakLifecycle,cmcdAdReporter:this.cmcdAdReporter,lensReporter:this.lensReporter,adBreakStatusTracker:this.adBreakStatusTracker,emit:(e,t)=>this.emit(e,t),diagnose:(e,t,s)=>this.diagnose(e,t,s),log:(...e)=>this.log(...e),endSessionInternal:e=>this.endSessionInternal(e),notedManifestBreakIds:e=>C(e,this.seenManifestBreakIds)});for(const[e,t]of this.contentListeners())this.player.on(e,t);this.log("OptiViewAds SDK initialized")}initSsai(e){if(!e.gam)throw new Error('[OptiViewAds] mode "ssai" requires a gam config.');if(!e.ssai?.networkCode)throw new Error('[OptiViewAds] mode "ssai" requires an ssai config (networkCode).');const t=e.ssai;this.diagnosticBuffer=new D(e.diagnostics?.bufferSize);const s=e.autoplay??!1;this.state.configSummary={mode:this.mode,adPreload:"n/a",adInsertion:"ssai",chaining:{enabled:!1,maxGapSeconds:0},tuneIn:{enabled:!1,minBreakDurationSeconds:0},gam:{networkCode:t.networkCode,hasAssetParameters:!1,streamActivityMonitorId:e.gam.streamActivityMonitorId},ssai:{maxBitrate:e.maxBitrate,autoplay:s},continueContentDuringBreak:this.continueContentDuringBreak},this.state.ssaiController=new h(this.player,{gam:e.gam,ssai:t,maxBitrate:e.maxBitrate,autoplay:s,debug:this.debug},{emit:(e,t)=>this.emit(e,t),diagnose:(e,t,s)=>this.diagnose(e,t,s),log:(...e)=>this.log(...e)}),this.player.on("volumechange",()=>{this.emit("volumechange",{type:"volumechange",timestamp:Date.now(),muted:this.player.muted,volume:this.player.volume})}),this.sessionStarter=new H(this.state,{player:this.player,debug:this.debug,mode:this.mode,hasExplicitMode:this.hasExplicitMode,continueContentDuringBreak:this.continueContentDuringBreak,manifestService:this.manifestService,breakScheduler:this.breakScheduler,adPlayerController:this.adPlayerController,pauseAdController:this.pauseAdController,breakLifecycle:this.breakLifecycle,cmcdAdReporter:this.cmcdAdReporter,lensReporter:this.lensReporter,adBreakStatusTracker:this.adBreakStatusTracker,emit:(e,t)=>this.emit(e,t),diagnose:(e,t,s)=>this.diagnose(e,t,s),log:(...e)=>this.log(...e),endSessionInternal:e=>this.endSessionInternal(e),notedManifestBreakIds:e=>C(e,this.seenManifestBreakIds)});for(const[e,t]of this.contentListeners())this.player.on(e,t);this.log("OptiViewAds SDK initialized (SSAI mode)")}contentListeners(){const e=[["seeked",this.onContentSeeked],["waiting",this.onContentWaiting],["playing",this.onContentPlaying],["pause",this.onContentPause],["ended",this.onContentEnded],["error",this.onContentError]];return this.metadataCueTracker&&e.push(["timedmetadata",this.onTimedMetadata]),e}async startSession(e){return this.sessionStarter.startSession(e)}play(){return this.adPlayerController?.isAdPlaying()?(this.log("play() suppressed — ad break is active"),Promise.resolve()):this.player.play()}pause(){this.adPlayerController?.isAdPlaying()?this.log("pause() suppressed — ad break is active"):this.player.pause()}seek(e){if(!this.state.sessionActive)return;const t=this.breakScheduler?.getActiveBreak();t?.controls?.snapback?this.log("seek() suppressed — break has snapback enabled"):(this.breakScheduler?.notifyViewerSeek(),this.player.seek(e))}get muted(){return this.adPlayerController?this.adPlayerController.muted:this.player.muted}set muted(e){this.adPlayerController?this.adPlayerController.muted=e:this.player.muted=e}get volume(){return this.adPlayerController?this.adPlayerController.volume:this.player.volume}set volume(e){this.adPlayerController?this.adPlayerController.volume=e:this.player.volume=e}skipAd(){const e=this.adBreakStatusTracker.activeBreak;if(!this.state.sessionActive||!this.adPlayerController?.isAdPlaying()||!e)return this.log("skipAd() suppressed — no active ad break"),!1;const t=e.controls?.skipOffset;if(null==t)return this.log(`skipAd() suppressed — break '${e.id}' declares no controls.skipOffset`),this.diagnose("DA-AD-SKIP-SUPPRESSED","Skip requested but break declares no skipOffset",{breakId:e.id}),!1;const s=this.adBreakStatusTracker.activeBreakElapsedSec;return s<t?(this.log(`skipAd() suppressed — skipOffset ${t}s not reached (${s}s)`),this.diagnose("DA-AD-SKIP-SUPPRESSED","Skip requested before skipOffset",{breakId:e.id,skipOffset:t,elapsedSec:s}),!1):(this.log(`skipAd() — skipping break '${e.id}' at ${s}s (skipOffset ${t}s)`),this.diagnose("DA-AD-SKIPPED","Break skipped by viewer",{breakId:e.id,skipOffset:t,elapsedSec:s}),this.cmcdAdReporter.onSkipRequested(e.id),this.adPlayerController.skipBreak(),!0)}clickAd(){const e=this.adBreakStatusTracker.activeBreak,t=this.adPlayerController?.currentAdAsset()??null;if(!(this.state.sessionActive&&this.adPlayerController?.isAdPlaying()&&e&&t))return this.log("clickAd() suppressed — no ad on screen"),null;const s=t.interaction?.clickThrough;return this.diagnose("DA-AD-CLICKED","Ad clicked",{breakId:e.id,assetId:t.id,clickThrough:s??""}),this.emit("adclick",{type:"adclick",timestamp:Date.now(),break:e,format:this.effectiveFormatOf(e),asset:t,...s?{clickThrough:s}:{}}),s??null}endSession(){this.state.sessionActive&&this.endSessionInternal()}updateAssetParameters(e){if(this.state.sessionActive){if("ssai"===this.mode||this.state.steeredSsaiActive)return this.state.ssaiController.updateAssetParameters(e),void this.log("Asset parameters updated (SSAI)");this.adPlayerController.updateAssetParameters(e),this.log("Asset parameters updated")}else console.warn("[OptiViewAds] updateAssetParameters called but no active session.")}updateAssetParameterMacros(e){if(this.state.sessionActive){if("ssai"===this.mode||this.state.steeredSsaiActive)return this.state.ssaiController.updateAssetParameterMacros(e),void this.log("Asset parameter macros updated (SSAI)");this.adPlayerController.updateAssetParameterMacros(e),this.log("Asset parameter macros updated")}else console.warn("[OptiViewAds] updateAssetParameterMacros called but no active session.")}endSessionInternal(e="end-session"){this.state.sessionActive=!1,this.state.sessionGeneration++,this.breakLifecycle?.reportAbandonedBreak(e),"ssai"===this.mode?this.state.ssaiController?.stop():(this.state.steeredSsaiActive&&(this.state.ssaiController?.stop(),delete this.state.ssaiController,this.state.steeredSsaiActive=!1),this.manifestService?.reset(),this.breakScheduler?.stop(),this.breakScheduler?.destroy(),this.adBreakStatusTracker.resetAdBreakStatus(),this.state.pauseAdTickInterval&&(clearInterval(this.state.pauseAdTickInterval),this.state.pauseAdTickInterval=null),this.sessionStarter?.clearHeldImmediatePreRollArm(),this.pauseAdController?.reset(),this.breakTransitionTimer?.reset(),this.adPlayerController?.stopActiveBreak(),this.adPlayerController?.releaseContentHold(),this.adPlayerController?.endGamSession()),this.state.clearSessionIdentity(),this.anvatoObservedLogged.clear(),this.seenManifestBreakIds.clear(),this.cmcdAdReporter.onSessionEnd(),this.lensReporter.endSession(),this.diagnose("DA-SESSION-ENDED","Session ended"),this.log("Session ended")}addEventListener(e,t){this.eventHandlers.has(e)||this.eventHandlers.set(e,new Set),this.eventHandlers.get(e).add(t)}removeEventListener(e,t){const s=this.eventHandlers.get(e);s&&s.delete(t)}emit(e,t){this.recordEventTimeline(t),this.cmcdAdReporter.onEvent(t);const s=this.eventHandlers.get(e);if(s)for(const e of s)try{e(t)}catch(e){this.log("Event handler error:",e)}}recordEventTimeline(e){const t={eventType:e.type},s=e;s.source&&(t.source=s.source),s.break?.id&&(t.breakId=s.break.id),s.asset?.id&&(t.assetId=s.asset.id),this.diagnosticBuffer.record({ts:e.timestamp,level:"aderror"===e.type?"error":"info",code:"DA-EVENT",category:"event",message:`SDK event: ${e.type}`,context:t})}onDiagnostic(e){this.diagnosticHandlers.add(e)}offDiagnostic(e){this.diagnosticHandlers.delete(e)}exportDiagnostics(){const e={...this.state.configSummary,...this.state.manifestOrigin?{manifestOrigin:this.state.manifestOrigin}:{},...this.state.configSummary.ssai&&this.state.stitcherOrigin?{ssai:{...this.state.configSummary.ssai,stitcherOrigin:this.state.stitcherOrigin}}:{}};return{sdkVersion:O,generatedAt:Date.now(),userAgent:"undefined"!=typeof navigator?navigator.userAgent:null,config:e,diagnostics:this.diagnosticBuffer.getAll()}}diagnose(e,t,s){if(this.destroyed)return;const r=E[e],i={ts:Date.now(),level:r?.level??"info",code:e,category:r?.category??"unknown",message:t,...s?{context:s}:{}};this.diagnosticBuffer.record(i);for(const e of this.diagnosticHandlers)try{e(i)}catch(e){this.log("Diagnostic handler error:",e)}this.debug&&L("[OptiViewAds]",e,t,s??"")}isAdPlaying(){return this.adPlayerController?.isAdPlaying()??!1}isPictureInPicture(){return this.adPlayerController?.isPictureInPicture()??!1}getPresentationState(){return{pictureInPicture:this.isPictureInPicture(),showing:this.adPlayerController?.isShowingAd()?"ad":"content",insertion:this.adPlayerController?.currentInsertionMode()??"overlay",windowOwner:this.adPlayerController?.pictureInPictureOwner()??null}}effectiveFormatOf(e){const t=this.adPlayerController?.declaredFormatOf(e)??w(e);return P(t,this.isPictureInPicture())}isSessionActive(){return this.state.sessionActive}getAdBreakStatus(){return this.adBreakStatusTracker.getAdBreakStatus()}destroy(){this.contentErrorReloadGuard&&(clearTimeout(this.contentErrorReloadGuard),this.contentErrorReloadGuard=null);for(const[e,t]of this.contentListeners())this.player.off(e,t);this.state.sessionActive&&this.endSessionInternal("destroy"),this.manifestService?.destroy(),this.pauseAdController?.destroy(),this.adPlayerController?.destroy(),this.state.ssaiController?.stop(),this.lensReporter.destroy(),this.eventHandlers.clear(),this.diagnosticHandlers.clear(),this.destroyed=!0,this.log("Destroyed")}toPlaybackError(e,t){const s=e;if(s&&("number"==typeof s.code||s.message)){const e="number"==typeof s.code?` (code ${s.code})`:"",r=s.message?`: ${s.message}`:"";return new Error(`${t}${e}${r}`)}return new Error(t)}log(...e){this.debug&&L("[OptiViewAds]",...e)}}
1
+ import{DEFAULT_MODE as e,DEFAULT_AD_PRELOAD_MODE as t,DEFAULT_AD_BREAK_CONTENT_RECOVERY as s,DEFAULT_AD_INSERTION_MODE as i,DEFAULT_AD_BREAK_CUT_SAFETY_MARGIN_SEC as r,DEFAULT_DOUBLE_BOX_AUDIO as a,resolveChaining as n,resolveTuneIn as o,resolveBreakWarnings as d,resolvePdtGraceSeconds as l}from"./types/OptiViewAdsConfig";import{SsaiController as h}from"./services/SsaiController";import{resolvePreloadMode as c}from"./services/detectPreloadMode";import{resolveContentRecovery as u}from"./services/detectContentRecovery";import{emitResolvedModeDiagnostics as m}from"./services/resolvedModeDiagnostics";import{isSingleSurfaceWebDevice as p,resolveInsertionMode as g}from"./services/detectInsertionMode";import{ManifestService as k}from"./services/ManifestService";import{BreakScheduler as f,systemClock as y}from"./services/BreakScheduler";import{MetadataCueTracker as S}from"./services/MetadataCueTracker";import{armBreakFromPresentedCue as v,cueAnchorForBreak as A,diagnoseAnvatoCueObserved as C,notedManifestBreakIds as b}from"./services/anvatoCueRuntime";import{AdPlayerController as P}from"./services/AdPlayerController";import{effectiveFormat as w}from"./services/pictureInPicture";import{resolveBreakFormat as B}from"./services/AdBreakSequencer";import{connectPauseAd as T}from"./services/adPlayer/connectPauseAd";import{BreakTransitionTimer as I}from"./services/BreakTransitionTimer";import{LensReporter as R}from"./services/LensReporter";import{CmcdAdReporter as D}from"./services/CmcdAdReporter";import{DiagnosticBuffer as E}from"./diagnostics/DiagnosticBuffer";import{recordEventTimeline as O}from"./diagnostics/recordEventTimeline";import{DIAGNOSTIC_CODES as M}from"./diagnostics/errorCodes";import{SDK_VERSION as L}from"./generated/version";import{playbackErrorContext as x}from"./diagnostics/playbackErrorContext";import{debugLog as G}from"./diagnostics/debugLog";import{AdBreakStatusTracker as H}from"./session/AdBreakStatusTracker";import{BreakLifecycle as F}from"./session/BreakLifecycle";import{SessionStarter as V}from"./session/SessionStarter";import{SessionState as $}from"./session/SessionState";import{LiveStartPushbackController as q}from"./services/LiveStartPushbackController";export class OptiViewAds{static get version(){return L}constructor(h){if(this.contentErrorReloadGuard=null,this.CONTENT_ERROR_RELOAD_GUARD_MS=5e3,this.eventHandlers=new Map,this.diagnosticHandlers=new Set,this.destroyed=!1,this.continueContentDuringBreak=!1,this.state=new $,this.metadataCueTracker=null,this.anvatoObservedLogged=new Set,this.seenManifestBreakIds=new Set,this.player=h.player,this.liveStartPushback=new q(this.player,h.liveStartPushback,{blocked:()=>!this.state.sessionActive||this.state.channelSwitchInFlight||!!this.adPlayerController?.isAdPlaying()||!!this.state.heldImmediatePreRollId,setSeeking:e=>this.breakScheduler?.setStartupSeeking(e),diagnose:(e,t,s)=>this.diagnose(e,t,s)},h.ptsSource),this.debug=h.debug??!1,this.mode=h.mode??e,this.hasExplicitMode=void 0!==h.mode,this.lensReporter=new R((...e)=>this.log(...e)),this.cmcdAdReporter=new D(()=>this.lensReporter.handle,(...e)=>this.log(...e)),this.adBreakStatusTracker=new H({emit:(e,t)=>this.emit(e,t),effectiveFormatOf:e=>this.effectiveFormatOf(e),secondsUntilBreak:e=>this.breakScheduler?.getSecondsUntilBreak(e)??void 0,breakTransitionTimer:()=>this.breakTransitionTimer}),this.onContentSeeked=()=>{const e=this.breakScheduler?.getActiveBreak();if(!e?.controls?.snapback)return;if(this.state.snapbackSeekInFlight)return void(this.state.snapbackSeekInFlight=!1);const t="number"==typeof e.start?e.start:this.player.currentTime;Math.abs(this.player.currentTime-t)<=.5||(this.log("Snapback: seek detected during locked break, snapping back to break start"),this.state.snapbackSeekInFlight=!0,this.player.seek(t))},this.onContentWaiting=()=>{this.adPlayerController?.isAdPlaying()||this.emit("waiting",{type:"waiting",timestamp:Date.now(),source:"content"})},this.onContentPlaying=()=>{this.adPlayerController?.isAdPlaying()||(this.breakScheduler?.markPlaybackStart(),this.breakTransitionTimer?.settle("out-of-break"),!1!==this.pauseAdController?.onResume()?this.emit("playing",{type:"playing",timestamp:Date.now(),source:"content"}):this.player.pause())},this.onContentPause=()=>{this.adPlayerController?.isAdPlaying()||this.breakScheduler?.isAdStartDelayActive()||this.pauseAdController?.onPause()},this.onContentEnded=()=>{this.adPlayerController?.isAdPlaying()||this.breakScheduler?.markPlaybackEnd()},this.onContentError=e=>{this.sessionStarter?.cancelHeldImmediatePreRollOnContentError();const t=this.toPlaybackError(e,"Content playback error");this.diagnose("DA-CONTENT-PLAYBACK-ERROR",t.message,x(e)),this.breakScheduler?.setContentReloading(!0),this.contentErrorReloadGuard&&clearTimeout(this.contentErrorReloadGuard),this.contentErrorReloadGuard=setTimeout(()=>{this.contentErrorReloadGuard=null,this.breakScheduler?.setContentReloading(!1)},this.CONTENT_ERROR_RELOAD_GUARD_MS),this.emit("aderror",{type:"aderror",timestamp:Date.now(),source:"content",error:t})},this.onTimedMetadata=e=>{if(!e)return;const t=e,s=this.metadataCueTracker?.handleCue(t)??!1;C(t,s,this.metadataCueTracker,this.anvatoObservedLogged,this.player.currentTime,(e,t,s)=>this.diagnose(e,t,s)),"presented"===t.phase&&v(t,this.metadataCueTracker,this.breakScheduler)},this.continueContentDuringBreak=h.continueContentDuringBreak??!1,"ssai"===this.mode)return void this.initSsai(h);if(!h.createAdAdapter)throw new Error("[OptiViewAds] createAdAdapter is required. Use the @dolby-optiview/ads-sdk package for a default HLS.js ad player, or supply your own createAdAdapter factory.");this.state.steeredSsaiOptions={maxBitrate:h.maxBitrate,autoplay:h.autoplay??!1,streamActivityMonitorId:h.gam?.streamActivityMonitorId};const w=c(h.adPreload??t),B=h.adBreakContentRecovery??s,O=u(B),M=g(h.adInsertion??i),L=n(h.chaining),G=o(h.tuneIn),N=d(h.breakWarnings),K=l(h.pdtGraceSeconds);"anvatoCue"===h.ptsSource&&(this.metadataCueTracker=new S(this.diagnose.bind(this))),this.diagnosticBuffer=new E(h.diagnostics?.bufferSize),this.breakTransitionTimer=new I(e=>{this.diagnose("DA-BREAK-TRANSITION",`Transition ${e.kind} took ${e.durationMs}ms`,{transition:e.kind,durationMs:e.durationMs,breakId:e.breakId,adPreload:w,adInsertion:M,...e.phases?{phases:e.phases}:{}})}),this.state.configSummary={mode:this.mode,adPreload:w,adBreakContentRecovery:O,adInsertion:M,chaining:{enabled:L.enabled,maxGapSeconds:L.maxGapSeconds},tuneIn:{enabled:G.enabled,minBreakDurationSeconds:G.minBreakDurationSeconds},breakWarnings:{seconds:N.seconds},ptsSource:h.ptsSource??"mediaTime",continueContentDuringBreak:this.continueContentDuringBreak,gam:h.gam?{hasAssetParameters:!1,streamActivityMonitorId:h.gam.streamActivityMonitorId}:void 0},m({adPreload:h.adPreload??t,adInsertion:h.adInsertion??i,adBreakContentRecovery:B},{preloadMode:w,insertionMode:M,contentRecovery:O},(e,t,s)=>this.diagnose(e,t,s)),this.manifestService=new k(this.debug,h.interceptManifestResponse,(e,t,s)=>this.diagnose(e,t,s),h.interceptManifestRequest),this.breakScheduler=new f(this.player,this.debug,L,void 0,G,(e,t,s)=>this.diagnose(e,t,s),N,this.metadataCueTracker,K),this.adPlayerController=new P(h.player,h.container,h.playerContainer,h.createAdAdapter,this.debug,h.gam,w,M,h.adBreakCutSafetyMarginSec??r,h.doubleBoxAudio??a,p("undefined"!=typeof navigator?navigator.userAgent:"","undefined"!=typeof navigator?navigator.maxTouchPoints??0:0),y,O),this.adPlayerController.setTransitionPhaseReporter(this.debug?e=>this.breakTransitionTimer?.phase(e):null),this.adPlayerController.setResumeCueAnchorResolver(e=>A(this.metadataCueTracker,e)),this.adPlayerController.setChainResolver(L.enabled?e=>this.breakScheduler.getChainedSuccessor(e):null),this.adPlayerController.initialize();const _=(e,t)=>void 0===e||void 0===t?{}:{adIndex:e,totalAds:t};this.adPlayerController.setGamEventCallbacks({onAdFirstQuartile:(e,t,s,i)=>{this.emit("adfirstquartile",{type:"adfirstquartile",timestamp:Date.now(),break:e,format:this.effectiveFormatOf(e),asset:t,..._(s,i)})},onAdMidpoint:(e,t,s,i)=>{this.emit("admidpoint",{type:"admidpoint",timestamp:Date.now(),break:e,format:this.effectiveFormatOf(e),asset:t,..._(s,i)})},onAdThirdQuartile:(e,t,s,i)=>{this.emit("adthirdquartile",{type:"adthirdquartile",timestamp:Date.now(),break:e,format:this.effectiveFormatOf(e),asset:t,..._(s,i)})}}),this.adPlayerController.setDiagnoseHandler((e,t,s)=>{this.diagnose(e,t,s)}),this.pauseAdController=T(this.adPlayerController,{debug:this.debug,diagnose:(e,t,s)=>this.diagnose(e,t,s)}),this.adPlayerController.setVolumeChangeCallback((e,t)=>{this.emit("volumechange",{type:"volumechange",timestamp:Date.now(),muted:e,volume:t})}),this.breakLifecycle=new F(this.state,{adPlayerController:this.adPlayerController,breakScheduler:this.breakScheduler,manifestService:this.manifestService,breakTransitionTimer:this.breakTransitionTimer,cmcdAdReporter:this.cmcdAdReporter,adBreakStatusTracker:this.adBreakStatusTracker,emit:(e,t)=>this.emit(e,t),diagnose:(e,t,s)=>this.diagnose(e,t,s),log:(...e)=>this.log(...e),effectiveFormatOf:e=>this.effectiveFormatOf(e),onBreakSettled:()=>this.sessionStarter?.applyPendingChannelSwitch()}),this.sessionStarter=new V(this.state,{player:this.player,debug:this.debug,mode:this.mode,hasExplicitMode:this.hasExplicitMode,continueContentDuringBreak:this.continueContentDuringBreak,startLivePushback:()=>this.liveStartPushback.start(),manifestService:this.manifestService,breakScheduler:this.breakScheduler,adPlayerController:this.adPlayerController,pauseAdController:this.pauseAdController,breakLifecycle:this.breakLifecycle,cmcdAdReporter:this.cmcdAdReporter,lensReporter:this.lensReporter,adBreakStatusTracker:this.adBreakStatusTracker,emit:(e,t)=>this.emit(e,t),diagnose:(e,t,s)=>this.diagnose(e,t,s),log:(...e)=>this.log(...e),endSessionInternal:e=>this.endSessionInternal(e),notedManifestBreakIds:e=>b(e,this.seenManifestBreakIds)});for(const[e,t]of this.contentListeners())this.player.on(e,t);this.log("OptiViewAds SDK initialized")}initSsai(e){if(!e.gam)throw new Error('[OptiViewAds] mode "ssai" requires a gam config.');if(!e.ssai?.networkCode)throw new Error('[OptiViewAds] mode "ssai" requires an ssai config (networkCode).');const t=e.ssai;this.diagnosticBuffer=new E(e.diagnostics?.bufferSize);const s=e.autoplay??!1;this.state.configSummary={mode:this.mode,adPreload:"n/a",adInsertion:"ssai",chaining:{enabled:!1,maxGapSeconds:0},tuneIn:{enabled:!1,minBreakDurationSeconds:0},gam:{networkCode:t.networkCode,hasAssetParameters:!1,streamActivityMonitorId:e.gam.streamActivityMonitorId},ssai:{maxBitrate:e.maxBitrate,autoplay:s},continueContentDuringBreak:this.continueContentDuringBreak},this.state.ssaiController=new h(this.player,{gam:e.gam,ssai:t,maxBitrate:e.maxBitrate,autoplay:s,debug:this.debug},{emit:(e,t)=>this.emit(e,t),diagnose:(e,t,s)=>this.diagnose(e,t,s),log:(...e)=>this.log(...e)}),this.player.on("volumechange",()=>{this.emit("volumechange",{type:"volumechange",timestamp:Date.now(),muted:this.player.muted,volume:this.player.volume})}),this.sessionStarter=new V(this.state,{player:this.player,debug:this.debug,mode:this.mode,hasExplicitMode:this.hasExplicitMode,continueContentDuringBreak:this.continueContentDuringBreak,startLivePushback:()=>this.liveStartPushback.start(),manifestService:this.manifestService,breakScheduler:this.breakScheduler,adPlayerController:this.adPlayerController,pauseAdController:this.pauseAdController,breakLifecycle:this.breakLifecycle,cmcdAdReporter:this.cmcdAdReporter,lensReporter:this.lensReporter,adBreakStatusTracker:this.adBreakStatusTracker,emit:(e,t)=>this.emit(e,t),diagnose:(e,t,s)=>this.diagnose(e,t,s),log:(...e)=>this.log(...e),endSessionInternal:e=>this.endSessionInternal(e),notedManifestBreakIds:e=>b(e,this.seenManifestBreakIds)});for(const[e,t]of this.contentListeners())this.player.on(e,t);this.log("OptiViewAds SDK initialized (SSAI mode)")}contentListeners(){const e=[["seeked",this.onContentSeeked],["waiting",this.onContentWaiting],["playing",this.onContentPlaying],["pause",this.onContentPause],["ended",this.onContentEnded],["error",this.onContentError]];return this.metadataCueTracker&&e.push(["timedmetadata",this.onTimedMetadata]),e}async startSession(e){return this.sessionStarter.startSession(e)}play(){return this.adPlayerController?.isAdPlaying()?(this.log("play() suppressed — ad break is active"),Promise.resolve()):this.player.play()}pause(){this.adPlayerController?.isAdPlaying()?this.log("pause() suppressed — ad break is active"):this.player.pause()}seek(e){if(!this.state.sessionActive)return;const t=this.breakScheduler?.getActiveBreak();t?.controls?.snapback?this.log("seek() suppressed — break has snapback enabled"):(this.breakScheduler?.notifyViewerSeek(),this.player.seek(e))}get muted(){return this.adPlayerController?this.adPlayerController.muted:this.player.muted}set muted(e){this.adPlayerController?this.adPlayerController.muted=e:this.player.muted=e}get volume(){return this.adPlayerController?this.adPlayerController.volume:this.player.volume}set volume(e){this.adPlayerController?this.adPlayerController.volume=e:this.player.volume=e}skipAd(){const e=this.adBreakStatusTracker.activeBreak;if(!this.state.sessionActive||!this.adPlayerController?.isAdPlaying()||!e)return this.log("skipAd() suppressed — no active ad break"),!1;const t=e.controls?.skipOffset;if(null==t)return this.log(`skipAd() suppressed — break '${e.id}' declares no controls.skipOffset`),this.diagnose("DA-AD-SKIP-SUPPRESSED","Skip requested but break declares no skipOffset",{breakId:e.id}),!1;const s=this.adBreakStatusTracker.activeBreakElapsedSec;return s<t?(this.log(`skipAd() suppressed — skipOffset ${t}s not reached (${s}s)`),this.diagnose("DA-AD-SKIP-SUPPRESSED","Skip requested before skipOffset",{breakId:e.id,skipOffset:t,elapsedSec:s}),!1):(this.log(`skipAd() — skipping break '${e.id}' at ${s}s (skipOffset ${t}s)`),this.diagnose("DA-AD-SKIPPED","Break skipped by viewer",{breakId:e.id,skipOffset:t,elapsedSec:s}),this.cmcdAdReporter.onSkipRequested(e.id),this.adPlayerController.skipBreak(),!0)}clickAd(){const e=this.adBreakStatusTracker.activeBreak,t=this.adPlayerController?.currentAdAsset()??null;if(!(this.state.sessionActive&&this.adPlayerController?.isAdPlaying()&&e&&t))return this.log("clickAd() suppressed — no ad on screen"),null;const s=t.interaction?.clickThrough;return this.diagnose("DA-AD-CLICKED","Ad clicked",{breakId:e.id,assetId:t.id,clickThrough:s??""}),this.emit("adclick",{type:"adclick",timestamp:Date.now(),break:e,format:this.effectiveFormatOf(e),asset:t,...s?{clickThrough:s}:{}}),s??null}endSession(){this.state.sessionActive&&this.endSessionInternal()}updateAssetParameters(e){if(this.state.sessionActive){if("ssai"===this.mode||this.state.steeredSsaiActive)return this.state.ssaiController.updateAssetParameters(e),void this.log("Asset parameters updated (SSAI)");this.adPlayerController.updateAssetParameters(e),this.log("Asset parameters updated")}else console.warn("[OptiViewAds] updateAssetParameters called but no active session.")}updateAssetParameterMacros(e){if(this.state.sessionActive){if("ssai"===this.mode||this.state.steeredSsaiActive)return this.state.ssaiController.updateAssetParameterMacros(e),void this.log("Asset parameter macros updated (SSAI)");this.adPlayerController.updateAssetParameterMacros(e),this.log("Asset parameter macros updated")}else console.warn("[OptiViewAds] updateAssetParameterMacros called but no active session.")}endSessionInternal(e="end-session"){this.liveStartPushback.stop(),this.state.sessionActive=!1,this.state.sessionGeneration++,this.breakLifecycle?.reportAbandonedBreak(e),"ssai"===this.mode?this.state.ssaiController?.stop():(this.state.steeredSsaiActive&&(this.state.ssaiController?.stop(),delete this.state.ssaiController,this.state.steeredSsaiActive=!1),this.manifestService?.reset(),this.breakScheduler?.stop(),this.breakScheduler?.destroy(),this.adBreakStatusTracker.resetAdBreakStatus(),this.state.pauseAdTickInterval&&(clearInterval(this.state.pauseAdTickInterval),this.state.pauseAdTickInterval=null),this.sessionStarter?.clearHeldImmediatePreRollArm(),this.pauseAdController?.reset(),this.breakTransitionTimer?.reset(),this.adPlayerController?.stopActiveBreak(),this.adPlayerController?.releaseContentHold(),this.adPlayerController?.endGamSession()),this.state.clearSessionIdentity(),this.anvatoObservedLogged.clear(),this.seenManifestBreakIds.clear(),this.cmcdAdReporter.onSessionEnd(),this.lensReporter.endSession(),this.diagnose("DA-SESSION-ENDED","Session ended"),this.log("Session ended")}addEventListener(e,t){this.eventHandlers.has(e)||this.eventHandlers.set(e,new Set),this.eventHandlers.get(e).add(t)}removeEventListener(e,t){const s=this.eventHandlers.get(e);s&&s.delete(t)}emit(e,t){this.recordEventTimeline(t),this.cmcdAdReporter.onEvent(t);const s=this.eventHandlers.get(e);if(s)for(const e of s)try{e(t)}catch(e){this.log("Event handler error:",e)}}recordEventTimeline(e){O(this.diagnosticBuffer,e)}onDiagnostic(e){this.diagnosticHandlers.add(e)}offDiagnostic(e){this.diagnosticHandlers.delete(e)}exportDiagnostics(){const e={...this.state.configSummary,...this.state.manifestOrigin?{manifestOrigin:this.state.manifestOrigin}:{},...this.state.configSummary.ssai&&this.state.stitcherOrigin?{ssai:{...this.state.configSummary.ssai,stitcherOrigin:this.state.stitcherOrigin}}:{}};return{sdkVersion:L,generatedAt:Date.now(),userAgent:"undefined"!=typeof navigator?navigator.userAgent:null,config:e,diagnostics:this.diagnosticBuffer.getAll()}}diagnose(e,t,s){if(this.destroyed)return;const i=M[e],r={ts:Date.now(),level:i?.level??"info",code:e,category:i?.category??"unknown",message:t,...s?{context:s}:{}};this.diagnosticBuffer.record(r);for(const e of this.diagnosticHandlers)try{e(r)}catch(e){this.log("Diagnostic handler error:",e)}this.debug&&G("[OptiViewAds]",e,t,s??"")}isAdPlaying(){return this.adPlayerController?.isAdPlaying()??!1}isPictureInPicture(){return this.adPlayerController?.isPictureInPicture()??!1}getPresentationState(){return{pictureInPicture:this.isPictureInPicture(),showing:this.adPlayerController?.isShowingAd()?"ad":"content",insertion:this.adPlayerController?.currentInsertionMode()??"overlay",windowOwner:this.adPlayerController?.pictureInPictureOwner()??null}}effectiveFormatOf(e){const t=this.adPlayerController?.declaredFormatOf(e)??B(e);return w(t,this.isPictureInPicture())}isSessionActive(){return this.state.sessionActive}getAdBreakStatus(){return this.adBreakStatusTracker.getAdBreakStatus()}destroy(){this.contentErrorReloadGuard&&(clearTimeout(this.contentErrorReloadGuard),this.contentErrorReloadGuard=null);for(const[e,t]of this.contentListeners())this.player.off(e,t);this.state.sessionActive&&this.endSessionInternal("destroy"),this.manifestService?.destroy(),this.pauseAdController?.destroy(),this.adPlayerController?.destroy(),this.state.ssaiController?.stop(),this.lensReporter.destroy(),this.eventHandlers.clear(),this.diagnosticHandlers.clear(),this.destroyed=!0,this.log("Destroyed")}toPlaybackError(e,t){const s=e;if(s&&("number"==typeof s.code||s.message)){const e="number"==typeof s.code?` (code ${s.code})`:"",i=s.message?`: ${s.message}`:"";return new Error(`${t}${e}${i}`)}return new Error(t)}log(...e){this.debug&&G("[OptiViewAds]",...e)}}
@@ -0,0 +1,3 @@
1
+ import type { DiagnosticBuffer } from './DiagnosticBuffer';
2
+ import type { OptiViewAdsEventMap, OptiViewAdsEventType } from '../types/Events';
3
+ export declare function recordEventTimeline(buffer: DiagnosticBuffer, data: OptiViewAdsEventMap[OptiViewAdsEventType]): void;
@@ -0,0 +1 @@
1
+ export function recordEventTimeline(e,t){const r={eventType:t.type},o=t;o.source&&(r.source=o.source),o.break?.id&&(r.breakId=o.break.id),o.asset?.id&&(r.assetId=o.asset.id),e.record({ts:t.timestamp,level:"aderror"===t.type?"error":"info",code:"DA-EVENT",category:"event",message:`SDK event: ${t.type}`,context:r})}
@@ -74,6 +74,16 @@ export declare const DIAGNOSTIC_CODES: {
74
74
  readonly level: "info";
75
75
  readonly 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.";
76
76
  };
77
+ readonly "DA-ANVATO-CUE-SEGMENT-ANCHORED": {
78
+ readonly category: "break";
79
+ readonly level: "warn";
80
+ readonly 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.";
81
+ };
82
+ readonly "DA-ANVATO-CUE-OFFSET-REJECTED": {
83
+ readonly category: "break";
84
+ readonly level: "warn";
85
+ readonly 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.";
86
+ };
77
87
  readonly "DA-PRELOAD-FAILED": {
78
88
  readonly category: "preload";
79
89
  readonly level: "warn";
@@ -204,6 +214,11 @@ export declare const DIAGNOSTIC_CODES: {
204
214
  readonly level: "error";
205
215
  readonly 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.";
206
216
  };
217
+ readonly "DA-GAM-POD-MID-BREAK-END": {
218
+ readonly category: "gam";
219
+ readonly level: "warn";
220
+ readonly 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.";
221
+ };
207
222
  readonly "DA-VENDOR-CONFIG-UNKNOWN-TYPE": {
208
223
  readonly category: "manifest";
209
224
  readonly level: "info";
@@ -239,11 +254,41 @@ export declare const DIAGNOSTIC_CODES: {
239
254
  readonly level: "error";
240
255
  readonly summary: "The ad player reported a playback error during a break.";
241
256
  };
257
+ readonly "DA-AD-LOAD-RETRIED": {
258
+ readonly category: "playback";
259
+ readonly level: "warn";
260
+ readonly 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\".";
261
+ };
262
+ readonly "DA-AD-URI-MISSING": {
263
+ readonly category: "playback";
264
+ readonly level: "error";
265
+ readonly summary: "The ad asset had no usable media URI, VAST tag URL or render surface; reported as CMCD adec.";
266
+ };
267
+ readonly "DA-AD-MEDIA-LOAD-FAILED": {
268
+ readonly category: "playback";
269
+ readonly level: "error";
270
+ readonly summary: "The ad player could not fetch the ad media (network or HTTP failure); reported as CMCD adec.";
271
+ };
272
+ readonly "DA-AD-MEDIA-UNSUPPORTED": {
273
+ readonly category: "playback";
274
+ readonly level: "error";
275
+ readonly summary: "The ad player could not decode the ad media or does not support its format; reported as CMCD adec.";
276
+ };
277
+ readonly "DA-AD-START-TIMEOUT": {
278
+ readonly category: "playback";
279
+ readonly level: "error";
280
+ readonly summary: "The ad did not load, render a first frame or start within its start budget; reported as CMCD adec.";
281
+ };
242
282
  readonly "DA-AD-START-INTERRUPTED": {
243
283
  readonly category: "playback";
244
284
  readonly level: "warn";
245
285
  readonly 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.";
246
286
  };
287
+ readonly "DA-AD-DURATION-PREPARED": {
288
+ readonly category: "playback";
289
+ readonly level: "info";
290
+ readonly 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.";
291
+ };
247
292
  readonly "DA-DELIVERY-MODE-RESOLVED": {
248
293
  readonly category: "session";
249
294
  readonly level: "info";
@@ -319,6 +364,31 @@ export declare const DIAGNOSTIC_CODES: {
319
364
  readonly level: "error";
320
365
  readonly summary: "Google IMA reported an error while loading or playing a VAST (client-side / CSAI) ad.";
321
366
  };
367
+ readonly "DA-VAST-NO-FILL": {
368
+ readonly category: "gam";
369
+ readonly level: "error";
370
+ readonly summary: "The VAST ad server returned no ad (empty response, no ads after wrappers or no assets); reported as CMCD adec.";
371
+ };
372
+ readonly "DA-VAST-TIMEOUT": {
373
+ readonly category: "gam";
374
+ readonly level: "error";
375
+ readonly summary: "The VAST response or its media file did not load in time; reported as CMCD adec.";
376
+ };
377
+ readonly "DA-VAST-MALFORMED": {
378
+ readonly category: "gam";
379
+ readonly level: "error";
380
+ readonly summary: "The VAST response could not be parsed or uses an unsupported VAST version; reported as CMCD adec.";
381
+ };
382
+ readonly "DA-VAST-REQUEST-FAILED": {
383
+ readonly category: "gam";
384
+ readonly level: "error";
385
+ readonly summary: "The VAST ad request failed (network error, invalid tag URL, wrapper error or too many redirects); reported as CMCD adec.";
386
+ };
387
+ readonly "DA-VAST-CREATIVE-FAILED": {
388
+ readonly category: "gam";
389
+ readonly level: "error";
390
+ readonly summary: "The VAST creative could not be played (no compatible media file, playback error or trafficking error); reported as CMCD adec.";
391
+ };
322
392
  readonly "DA-VAST-IMA-SDK-MISSING": {
323
393
  readonly category: "gam";
324
394
  readonly level: "error";
@@ -379,11 +449,31 @@ export declare const DIAGNOSTIC_CODES: {
379
449
  readonly level: "info";
380
450
  readonly summary: "The viewer clicked the ad on screen (adclick emitted).";
381
451
  };
452
+ readonly "DA-LIVE-START-PUSHBACK": {
453
+ readonly category: "playback";
454
+ readonly level: "info";
455
+ readonly 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.";
456
+ };
457
+ readonly "DA-LIVE-START-PUSHBACK-SKIPPED": {
458
+ readonly category: "playback";
459
+ readonly level: "info";
460
+ readonly 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.";
461
+ };
462
+ readonly "DA-LIVE-START-PUSHBACK-LANDED": {
463
+ readonly category: "playback";
464
+ readonly level: "info";
465
+ readonly 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.";
466
+ };
382
467
  readonly "DA-RESUME-SEEK": {
383
468
  readonly category: "playback";
384
469
  readonly level: "info";
385
470
  readonly summary: "Content was resume-seeked to the resolved post-break position (insertion type policy).";
386
471
  };
472
+ readonly "DA-RESUME-UNADDRESSABLE": {
473
+ readonly category: "playback";
474
+ readonly level: "warn";
475
+ readonly 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.";
476
+ };
387
477
  readonly "DA-RESUME-LANDED": {
388
478
  readonly category: "playback";
389
479
  readonly level: "info";
@@ -402,7 +492,12 @@ export declare const DIAGNOSTIC_CODES: {
402
492
  readonly "DA-RESUME-TARGET-CLAMPED": {
403
493
  readonly category: "playback";
404
494
  readonly level: "warn";
405
- readonly summary: "The computed resume position sat inside the engine's minimum live offset and was clamped to the closest position the engine will hold; context carries breakId, requested, clamped and shortfallSec. Distinct from DA-RESUME-OFFSET-CLAMPED, which shortens the OFFSET to the ad seconds actually played.";
495
+ readonly 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.";
496
+ };
497
+ readonly "DA-RESUME-START-CLAMP-SKIPPED": {
498
+ readonly category: "playback";
499
+ readonly level: "info";
500
+ readonly 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.";
406
501
  };
407
502
  readonly "DA-RESUME-ALIGN-BLOCKED": {
408
503
  readonly category: "playback";
@@ -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-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 / 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-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-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-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-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-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-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-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)."},"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-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-RESUME-SEEK":{category:"playback",level:"info",summary:"Content was resume-seeked to the resolved post-break position (insertion type policy)."},"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). 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-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-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 inside the engine's minimum live offset and was clamped to the closest position the engine will hold; context carries breakId, requested, clamped and shortfallSec. Distinct from DA-RESUME-OFFSET-CLAMPED, which shortens the OFFSET to the ad seconds actually played."},"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-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-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 / 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-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-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-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-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-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)."},"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). 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-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-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.0.0";
5
+ export declare const SDK_VERSION = "1.1.0";
@@ -1 +1 @@
1
- export const SDK_VERSION="1.0.0";
1
+ export const SDK_VERSION="1.1.0";
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { isStaticAsset, isVastAsset, isVendorAsset, isGamVendorConfiguration, is
6
6
  export { resolveDeliveryMode, resolveStitchedStreamVendor, SsaiUnavailableError, } from './services/resolveDeliveryMode';
7
7
  export type { DeliveryModeDecision } from './services/resolveDeliveryMode';
8
8
  export type { StitchedStreamVendor } from './services/resolveDeliveryMode';
9
- export type { OptiViewAdsConfig, 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';
9
+ 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';
10
10
  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';
11
11
  export type { StitcherMasterUrlParams } from './services/StitcherUrlBuilder';
12
12
  export { buildStitcherMasterUrl } from './services/StitcherUrlBuilder';
@@ -37,6 +37,13 @@ export interface TimedMetadataCue {
37
37
  * parsed cue as `presented` can cause an ad break to start before its scheduled time.
38
38
  */
39
39
  phase?: 'parsed' | 'presented' | undefined;
40
+ /**
41
+ * Player media time minus the stream's PTS clock, in seconds, when the adapter knows it
42
+ * (DASH: `Period@start - presentationTimeOffset / timescale`). A DASH emsg whose
43
+ * `presentation_time_delta` is 0 reports its carrying segment's start as `startTime`; with
44
+ * this offset the core places an in-band break cue at its own `pts` instead.
45
+ */
46
+ ptsOffset?: number | undefined;
40
47
  }
41
48
  /** For `timedmetadata` the payload is a {@link TimedMetadataCue}; other events are event-specific (often undefined, or a media error for `error`). @category Player Integration */
42
49
  export type PlayerAdapterEventHandler = (event?: unknown) => void;
@@ -146,6 +153,27 @@ export interface PlayerAdapter {
146
153
  * and rejects sentinel values.
147
154
  */
148
155
  readonly seekableEnd?: number | null;
156
+ /** Start of the same seekable range as seekableEnd; null/omitted when unknown. */
157
+ readonly seekableStart?: number | null;
158
+ /**
159
+ * End of the newest published media segment in seconds (the live edge), or `null` when unknown.
160
+ * Report this when the engine's seekable range stops short of the published playlist end;
161
+ * AVFoundation, for example, ends `seekableTimeRanges` one hold-back before the edge. If omitted,
162
+ * the live start positioning uses {@link seekableEnd} as the edge.
163
+ */
164
+ readonly liveEdge?: number | null;
165
+ /** Declared HLS EXT-X-TARGETDURATION in seconds, not average segment length; null when unknown. */
166
+ readonly targetDuration?: number | null;
167
+ /** False while play expresses intent but the content timeline is not yet ready for a startup seek. */
168
+ readonly playbackReady?: boolean;
169
+ /**
170
+ * Ask the engine to begin the upcoming live playback `targetDurations` declared target
171
+ * durations behind the live edge, before the first frame, instead of the SDK seeking after it.
172
+ * `fallbackTargetDuration` (seconds) applies when the engine cannot read the playlist's.
173
+ * `null` withdraws the request. Return `false` when the engine cannot honour it for the
174
+ * upcoming start; the SDK then seeks after the first frame. Omit when unsupported.
175
+ */
176
+ requestLiveStartOffset?(targetDurations: number | null, fallbackTargetDuration: number | null): boolean;
149
177
  /**
150
178
  * Playback rate (`1` = normal). Used to correct drift while content continues behind an
151
179
  * ad with `continueContentDuringBreak`. Report the engine's current rate, not just the last
@@ -160,6 +188,11 @@ export interface PlayerAdapter {
160
188
  * Resolve only when the element is free; do not destroy the adapter. The SDK restores
161
189
  * content with `load()` when the break ends. Omit this method if your player supports
162
190
  * sharing the element without an explicit release, as HLS.js does.
191
+ *
192
+ * The same method is called on the ad adapter that `createAdAdapter(container, video)` built
193
+ * for the content element, right before content is reloaded at break end. Leave the ad media
194
+ * on the element there: the content engine's `load()` replaces it in one step, and an element
195
+ * without a resource closes Safari's picture-in-picture window.
163
196
  */
164
197
  releaseMediaElement?(): void | Promise<void>;
165
198
  /**
@@ -1 +1 @@
1
- export {};
1
+ export { preparePresentation, getPreparedPresentation, disposePreparedPresentation } from '../services/adPlayer/PreparedPresentation';
@@ -1 +1 @@
1
- export{};
1
+ export{preparePresentation,getPreparedPresentation,disposePreparedPresentation}from"../services/adPlayer/PreparedPresentation";
@@ -99,6 +99,7 @@ export declare class AdPlayerController {
99
99
  private readonly assetParameters;
100
100
  private readonly gamPodBridge;
101
101
  private readonly adStage;
102
+ private destroyed;
102
103
  private readonly preloader;
103
104
  private readonly assetPlayback;
104
105
  private readonly breakSequenceDriver;
@@ -232,6 +233,8 @@ export declare class AdPlayerController {
232
233
  private clearContentGate;
233
234
  /** `null` disables chaining: breaks then always hard-end regardless of how close the next one is. */
234
235
  setChainResolver(resolver: ((currentBreakId: string) => Break | null) | null): void;
236
+ /** {@link ContentResumeCoordinator.setCueAnchorResolver}. */
237
+ setResumeCueAnchorResolver(resolver: ((breakInfo: Break) => number | null) | null): void;
235
238
  /** Only wired by the SDK in debug mode, so production reports keep their shape. */
236
239
  setTransitionPhaseReporter(reporter: ((name: string) => void) | null): void;
237
240
  /** No-op when no reporter is wired or no transition is in flight. */