stormcloud-video-player 0.8.64 → 0.8.66

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.
@@ -24,17 +24,30 @@ interface AdBreakOrchestratorHost {
24
24
  onAdClick(): void;
25
25
  onAdInteraction(event: MouseEvent | TouchEvent): void;
26
26
  }
27
+ type AdSlotState = "IDLE" | "REQUESTING" | "READY" | "PLAYING" | "NEEDS_NEXT_AD" | "ENDING";
27
28
  declare class AdBreakOrchestrator {
28
29
  inAdBreak: boolean;
29
30
  showAds: boolean;
30
31
  isShowingPlaceholder: boolean;
31
32
  adDetectSentForCurrentBreak: boolean;
32
- private continuousFetchingActive;
33
- private continuousFetchLoopRunning;
33
+ private slotState;
34
+ private breakSource;
35
+ private followUpBaseVastUrl;
36
+ private unusableResponsesInBreak;
37
+ private nextAdTimerId;
38
+ private controllerGeneration;
39
+ private readonly requestDiagnostics;
34
40
  private currentVastUrl;
35
- adRequestQueue: string[];
41
+ private breakFunnel;
42
+ private controllerCallInFlight;
43
+ private playbackStartedForCurrentRequest;
44
+ private currentRequestId;
45
+ private requestStartedAt;
46
+ private opportunityBreakKey;
47
+ private opportunityEpoch;
36
48
  adPodQueue: string[];
37
- private readonly maxPlaceholderDurationMs;
49
+ private readonly defaultMinRemainingMsToRequestAd;
50
+ private readonly defaultMaxNoFillsPerBreak;
38
51
  pendingAdBreak: {
39
52
  marker: Scte35Marker;
40
53
  detectedAtFragmentSn?: number;
@@ -53,24 +66,45 @@ declare class AdBreakOrchestrator {
53
66
  private get analyticsContext();
54
67
  private nextAdRequestUrl;
55
68
  attachImaEventListeners(): void;
56
- recreateAdController(): void;
69
+ recreateAdController(reason: string): void;
57
70
  clearPendingAdBreak(): void;
58
- handleAdStart(_marker: Scte35Marker): Promise<void>;
71
+ isBreakActive(): boolean;
72
+ getSlotState(): AdSlotState;
73
+ beginVmapBreak(breakKey: string): void;
74
+ handleAdStart(marker: Scte35Marker): Promise<void>;
59
75
  private startOptimizedPod;
60
- private startContinuousFetching;
61
- private continuousFetchLoop;
62
- stopContinuousFetching(): void;
63
- tryNextAvailableAdWithRateLimit(): Promise<void>;
64
- private tryNextAvailableAd;
76
+ private setSlotState;
77
+ private isStale;
78
+ private getMinRemainingMsToRequestAd;
79
+ private getMaxNoFillsPerBreak;
80
+ private isBreakTimeBounded;
81
+ private getStopRequestingReason;
82
+ private getNextRequestDelayMs;
83
+ requestNextAd(trigger: string): void;
84
+ private requestFollowUpAd;
85
+ continueAfterRequestFailure(epoch?: number): void;
86
+ cancelScheduledRequest(): void;
87
+ noteVastUrlGenerated(url: string, source: string): void;
88
+ private recordRequestFailure;
89
+ private recordRequestDiagnostic;
90
+ private finalizeRequestDiagnostics;
65
91
  private withCurrentPodBudget;
66
- playSingleAd(vastTagUrl: string): Promise<void>;
67
- private showPlaceholderAndWaitForAds;
68
- handleAdPodComplete(): void;
92
+ private countFunnelStage;
93
+ private logOrchestratorFunnel;
94
+ noteOpportunity(source: "scte35" | "vmap", breakKey: string | undefined): void;
95
+ private beginFunnelRequest;
96
+ isAdLoadingWithoutPlayback(): boolean;
97
+ noteStopBeforeStart(reason: string): void;
98
+ handleRequestWatchdogTimeout(): void;
99
+ private callController;
100
+ playSingleAd(vastTagUrl: string, trigger?: string): Promise<void>;
101
+ private logBreakFunnel;
102
+ handleAdPodComplete(reason?: string): void;
69
103
  private getBufferedAhead;
70
104
  private describeVideoState;
71
105
  private monitorLiveResumeStall;
72
106
  private resumeContentPlayback;
73
- handleAdFailure(): void;
107
+ handleAdFailure(reason?: string): void;
74
108
  }
75
109
 
76
- export { AdBreakOrchestrator, type AdBreakOrchestratorHost };
110
+ export { AdBreakOrchestrator, type AdBreakOrchestratorHost, type AdSlotState };
@@ -1224,6 +1224,21 @@ function normalizeVastTagUrl(raw) {
1224
1224
  return raw;
1225
1225
  }
1226
1226
  }
1227
+ var GAM_AD_HOSTS = /* @__PURE__ */ new Set([
1228
+ "pubads.g.doubleclick.net",
1229
+ "securepubads.g.doubleclick.net"
1230
+ ]);
1231
+ function ensureVideoAdType(rawUrl) {
1232
+ try {
1233
+ var url = new URL(rawUrl);
1234
+ if (!GAM_AD_HOSTS.has(url.hostname)) return rawUrl;
1235
+ if (url.searchParams.has("ad_type")) return rawUrl;
1236
+ url.searchParams.set("ad_type", "video");
1237
+ return url.toString();
1238
+ } catch (unused) {
1239
+ return rawUrl;
1240
+ }
1241
+ }
1227
1242
  function applyVastMacros(baseUrl, ctx) {
1228
1243
  var expandedUrl = expandInlineMacroPlaceholders(baseUrl, ctx);
1229
1244
  var url;
@@ -2390,7 +2405,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
2390
2405
  } : {}), {
2391
2406
  consent: this.consentSignals
2392
2407
  }));
2393
- var finalUrl = palNonce.injectNonce(urlWithMacros);
2408
+ var finalUrl = palNonce.injectNonce(ensureVideoAdType(urlWithMacros));
2394
2409
  console.log("[StormcloudVideoPlayer] Resolved optimized-pod request URL (pod=".concat(this.podCounter, ", pmad=").concat(podParams.maxAds, ", pmnd=").concat(podParams.minDurationMs, ", pmxd=").concat((_podParams_maxDurationMs = podParams.maxDurationMs) !== null && _podParams_maxDurationMs !== void 0 ? _podParams_maxDurationMs : "?", "):"), finalUrl);
2395
2410
  return finalUrl;
2396
2411
  }