@dolby-optiview/ads-sdk-core 1.0.0-beta.1

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 (187) hide show
  1. package/dist/OptiViewAds.d.ts +190 -0
  2. package/dist/OptiViewAds.js +1 -0
  3. package/dist/config/keys.d.ts +23 -0
  4. package/dist/config/keys.js +1 -0
  5. package/dist/diagnostics/DiagnosticBuffer.d.ts +33 -0
  6. package/dist/diagnostics/DiagnosticBuffer.js +1 -0
  7. package/dist/diagnostics/DiagnosticEvent.d.ts +71 -0
  8. package/dist/diagnostics/DiagnosticEvent.js +1 -0
  9. package/dist/diagnostics/debugLog.d.ts +8 -0
  10. package/dist/diagnostics/debugLog.js +1 -0
  11. package/dist/diagnostics/errorCodes.d.ts +45 -0
  12. package/dist/diagnostics/errorCodes.js +1 -0
  13. package/dist/diagnostics/index.d.ts +6 -0
  14. package/dist/diagnostics/index.js +1 -0
  15. package/dist/diagnostics/playbackErrorContext.d.ts +22 -0
  16. package/dist/diagnostics/playbackErrorContext.js +1 -0
  17. package/dist/generated/diagnosticCodes.d.ts +487 -0
  18. package/dist/generated/diagnosticCodes.js +1 -0
  19. package/dist/generated/version.d.ts +5 -0
  20. package/dist/generated/version.js +1 -0
  21. package/dist/id3/buildId3.d.ts +25 -0
  22. package/dist/id3/buildId3.js +1 -0
  23. package/dist/id3/index.d.ts +3 -0
  24. package/dist/id3/index.js +1 -0
  25. package/dist/id3/parseId3Geob.d.ts +28 -0
  26. package/dist/id3/parseId3Geob.js +1 -0
  27. package/dist/index.d.ts +45 -0
  28. package/dist/index.js +1 -0
  29. package/dist/interfaces/PlayerAdapter.d.ts +163 -0
  30. package/dist/interfaces/PlayerAdapter.js +1 -0
  31. package/dist/internal/index.d.ts +1 -0
  32. package/dist/internal/index.js +1 -0
  33. package/dist/server/index.d.ts +20 -0
  34. package/dist/server/index.js +1 -0
  35. package/dist/services/AdBreakSequencer.d.ts +146 -0
  36. package/dist/services/AdBreakSequencer.js +1 -0
  37. package/dist/services/AdPlayerController.d.ts +495 -0
  38. package/dist/services/AdPlayerController.js +1 -0
  39. package/dist/services/BreakScheduler.d.ts +215 -0
  40. package/dist/services/BreakScheduler.js +1 -0
  41. package/dist/services/BreakTransitionTimer.d.ts +48 -0
  42. package/dist/services/BreakTransitionTimer.js +1 -0
  43. package/dist/services/CmcdAdReporter.d.ts +81 -0
  44. package/dist/services/CmcdAdReporter.js +1 -0
  45. package/dist/services/GamPodAdTracker.d.ts +65 -0
  46. package/dist/services/GamPodAdTracker.js +1 -0
  47. package/dist/services/GamPodUrlBuilder.d.ts +30 -0
  48. package/dist/services/GamPodUrlBuilder.js +1 -0
  49. package/dist/services/GamStreamManager.d.ts +67 -0
  50. package/dist/services/GamStreamManager.js +1 -0
  51. package/dist/services/LensReporter.d.ts +30 -0
  52. package/dist/services/LensReporter.js +1 -0
  53. package/dist/services/ManifestService.d.ts +91 -0
  54. package/dist/services/ManifestService.js +1 -0
  55. package/dist/services/MetadataCueTracker.d.ts +44 -0
  56. package/dist/services/MetadataCueTracker.js +1 -0
  57. package/dist/services/PauseAdController.d.ts +108 -0
  58. package/dist/services/PauseAdController.js +1 -0
  59. package/dist/services/RewindRearm.d.ts +109 -0
  60. package/dist/services/RewindRearm.js +1 -0
  61. package/dist/services/SsaiController.d.ts +59 -0
  62. package/dist/services/SsaiController.js +1 -0
  63. package/dist/services/StitcherUrlBuilder.d.ts +34 -0
  64. package/dist/services/StitcherUrlBuilder.js +1 -0
  65. package/dist/services/VastAdManager.d.ts +89 -0
  66. package/dist/services/VastAdManager.js +1 -0
  67. package/dist/services/adPlayer/AdPlayerEvents.d.ts +39 -0
  68. package/dist/services/adPlayer/AdPlayerEvents.js +1 -0
  69. package/dist/services/adPlayer/AdPlayerState.d.ts +98 -0
  70. package/dist/services/adPlayer/AdPlayerState.js +1 -0
  71. package/dist/services/adPlayer/AdPreloader.d.ts +54 -0
  72. package/dist/services/adPlayer/AdPreloader.js +1 -0
  73. package/dist/services/adPlayer/AdStage.d.ts +57 -0
  74. package/dist/services/adPlayer/AdStage.js +1 -0
  75. package/dist/services/adPlayer/AssetParameterResolver.d.ts +44 -0
  76. package/dist/services/adPlayer/AssetParameterResolver.js +1 -0
  77. package/dist/services/adPlayer/AssetPlayback.d.ts +71 -0
  78. package/dist/services/adPlayer/AssetPlayback.js +1 -0
  79. package/dist/services/adPlayer/BreakSequenceDriver.d.ts +46 -0
  80. package/dist/services/adPlayer/BreakSequenceDriver.js +1 -0
  81. package/dist/services/adPlayer/ContentResumeCoordinator.d.ts +44 -0
  82. package/dist/services/adPlayer/ContentResumeCoordinator.js +1 -0
  83. package/dist/services/adPlayer/ContinueContentPlayout.d.ts +26 -0
  84. package/dist/services/adPlayer/ContinueContentPlayout.js +1 -0
  85. package/dist/services/adPlayer/GamPodBridge.d.ts +66 -0
  86. package/dist/services/adPlayer/GamPodBridge.js +1 -0
  87. package/dist/services/adPlayer/PauseAdPresenter.d.ts +60 -0
  88. package/dist/services/adPlayer/PauseAdPresenter.js +1 -0
  89. package/dist/services/adPlayer/PresentationModeTracker.d.ts +66 -0
  90. package/dist/services/adPlayer/PresentationModeTracker.js +1 -0
  91. package/dist/services/adPlayer/SharedElementBreakPlayer.d.ts +54 -0
  92. package/dist/services/adPlayer/SharedElementBreakPlayer.js +1 -0
  93. package/dist/services/adPlayer/VariantSelector.d.ts +38 -0
  94. package/dist/services/adPlayer/VariantSelector.js +1 -0
  95. package/dist/services/adPlayer/connectPauseAd.d.ts +10 -0
  96. package/dist/services/adPlayer/connectPauseAd.js +1 -0
  97. package/dist/services/adPlayer/liveEdge.d.ts +6 -0
  98. package/dist/services/adPlayer/liveEdge.js +1 -0
  99. package/dist/services/assetParameterMacroTable.d.ts +9 -0
  100. package/dist/services/assetParameterMacroTable.js +1 -0
  101. package/dist/services/assetParameterMacros.d.ts +69 -0
  102. package/dist/services/assetParameterMacros.js +1 -0
  103. package/dist/services/breakTiming.d.ts +60 -0
  104. package/dist/services/breakTiming.js +1 -0
  105. package/dist/services/channelSwitch.d.ts +32 -0
  106. package/dist/services/channelSwitch.js +1 -0
  107. package/dist/services/detectDeviceType.d.ts +15 -0
  108. package/dist/services/detectDeviceType.js +1 -0
  109. package/dist/services/detectInsertionMode.d.ts +38 -0
  110. package/dist/services/detectInsertionMode.js +1 -0
  111. package/dist/services/detectPreloadMode.d.ts +13 -0
  112. package/dist/services/detectPreloadMode.js +1 -0
  113. package/dist/services/ed25519.d.ts +19 -0
  114. package/dist/services/ed25519.js +1 -0
  115. package/dist/services/fetchWithTimeout.d.ts +35 -0
  116. package/dist/services/fetchWithTimeout.js +1 -0
  117. package/dist/services/lensBackend.d.ts +16 -0
  118. package/dist/services/lensBackend.js +1 -0
  119. package/dist/services/lensBackendDevelopment.d.ts +1 -0
  120. package/dist/services/lensBackendDevelopment.js +1 -0
  121. package/dist/services/lensBackendProduction.d.ts +9 -0
  122. package/dist/services/lensBackendProduction.js +1 -0
  123. package/dist/services/manifestSignature.d.ts +43 -0
  124. package/dist/services/manifestSignature.js +1 -0
  125. package/dist/services/manifestTrustedKeys.d.ts +9 -0
  126. package/dist/services/manifestTrustedKeys.js +1 -0
  127. package/dist/services/parseBreakManifest.d.ts +15 -0
  128. package/dist/services/parseBreakManifest.js +1 -0
  129. package/dist/services/parseVastCompanion.d.ts +31 -0
  130. package/dist/services/parseVastCompanion.js +1 -0
  131. package/dist/services/parseVastLinear.d.ts +36 -0
  132. package/dist/services/parseVastLinear.js +1 -0
  133. package/dist/services/pictureInPicture.d.ts +28 -0
  134. package/dist/services/pictureInPicture.js +1 -0
  135. package/dist/services/resolveAssetParameters.d.ts +6 -0
  136. package/dist/services/resolveAssetParameters.js +1 -0
  137. package/dist/services/resolveDeliveryMode.d.ts +54 -0
  138. package/dist/services/resolveDeliveryMode.js +1 -0
  139. package/dist/services/resolveGamVendorConfiguration.d.ts +55 -0
  140. package/dist/services/resolveGamVendorConfiguration.js +1 -0
  141. package/dist/services/resolvePauseResumePoint.d.ts +32 -0
  142. package/dist/services/resolvePauseResumePoint.js +1 -0
  143. package/dist/services/resolvePollingDecision.d.ts +24 -0
  144. package/dist/services/resolvePollingDecision.js +1 -0
  145. package/dist/services/resolveResumePoint.d.ts +38 -0
  146. package/dist/services/resolveResumePoint.js +1 -0
  147. package/dist/services/resolveTargetedUri.d.ts +22 -0
  148. package/dist/services/resolveTargetedUri.js +1 -0
  149. package/dist/services/resolveVastAdmission.d.ts +34 -0
  150. package/dist/services/resolveVastAdmission.js +1 -0
  151. package/dist/services/selectVariant.d.ts +47 -0
  152. package/dist/services/selectVariant.js +1 -0
  153. package/dist/services/urlOrigin.d.ts +23 -0
  154. package/dist/services/urlOrigin.js +1 -0
  155. package/dist/session/AdBreakStatusTracker.d.ts +49 -0
  156. package/dist/session/AdBreakStatusTracker.js +1 -0
  157. package/dist/session/BreakLifecycle.d.ts +62 -0
  158. package/dist/session/BreakLifecycle.js +1 -0
  159. package/dist/session/SessionStarter.d.ts +98 -0
  160. package/dist/session/SessionStarter.js +1 -0
  161. package/dist/session/SessionState.d.ts +37 -0
  162. package/dist/session/SessionState.js +1 -0
  163. package/dist/types/BreakManifest.d.ts +335 -0
  164. package/dist/types/BreakManifest.js +1 -0
  165. package/dist/types/Events.d.ts +245 -0
  166. package/dist/types/Events.js +1 -0
  167. package/dist/types/OptiViewAdsConfig.d.ts +425 -0
  168. package/dist/types/OptiViewAdsConfig.js +1 -0
  169. package/dist/types/VendorAdError.d.ts +12 -0
  170. package/dist/types/VendorAdError.js +1 -0
  171. package/dist/vendor/lens-sdk/THIRD-PARTY-NOTICES.txt +266 -0
  172. package/dist/vendor/lens-sdk/compat.d.ts +9 -0
  173. package/dist/vendor/lens-sdk/encoding-cmcd.d.ts +9 -0
  174. package/dist/vendor/lens-sdk/encoding-json.d.ts +9 -0
  175. package/dist/vendor/lens-sdk/encoding.d.ts +42 -0
  176. package/dist/vendor/lens-sdk/environment.d.ts +35 -0
  177. package/dist/vendor/lens-sdk/index.d.ts +3 -0
  178. package/dist/vendor/lens-sdk/index.js +1 -0
  179. package/dist/vendor/lens-sdk/legacy.d.ts +12 -0
  180. package/dist/vendor/lens-sdk/lens-core-Q5lbQGMC.js +1 -0
  181. package/dist/vendor/lens-sdk/lens-global.d.ts +23 -0
  182. package/dist/vendor/lens-sdk/lens.d.ts +21 -0
  183. package/dist/vendor/lens-sdk/transport.d.ts +46 -0
  184. package/dist/vendor/lens-sdk/types.d.ts +218 -0
  185. package/dist/vendor/lens-sdk/user-id.d.ts +5 -0
  186. package/dist/vendor/lens-sdk/validation.d.ts +30 -0
  187. package/package.json +57 -0
@@ -0,0 +1,425 @@
1
+ import { PlayerAdapter } from '../interfaces/PlayerAdapter';
2
+ import { AssetParameterMacros } from '../services/assetParameterMacros';
3
+ import { BreakManifest } from './BreakManifest';
4
+ /**
5
+ * Factory for a custom ad player: create media elements inside the supplied container
6
+ * and return a {@link PlayerAdapter}. When `video` is provided, use that existing content
7
+ * video element so ads remain visible in picture-in-picture or native fullscreen.
8
+ * If the factory ignores it, the SDK falls back to the content player.
9
+ *
10
+ * @example
11
+ * createAdAdapter: (container, video) => {
12
+ * const el = video ?? container.appendChild(document.createElement('video'));
13
+ * const hls = new Hls(); hls.attachMedia(el);
14
+ * return new HlsJsAdapter(hls, el);
15
+ * }
16
+ * @category Player Integration */
17
+ export type CreateAdAdapter = (container: HTMLElement, video?: HTMLVideoElement) => PlayerAdapter;
18
+ /** Context passed to a {@link ManifestResponseInterceptor}. @category Manifest Customization */
19
+ export interface ManifestInterceptContext {
20
+ /** The fully-resolved channel-manifest URL that was fetched. */
21
+ url: string;
22
+ }
23
+ /**
24
+ * Hook to inspect/modify the parsed, validated {@link BreakManifest} before it is scheduled
25
+ * (initial fetch and every poll). The returned manifest is used without re-validation. May be
26
+ * async; on throw the SDK emits `DA-MANIFEST-INTERCEPT-FAILED` and uses the unmodified manifest.
27
+ *
28
+ * @example
29
+ * interceptManifestResponse: (manifest) => ({
30
+ * ...manifest,
31
+ * breaks: [preRollBreak, ...manifest.breaks],
32
+ * })
33
+ * @category Manifest Customization */
34
+ export type ManifestResponseInterceptor = (manifest: BreakManifest, context: ManifestInterceptContext) => BreakManifest | Promise<BreakManifest>;
35
+ /** Context passed to a {@link ManifestRequestInterceptor}. @category Manifest Customization */
36
+ export interface ManifestRequestContext {
37
+ /** The fully-resolved channel-manifest URL the SDK was about to fetch. */
38
+ url: string;
39
+ }
40
+ /** The outgoing manifest request; an interceptor may return a modified copy (URL and/or headers). @category Manifest Customization */
41
+ export interface ManifestRequest {
42
+ /** The URL to fetch the manifest from. */
43
+ url: string;
44
+ /** Request headers to send with the fetch. */
45
+ headers?: Record<string, string>;
46
+ }
47
+ /** Mocked manifest response: the SDK skips the network and parses/validates {@link body} as a real response. @category Manifest Customization */
48
+ export interface ManifestMockResponse {
49
+ /** Raw manifest body. A `string` is parsed as JSON; an object is used as-is. */
50
+ body: string | object;
51
+ }
52
+ /** {@link ManifestRequest} (redirect/headers), {@link ManifestMockResponse} (skip network), or `void` (fetch unchanged). @category Manifest Customization */
53
+ export type ManifestRequestInterceptorResult = ManifestRequest | ManifestMockResponse | void;
54
+ /**
55
+ * Hook to inspect/modify the manifest HTTP request before each fetch (initial and every poll).
56
+ * May be async; on throw the SDK emits `DA-MANIFEST-REQUEST-INTERCEPT-FAILED` and fetches the original URL.
57
+ *
58
+ * @example
59
+ * interceptManifestRequest: (request) => ({
60
+ * ...request,
61
+ * headers: { ...request.headers, 'X-Debug': '1' },
62
+ * })
63
+ * @category Manifest Customization */
64
+ export type ManifestRequestInterceptor = (request: ManifestRequest, context: ManifestRequestContext) => ManifestRequestInterceptorResult | Promise<ManifestRequestInterceptorResult>;
65
+ /**
66
+ * Ad preload strategy.
67
+ * - `parallel`: buffer the next ad into the attached ad player while content plays. Needs two
68
+ * simultaneous MediaSources — safe on desktop and modern Smart TVs.
69
+ * - `single-decoder`: cache warming + detached prefetch only; attach/decode at break start.
70
+ * Safe on single-decoder TVs (Tizen, webOS, VIZIO SmartCast).
71
+ * - `none`: disable preloading; load the ad when the break starts.
72
+ * - `auto` (default): User-Agent based — single-decoder TVs → `single-decoder`, else `parallel`.
73
+ *
74
+ * On single-decoder TVs, preloading avoids attaching a second MediaSource so the
75
+ * content player can continue using the device's decoder until the break starts.
76
+ * @category Configuration */
77
+ export type AdPreloadMode = 'parallel' | 'single-decoder' | 'none' | 'auto';
78
+ /**
79
+ * Ad insertion strategy (compositing).
80
+ * - `overlay`: separate `<video>` over the content player; all break formats.
81
+ * - `shared-element`: ad plays through the content `<video>` so iOS native fullscreen is kept.
82
+ * Single fullscreen ads only; advanced formats are downgraded, `lshape_content` is skipped.
83
+ * - `adaptive`: iPhone/iPod on iOS 17.1+ (Managed Media Source): `overlay` while inline,
84
+ * `shared-element` while in OS-native fullscreen (DOM overlays cannot render there).
85
+ * - `auto`: iPhone/iPod → `adaptive` when MMS is available, else `shared-element`; otherwise `overlay`.
86
+ * @category Configuration */
87
+ export type AdInsertionMode = 'overlay' | 'shared-element' | 'adaptive' | 'auto';
88
+ /**
89
+ * Ad insertion *type* — how an ad break relates to the content timeline. This is
90
+ * orthogonal to {@link AdInsertionMode} (which controls compositing) and is set
91
+ * per-session on {@link SessionConfig.adInsertionType}.
92
+ * - `replacement` (DAR): the break replaces a window of content; after
93
+ * the break, content resumes at `breakStart + (resumeOffset ?? duration)` — the
94
+ * replaced window is skipped.
95
+ * - `insertion` (DAI): the break is inserted and content resumes at the exact
96
+ * pre-break position (`breakStart + (resumeOffset ?? 0)`); the content timeline
97
+ * is not consumed. Primarily for VOD (PTS timebase).
98
+ * @category SDK & Sessions */
99
+ export type AdInsertionType = 'replacement' | 'insertion';
100
+ /**
101
+ * - `sgai` (default): the SDK polls the break manifest, schedules breaks and plays ads in its own overlay.
102
+ * - `ssai`: the content player plays a pre-stitched stream; the SDK only creates the IMA DAI
103
+ * stream, loads the stitched master, forwards timed metadata to IMA and re-emits ad events.
104
+ * @category Configuration */
105
+ export type OptiViewAdsMode = 'sgai' | 'ssai';
106
+ /** How a PTS-timebase break's `start` value is resolved. @category Configuration */
107
+ export type PtsSource = 'mediaTime' | 'anvatoCue';
108
+ /** Default ad insertion architecture. */
109
+ export declare const DEFAULT_MODE: OptiViewAdsMode;
110
+ /**
111
+ * `auto` protects single-decoder TVs without configuration: `parallel` attaches a second
112
+ * MediaSource before the break and wedges their only hardware decoder (black screen, no `adbreakbegin`).
113
+ */
114
+ export declare const DEFAULT_AD_PRELOAD_MODE: AdPreloadMode;
115
+ /** `auto` switches iPhone/iPod to shared-element insertion and leaves every other platform on overlay. */
116
+ export declare const DEFAULT_AD_INSERTION_MODE: AdInsertionMode;
117
+ /**
118
+ * Which side gets audio during a `double`-format break, where the content and
119
+ * ad boxes play side-by-side. The non-focused side is muted for the duration
120
+ * of the break; the SDK's unified `sdk.muted`/`sdk.volume` controls the
121
+ * focused side only, and the pre-break
122
+ * unified state is restored to the non-focused side when the break ends.
123
+ * - `ad` (default): the ad is audible; content is muted for the break.
124
+ * - `content`: content keeps its audio; the ad is muted for the break.
125
+ * @category Configuration */
126
+ export type DoubleBoxAudio = 'ad' | 'content';
127
+ /** Default double-box audio focus: the ad, the side being monetised. */
128
+ export declare const DEFAULT_DOUBLE_BOX_AUDIO: DoubleBoxAudio;
129
+ /**
130
+ * Default hard-cut margin (seconds): a break always returns to content at
131
+ * `effectiveDuration + margin`, whatever the ad media does. The margin lets an ad close to the
132
+ * break length finish cleanly.
133
+ */
134
+ export declare const DEFAULT_AD_BREAK_CUT_SAFETY_MARGIN_SEC = 2;
135
+ /**
136
+ * Consecutive-break chaining: breaks separated by at most `maxGapSeconds` play as one sequence —
137
+ * the overlay is held, content is not resumed, and the next break preloads during the current one.
138
+ * @category Configuration */
139
+ export interface ChainingConfig {
140
+ /**
141
+ * Whether chaining is enabled.
142
+ * @default true
143
+ */
144
+ enabled?: boolean;
145
+ /**
146
+ * Maximum gap (seconds) between one break's end and the next break's start. `0` disables chaining.
147
+ * @default 2
148
+ */
149
+ maxGapSeconds?: number;
150
+ }
151
+ /**
152
+ * Chaining configuration with all fields resolved to concrete values.
153
+ * @category Configuration */
154
+ export interface ResolvedChaining {
155
+ enabled: boolean;
156
+ maxGapSeconds: number;
157
+ }
158
+ /** Chaining on with a 2s gap, covering the common "two back-to-back breaks with a ~1s gap" case. */
159
+ export declare const DEFAULT_CHAINING: ResolvedChaining;
160
+ /** Resolve a partial {@link ChainingConfig}. */
161
+ export declare function resolveChaining(config?: ChainingConfig): ResolvedChaining;
162
+ /**
163
+ * Tune-in (join-in-progress): a viewer joining during a break sees it for its remaining
164
+ * duration. Breaks with less than `minBreakDurationSeconds` remaining are skipped.
165
+ * @category Configuration */
166
+ export interface TuneInConfig {
167
+ /**
168
+ * Whether tune-in breaks are enabled.
169
+ * @default true
170
+ */
171
+ enabled?: boolean;
172
+ /**
173
+ * Minimum remaining seconds for a join-in-progress break to be monetized.
174
+ * @default 5
175
+ */
176
+ minBreakDurationSeconds?: number;
177
+ }
178
+ /** {@link TuneInConfig} with all fields resolved. @category Configuration */
179
+ export interface ResolvedTuneIn {
180
+ enabled: boolean;
181
+ minBreakDurationSeconds: number;
182
+ }
183
+ /** Tune-in on with a 5s minimum, matching the scheduler's timing tolerance. */
184
+ export declare const DEFAULT_TUNE_IN: ResolvedTuneIn;
185
+ /** Resolve a partial {@link TuneInConfig}. */
186
+ export declare function resolveTuneIn(config?: TuneInConfig): ResolvedTuneIn;
187
+ /**
188
+ * Default grace (seconds) for a `wallclock` stream's Program Date Time to appear. 5s covers the
189
+ * observed startup gap (~1.2-1.5s of ticks before the source is loaded) with margin. A
190
+ * backstop, not a delay: playing content with no PDT concludes after a ~1s settle.
191
+ */
192
+ export declare const DEFAULT_PDT_GRACE_SECONDS = 5;
193
+ /** Resolve the PDT grace window, clamping negatives to 0. */
194
+ export declare function resolvePdtGraceSeconds(pdtGraceSeconds?: number): number;
195
+ /**
196
+ * Pre-break warnings: seconds before a break at which `adbreakstatus` fires with
197
+ * `phase: 'upcoming'`. Once per threshold; pre-rolls are skipped.
198
+ * @category Configuration */
199
+ export interface BreakWarningsConfig {
200
+ /**
201
+ * Seconds before a non-pre-roll break to fire warnings. Normalised to positive integers, deduplicated, sorted.
202
+ * @default []
203
+ */
204
+ seconds?: number[];
205
+ }
206
+ /** Normalised pre-break warning configuration. @category Configuration */
207
+ export interface ResolvedBreakWarnings {
208
+ seconds: number[];
209
+ }
210
+ /** Default: no proactive warnings. */
211
+ export declare const DEFAULT_BREAK_WARNINGS: ResolvedBreakWarnings;
212
+ /** Resolve a partial {@link BreakWarningsConfig}: drop non-positive values, round, deduplicate, sort ascending. */
213
+ export declare function resolveBreakWarnings(config?: BreakWarningsConfig): ResolvedBreakWarnings;
214
+ /** Structured diagnostics configuration. @category Diagnostics */
215
+ export interface DiagnosticsConfig {
216
+ /**
217
+ * Maximum records in the ring buffer behind `exportDiagnostics()`; oldest are evicted first.
218
+ * @default 200
219
+ */
220
+ bufferSize?: number;
221
+ }
222
+ /** SDK instance configuration, fixed for its lifetime (org-level). @category Configuration */
223
+ export interface OptiViewAdsConfig {
224
+ /**
225
+ * Ad insertion architecture. With `ssai`, `gam` and `ssai` are both required and each session
226
+ * supplies `stitcherUrl` + `customAssetKey`.
227
+ * @default 'sgai'
228
+ * @see OptiViewAdsMode
229
+ */
230
+ mode?: OptiViewAdsMode;
231
+ /** Maximum rendition bitrate (bits/sec) sent to the stitcher as `max_bitrate`; variants above it are dropped. SSAI only. */
232
+ maxBitrate?: number;
233
+ /**
234
+ * Start playback automatically after loading the stitched master (SSAI only).
235
+ * @default false
236
+ */
237
+ autoplay?: boolean;
238
+ /** The content player adapter; the SDK only interacts with the player through it. */
239
+ player: PlayerAdapter;
240
+ /**
241
+ * Outer stage element containing the customer's player and all SDK-managed ad elements. The SDK
242
+ * appends its elements here and sets position:relative if not already set.
243
+ */
244
+ container: HTMLElement;
245
+ /**
246
+ * Inner wrapper around the customer's player UI, repositioned to a pip corner during lshape
247
+ * breaks. Must be a child of container. If omitted the SDK wraps the existing children itself.
248
+ */
249
+ playerContainer?: HTMLElement;
250
+ /**
251
+ * Factory for a custom ad player, given an SDK-created container. Optional with
252
+ * `@dolby-optiview/ads-sdk`, which includes a default player for progressive video and HLS.
253
+ * Required when using the bare `@dolby-optiview/ads-sdk-core` package.
254
+ *
255
+ * @example
256
+ * createAdAdapter: (container) => {
257
+ * const video = document.createElement('video');
258
+ * container.appendChild(video);
259
+ * const hls = new Hls(); hls.attachMedia(video);
260
+ * return new HlsJsAdapter(hls, video);
261
+ * }
262
+ */
263
+ createAdAdapter?: CreateAdAdapter;
264
+ /**
265
+ * Ad preload strategy.
266
+ * @default 'auto'
267
+ * @see AdPreloadMode
268
+ */
269
+ adPreload?: AdPreloadMode;
270
+ /**
271
+ * Ad insertion strategy. `auto` switches iPhone/iPod to shared-element insertion, all other platforms overlay.
272
+ * @default 'auto'
273
+ * @see AdInsertionMode
274
+ */
275
+ adInsertion?: AdInsertionMode;
276
+ /**
277
+ * Consecutive-break chaining. Defaults to enabled with a 2s gap.
278
+ * @see ChainingConfig
279
+ */
280
+ chaining?: ChainingConfig;
281
+ /**
282
+ * Tune-in (join-in-progress) configuration. Defaults to enabled with a 5s minimum.
283
+ * @see TuneInConfig
284
+ */
285
+ tuneIn?: TuneInConfig;
286
+ /**
287
+ * Pre-break warnings: `adbreakstatus` events N seconds before each non-pre-roll break.
288
+ * @see BreakWarningsConfig
289
+ */
290
+ breakWarnings?: BreakWarningsConfig;
291
+ /**
292
+ * Seconds to wait for `EXT-X-PROGRAM-DATE-TIME` on a `wallclock` session before concluding the
293
+ * stream carries none. Until then no scheduling decision is made: the system clock runs ahead
294
+ * of the live playhead by the stream latency and would fire a break early.
295
+ *
296
+ * A backstop, not a fixed delay: content playing for ~1s with no PDT concludes immediately
297
+ * (`DA-PDT-MISSING`); the window only governs a player that never starts. Set `0` to use the
298
+ * system clock immediately. No effect on `pts` manifests.
299
+ * @default 5
300
+ */
301
+ pdtGraceSeconds?: number;
302
+ /**
303
+ * How a `timebase: "pts"` break's `start` is resolved. `mediaTime` reads it directly as player
304
+ * media time. `anvatoCue` tracks Anvato in-stream cues — HLS ID3 GEOB frames (description
305
+ * `Anvatos`, MIME `application/json`) and DASH emsg (`urn:anvato:es1:052016`) with payload
306
+ * `type=cue&pts=<seconds>` — and schedules the break at the media time of the cue whose `pts`
307
+ * matches its `start` (±5 ms); until then it stays pending (`DA-ANVATO-CUE-PENDING`). SGAI only.
308
+ * @default 'mediaTime'
309
+ */
310
+ ptsSource?: PtsSource;
311
+ /**
312
+ * Keep content playing, muted and hidden, through eligible replacement single-format breaks.
313
+ * Requires SGAI and an explicit `adInsertionType: 'replacement'`. The content player's
314
+ * optional `setVideoQuality` operation constrains background bandwidth when available.
315
+ * @default false
316
+ */
317
+ continueContentDuringBreak?: boolean;
318
+ /** Hook on the parsed manifest before scheduling (initial fetch and every poll). See {@link ManifestResponseInterceptor}. */
319
+ interceptManifestResponse?: ManifestResponseInterceptor;
320
+ /**
321
+ * Hook on the manifest HTTP request (redirect, headers, or a mocked body). On throw the SDK emits
322
+ * `DA-MANIFEST-REQUEST-INTERCEPT-FAILED` and fetches normally. See {@link ManifestRequestInterceptor}.
323
+ */
324
+ interceptManifestRequest?: ManifestRequestInterceptor;
325
+ /**
326
+ * Seconds added to a break's effective duration to form the hard cut back to content, so an
327
+ * over-long or stalled ad cannot hold the break open. `0` cuts exactly at the boundary.
328
+ * @default 2
329
+ */
330
+ adBreakCutSafetyMarginSec?: number;
331
+ /**
332
+ * Which side gets audio during a `double`-format break; the other side is muted for the break.
333
+ * @default 'ad'
334
+ * @see DoubleBoxAudio
335
+ */
336
+ doubleBoxAudio?: DoubleBoxAudio;
337
+ /**
338
+ * Enable debug logging.
339
+ * @default false
340
+ */
341
+ debug?: boolean;
342
+ /** Ring buffer behind `onDiagnostic()` and `exportDiagnostics()`. */
343
+ diagnostics?: DiagnosticsConfig;
344
+ /**
345
+ * Google Ad Manager configuration. Its PRESENCE enables GAM. It carries no stream identity: in
346
+ * `sgai` that comes from the manifest's `vendorConfiguration`, in `ssai` from {@link ssai} + `customAssetKey`.
347
+ */
348
+ gam?: GamConfig;
349
+ /** SSAI-only GAM identity (required with `mode: 'ssai'`): SSAI has no break manifest to read it from. */
350
+ ssai?: SsaiConfig;
351
+ }
352
+ /** The GAM identity for `mode: 'ssai'`. @category Configuration */
353
+ export interface SsaiConfig {
354
+ /** Network code for the GAM account serving the stitched stream. */
355
+ networkCode: string;
356
+ }
357
+ /** Per-session configuration passed to startSession(); changes per piece of content. @category SDK & Sessions */
358
+ export interface SessionConfig {
359
+ /** Full break-manifest URL. The SDK fetches exactly this URL and never rewrites it (proxied, signed or opaque endpoints all work). */
360
+ manifestUrl: string;
361
+ /**
362
+ * Ad insertion type for this content — how breaks relate to the content
363
+ * timeline (DAR vs DAI). `replacement` replaces a content window; `insertion`
364
+ * inserts the break and resumes at the exact pre-break position. When omitted,
365
+ * the manifest's `resumeOffset` drives the resume point.
366
+ * SGAI only — ignored in SSAI mode (the stitcher controls insertion, surfaced
367
+ * via a `DA-INSERTION-TYPE-IGNORED-SSAI` diagnostic).
368
+ * @see AdInsertionType
369
+ */
370
+ adInsertionType?: AdInsertionType;
371
+ /**
372
+ * Ad parameters for this session (for GAM: IMA `adTagParameters`). Per-key precedence is
373
+ * SessionConfig, `updateAssetParameters()`, manifest session parameters, then asset parameters.
374
+ * @see updateAssetParameters
375
+ */
376
+ assetParameters?: Record<string, string>;
377
+ /**
378
+ * Customer macros for the `$NAME$` tokens in asset-parameter values — a fixed
379
+ * string or a zero-argument callback per macro name, e.g.
380
+ * `{ '$CUSTOM_TEAM$': () => currentTeam() }`. Every `$NAME$` token inside a
381
+ * manifest / session / update value is replaced when the ad request is built,
382
+ * so `"$OPTIVIEW_PLAYER_WIDTH$x$OPTIVIEW_PLAYER_HEIGHT$"` becomes `"1920x1080"`.
383
+ * Customer macros are consulted before the built-in `$OPTIVIEW_*` set, so a
384
+ * built-in can be overridden. `$OPTIVIEW_*` and registered customer macros without
385
+ * values stay literal; the parameter is sent and `DA-ASSET-MACRO-UNKNOWN` is raised
386
+ * once per key/macro (context: `key`, `macro`). Other unresolved `$NAME$` tokens
387
+ * stay literal without a diagnostic. `$` without a closing `$` is unchanged.
388
+ * Callbacks are evaluated per ad request and cleared when the session ends.
389
+ * Session-scoped parameters are sent to IMA DAI with
390
+ * built-in and customer macros resolved; break-duration macros are omitted.
391
+ *
392
+ * @see OPTIVIEW_ASSET_PARAMETER_MACROS
393
+ */
394
+ assetParameterMacros?: AssetParameterMacros;
395
+ }
396
+ /**
397
+ * Per-session configuration for `mode: 'ssai'`: keyed on the stitched master URL instead of a
398
+ * manifest URL. The SDK appends `stream_id`, `max_bitrate` and extra params and never rebuilds the path.
399
+ * @category SDK & Sessions */
400
+ export type SsaiSessionConfig = Omit<SessionConfig, 'manifestUrl'> & {
401
+ /** Full URL of the stitcher master playlist for this content. */
402
+ stitcherUrl: string;
403
+ /** Custom asset key for the GAM DAI stream. Required: SSAI has no break manifest to take it from. */
404
+ customAssetKey: string;
405
+ };
406
+ /** What {@link OptiViewAds.startSession} accepts. Narrow with `'stitcherUrl' in config`. @category SDK & Sessions */
407
+ export type StartSessionConfig = SessionConfig | SsaiSessionConfig;
408
+ /**
409
+ * Google Ad Manager pod serving. Presence is the opt-in. The stream identity comes from the break
410
+ * manifest's `vendorConfiguration`, so client and backend cannot disagree; SSAI declares its own
411
+ * on {@link SsaiConfig} and {@link SsaiSessionConfig}.
412
+ * @category Configuration */
413
+ export interface GamConfig {
414
+ /**
415
+ * Set `false` to keep GAM off even when the manifest asks for it (consent prompts, builds that
416
+ * must not reach Google). GAM otherwise activates from the manifest.
417
+ * @default true
418
+ */
419
+ enabled?: boolean;
420
+ /**
421
+ * Stream Activity Monitor ID for debugging in Google's SAM tool.
422
+ * @see https://support.google.com/admanager/answer/9388474
423
+ */
424
+ streamActivityMonitorId?: string;
425
+ }
@@ -0,0 +1 @@
1
+ export const DEFAULT_MODE="sgai";export const DEFAULT_AD_PRELOAD_MODE="auto";export const DEFAULT_AD_INSERTION_MODE="auto";export const DEFAULT_DOUBLE_BOX_AUDIO="ad";export const DEFAULT_AD_BREAK_CUT_SAFETY_MARGIN_SEC=2;export const DEFAULT_CHAINING={enabled:!0,maxGapSeconds:2};export function resolveChaining(e){return{enabled:e?.enabled??DEFAULT_CHAINING.enabled,maxGapSeconds:e?.maxGapSeconds??DEFAULT_CHAINING.maxGapSeconds}}export const DEFAULT_TUNE_IN={enabled:!0,minBreakDurationSeconds:5};export function resolveTuneIn(e){return{enabled:e?.enabled??DEFAULT_TUNE_IN.enabled,minBreakDurationSeconds:e?.minBreakDurationSeconds??DEFAULT_TUNE_IN.minBreakDurationSeconds}}export const DEFAULT_PDT_GRACE_SECONDS=5;export function resolvePdtGraceSeconds(e){return Math.max(0,e??5)}export const DEFAULT_BREAK_WARNINGS={seconds:[]};export function resolveBreakWarnings(e){const n=e?.seconds??[];return{seconds:Array.from(new Set(n.map(e=>Math.round(e)).filter(e=>Number.isFinite(e)&&e>0))).sort((e,n)=>e-n)}}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * An ad playback error that carries the ad vendor's own error code (e.g. the
3
+ * numeric IMA/VAST `AdError` code), so telemetry can report it (`adevc`)
4
+ * alongside the SDK's taxonomy code. Vendor integrations wrap their errors in
5
+ * this type when the vendor supplies a code; errors without one stay plain
6
+ * `Error`s.
7
+ */
8
+ export declare class VendorAdError extends Error {
9
+ /** The vendor's error code, stringified (e.g. IMA's numeric AdError code). */
10
+ readonly vendorCode: string;
11
+ constructor(message: string, vendorCode: string);
12
+ }
@@ -0,0 +1 @@
1
+ export class VendorAdError extends Error{constructor(r,o){super(r),this.name="VendorAdError",this.vendorCode=o}}