stormcloud-video-player 0.8.63 → 0.8.65
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.
- package/dist/stormcloud-vp.min.js +2 -2
- package/lib/StormcloudPlayer.cjs +1046 -187
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/index.cjs +1046 -187
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +7 -0
- package/lib/index.js +1046 -187
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +307 -31
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +18 -0
- package/lib/player/AdTimingService.cjs +9 -1
- package/lib/player/AdTimingService.cjs.map +1 -1
- package/lib/player/AdTimingService.d.cts +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +1046 -187
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +1046 -187
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +1046 -187
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +781 -154
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -0
- package/lib/types.d.cts +6 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +1046 -187
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -84,6 +84,29 @@ function _object_spread(target) {
|
|
|
84
84
|
}
|
|
85
85
|
return target;
|
|
86
86
|
}
|
|
87
|
+
function ownKeys(object, enumerableOnly) {
|
|
88
|
+
var keys = Object.keys(object);
|
|
89
|
+
if (Object.getOwnPropertySymbols) {
|
|
90
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
91
|
+
if (enumerableOnly) {
|
|
92
|
+
symbols = symbols.filter(function(sym) {
|
|
93
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
keys.push.apply(keys, symbols);
|
|
97
|
+
}
|
|
98
|
+
return keys;
|
|
99
|
+
}
|
|
100
|
+
function _object_spread_props(target, source) {
|
|
101
|
+
source = source != null ? source : {};
|
|
102
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
103
|
+
else {
|
|
104
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
105
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return target;
|
|
109
|
+
}
|
|
87
110
|
function _to_consumable_array(arr) {
|
|
88
111
|
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
89
112
|
}
|
|
@@ -1286,6 +1309,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1286
1309
|
this.adDetectSentForCurrentBreak = false;
|
|
1287
1310
|
this.continuousFetchingActive = false;
|
|
1288
1311
|
this.continuousFetchLoopRunning = false;
|
|
1312
|
+
this.breakFunnel = {};
|
|
1313
|
+
this.controllerCallInFlight = false;
|
|
1314
|
+
this.playbackStartedForCurrentRequest = false;
|
|
1315
|
+
this.opportunityEpoch = -1;
|
|
1289
1316
|
this.adRequestQueue = [];
|
|
1290
1317
|
this.adPodQueue = [];
|
|
1291
1318
|
this.maxPlaceholderDurationMs = 5e3;
|
|
@@ -1338,12 +1365,35 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1338
1365
|
adPlayer.on("ad_interaction", function(event) {
|
|
1339
1366
|
if (event) _this.host.onAdInteraction(event);
|
|
1340
1367
|
});
|
|
1341
|
-
adPlayer.on("
|
|
1342
|
-
|
|
1368
|
+
adPlayer.on("ad_funnel", function(payload) {
|
|
1369
|
+
if (!(payload === null || payload === void 0 ? void 0 : payload.stage)) return;
|
|
1370
|
+
_this.countFunnelStage(payload.stage);
|
|
1371
|
+
if (payload.reason) {
|
|
1372
|
+
_this.countFunnelStage("".concat(payload.stage, ":").concat(payload.reason));
|
|
1373
|
+
}
|
|
1374
|
+
if (payload.stage === "impression_fired" && payload.pixelCount != null) {
|
|
1375
|
+
_this.countFunnelStage("impression_urls", payload.pixelCount);
|
|
1376
|
+
}
|
|
1377
|
+
if (payload.visibilityState === "hidden") {
|
|
1378
|
+
_this.countFunnelStage("while_hidden");
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
adPlayer.on("ad_impression", function() {
|
|
1382
|
+
_this.timing.consecutiveFailures = 0;
|
|
1383
|
+
if (!_this.playbackStartedForCurrentRequest) {
|
|
1384
|
+
_this.playbackStartedForCurrentRequest = true;
|
|
1385
|
+
_this.timing.markAdStarted();
|
|
1386
|
+
}
|
|
1387
|
+
sendAdImpressionTracking(_this.host.config.licenseKey, _object_spread_props(_object_spread({
|
|
1343
1388
|
source: "hls",
|
|
1344
|
-
adIndex: _this.timing.currentAdIndex
|
|
1389
|
+
adIndex: _this.timing.currentAdIndex
|
|
1390
|
+
}, _this.currentVastUrl ? {
|
|
1391
|
+
adUrl: _this.currentVastUrl
|
|
1392
|
+
} : {}), {
|
|
1345
1393
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1346
|
-
}, _this.analyticsContext).catch(function() {});
|
|
1394
|
+
}), _this.analyticsContext).catch(function() {});
|
|
1395
|
+
});
|
|
1396
|
+
adPlayer.on("all_ads_completed", function() {
|
|
1347
1397
|
_this.timing.recordPlayedAdDuration(_this.host.getAdPlayer());
|
|
1348
1398
|
var remaining = _this.timing.getRemainingAdMs();
|
|
1349
1399
|
_this.timing.consecutiveFailures = 0;
|
|
@@ -1377,6 +1427,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1377
1427
|
}
|
|
1378
1428
|
}
|
|
1379
1429
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
1430
|
+
if (_this.controllerCallInFlight) {
|
|
1431
|
+
_this.timing.recordGamNoFill();
|
|
1432
|
+
return;
|
|
1433
|
+
}
|
|
1380
1434
|
_this.handleAdFailure();
|
|
1381
1435
|
});
|
|
1382
1436
|
adPlayer.on("content_pause", function() {
|
|
@@ -1401,11 +1455,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1401
1455
|
}
|
|
1402
1456
|
});
|
|
1403
1457
|
adPlayer.on("content_resume", function() {
|
|
1404
|
-
sendAdImpressionTracking(_this.host.config.licenseKey, {
|
|
1405
|
-
source: "hls",
|
|
1406
|
-
adIndex: _this.timing.currentAdIndex,
|
|
1407
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1408
|
-
}, _this.analyticsContext).catch(function() {});
|
|
1409
1458
|
if (!_this.host.video.muted) {
|
|
1410
1459
|
_this.host.video.muted = true;
|
|
1411
1460
|
if (_this.debug) {
|
|
@@ -1453,6 +1502,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1453
1502
|
}
|
|
1454
1503
|
var preservedMutedState = adPlayer.getOriginalMutedState();
|
|
1455
1504
|
var preservedVolumeState = adPlayer.getOriginalVolume();
|
|
1505
|
+
this.playbackStartedForCurrentRequest = false;
|
|
1456
1506
|
if (adPlayer) {
|
|
1457
1507
|
try {
|
|
1458
1508
|
adPlayer.destroy();
|
|
@@ -1542,9 +1592,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1542
1592
|
if (this.timing.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
|
|
1543
1593
|
this.timing.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
1544
1594
|
}
|
|
1595
|
+
this.noteOpportunity("scte35", this.cueManager.activeScte35BreakKey);
|
|
1545
1596
|
return [
|
|
1546
1597
|
4,
|
|
1547
|
-
this.startOptimizedPod(baseVastUrl, adBreakDurationMs
|
|
1598
|
+
this.startOptimizedPod(baseVastUrl, adBreakDurationMs)
|
|
1548
1599
|
];
|
|
1549
1600
|
case 1:
|
|
1550
1601
|
podPlayed = _state.sent();
|
|
@@ -1578,7 +1629,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1578
1629
|
value: // ───────────────────────────────────────────────────────────────
|
|
1579
1630
|
// Optimized pod (single multi-ad request)
|
|
1580
1631
|
// ───────────────────────────────────────────────────────────────
|
|
1581
|
-
function startOptimizedPod(baseVastUrl, breakDurationMs
|
|
1632
|
+
function startOptimizedPod(baseVastUrl, breakDurationMs) {
|
|
1582
1633
|
return _async_to_generator(function() {
|
|
1583
1634
|
var podUrl, adPlayer, requestToken, _ref, _adPlayer_getPodAdCount, podCount, error;
|
|
1584
1635
|
return _ts_generator(this, function(_state) {
|
|
@@ -1601,7 +1652,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1601
1652
|
adPlayer = this.host.getAdPlayer();
|
|
1602
1653
|
requestToken = ++this.timing.adRequestTokenCounter;
|
|
1603
1654
|
this.timing.activeAdRequestToken = requestToken;
|
|
1604
|
-
this.
|
|
1655
|
+
this.currentVastUrl = podUrl;
|
|
1605
1656
|
_state.label = 1;
|
|
1606
1657
|
case 1:
|
|
1607
1658
|
_state.trys.push([
|
|
@@ -1616,10 +1667,14 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1616
1667
|
];
|
|
1617
1668
|
case 2:
|
|
1618
1669
|
_state.sent();
|
|
1619
|
-
this.timing.
|
|
1670
|
+
this.timing.startAdRequestWatchdog(requestToken);
|
|
1671
|
+
this.timing.noteAdRequestSent();
|
|
1672
|
+
this.beginFunnelRequest(adPlayer, requestToken);
|
|
1620
1673
|
return [
|
|
1621
1674
|
4,
|
|
1622
|
-
|
|
1675
|
+
this.callController(function() {
|
|
1676
|
+
return adPlayer.requestAds(podUrl);
|
|
1677
|
+
})
|
|
1623
1678
|
];
|
|
1624
1679
|
case 3:
|
|
1625
1680
|
_state.sent();
|
|
@@ -1648,16 +1703,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1648
1703
|
this.timing.startAdFailsafeTimer(requestToken);
|
|
1649
1704
|
return [
|
|
1650
1705
|
4,
|
|
1651
|
-
|
|
1706
|
+
this.callController(function() {
|
|
1707
|
+
return adPlayer.play();
|
|
1708
|
+
})
|
|
1652
1709
|
];
|
|
1653
1710
|
case 4:
|
|
1654
1711
|
_state.sent();
|
|
1655
|
-
this.timing.markAdStarted();
|
|
1656
1712
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
1657
1713
|
this.timing.scheduleAdStopAtBreakBoundary();
|
|
1658
1714
|
}
|
|
1659
|
-
adPlayer.setAdVolume(
|
|
1660
|
-
this.timing.consecutiveFailures = 0;
|
|
1715
|
+
adPlayer.setAdVolume(getAdAudioVolume(adPlayer));
|
|
1661
1716
|
this.continuousFetchingActive = true;
|
|
1662
1717
|
this.startContinuousFetching(baseVastUrl);
|
|
1663
1718
|
return [
|
|
@@ -2022,7 +2077,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2022
2077
|
];
|
|
2023
2078
|
case 3:
|
|
2024
2079
|
_state.sent();
|
|
2025
|
-
this.timing.consecutiveFailures = 0;
|
|
2026
2080
|
return [
|
|
2027
2081
|
3,
|
|
2028
2082
|
8
|
|
@@ -2035,6 +2089,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2035
2089
|
3,
|
|
2036
2090
|
6
|
|
2037
2091
|
];
|
|
2092
|
+
this.timing.consecutiveFailures++;
|
|
2038
2093
|
return [
|
|
2039
2094
|
4,
|
|
2040
2095
|
this.tryNextAvailableAdWithRateLimit()
|
|
@@ -2104,13 +2159,159 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2104
2159
|
}
|
|
2105
2160
|
},
|
|
2106
2161
|
{
|
|
2107
|
-
|
|
2108
|
-
value: // ───────────────────────────────────────────────────────────────
|
|
2162
|
+
// ───────────────────────────────────────────────────────────────
|
|
2109
2163
|
// Single ad playback
|
|
2110
2164
|
// ───────────────────────────────────────────────────────────────
|
|
2111
|
-
|
|
2165
|
+
key: "withCurrentPodBudget",
|
|
2166
|
+
value: function withCurrentPodBudget(vastTagUrl) {
|
|
2167
|
+
var remaining = Math.min(this.timing.getWallClockRemainingAdMs(), this.timing.getDurationBudgetRemainingMs());
|
|
2168
|
+
if (!(remaining > 0)) return vastTagUrl;
|
|
2169
|
+
try {
|
|
2170
|
+
var url = new URL(vastTagUrl);
|
|
2171
|
+
if (!url.searchParams.has("pmxd")) return vastTagUrl;
|
|
2172
|
+
var maxMs = Math.round(remaining);
|
|
2173
|
+
url.searchParams.set("pmxd", String(maxMs));
|
|
2174
|
+
var minMs = Number(url.searchParams.get("pmnd"));
|
|
2175
|
+
if (Number.isFinite(minMs) && minMs > maxMs) {
|
|
2176
|
+
url.searchParams.set("pmnd", String(maxMs));
|
|
2177
|
+
}
|
|
2178
|
+
return url.toString();
|
|
2179
|
+
} catch (unused) {
|
|
2180
|
+
return vastTagUrl;
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
},
|
|
2184
|
+
{
|
|
2185
|
+
key: "countFunnelStage",
|
|
2186
|
+
value: function countFunnelStage(stage) {
|
|
2187
|
+
var amount = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
2188
|
+
var _this_breakFunnel_stage;
|
|
2189
|
+
this.breakFunnel[stage] = ((_this_breakFunnel_stage = this.breakFunnel[stage]) !== null && _this_breakFunnel_stage !== void 0 ? _this_breakFunnel_stage : 0) + amount;
|
|
2190
|
+
}
|
|
2191
|
+
},
|
|
2192
|
+
{
|
|
2193
|
+
key: "logOrchestratorFunnel",
|
|
2194
|
+
value: function logOrchestratorFunnel(stage) {
|
|
2195
|
+
var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
2196
|
+
this.countFunnelStage(stage);
|
|
2197
|
+
console.log("[AdBreak][FUNNEL] ".concat(stage), _object_spread({
|
|
2198
|
+
breakId: this.timing.adBreakEpoch,
|
|
2199
|
+
requestId: this.currentRequestId,
|
|
2200
|
+
visibilityState: typeof document !== "undefined" ? document.visibilityState : void 0
|
|
2201
|
+
}, extra));
|
|
2202
|
+
}
|
|
2203
|
+
},
|
|
2204
|
+
{
|
|
2205
|
+
key: "noteOpportunity",
|
|
2206
|
+
value: function noteOpportunity(source, breakKey) {
|
|
2207
|
+
if (breakKey && breakKey === this.opportunityBreakKey && this.opportunityEpoch === this.timing.adBreakEpoch) {
|
|
2208
|
+
this.logOrchestratorFunnel("duplicate_break_start", {
|
|
2209
|
+
source: source,
|
|
2210
|
+
breakKey: breakKey
|
|
2211
|
+
});
|
|
2212
|
+
return;
|
|
2213
|
+
}
|
|
2214
|
+
this.opportunityBreakKey = breakKey;
|
|
2215
|
+
this.opportunityEpoch = this.timing.adBreakEpoch;
|
|
2216
|
+
this.logOrchestratorFunnel("opportunity_created", {
|
|
2217
|
+
source: source,
|
|
2218
|
+
breakKey: breakKey,
|
|
2219
|
+
expectedDurationMs: this.timing.expectedAdBreakDurationMs
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
},
|
|
2223
|
+
{
|
|
2224
|
+
key: "beginFunnelRequest",
|
|
2225
|
+
value: function beginFunnelRequest(adPlayer, requestToken) {
|
|
2226
|
+
var _adPlayer_setFunnelContext;
|
|
2227
|
+
if (this.controllerCallInFlight) {
|
|
2228
|
+
this.logOrchestratorFunnel("duplicate_request_detected", {
|
|
2229
|
+
newRequestId: requestToken
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
this.currentRequestId = requestToken;
|
|
2233
|
+
this.requestStartedAt = Date.now();
|
|
2234
|
+
(_adPlayer_setFunnelContext = adPlayer.setFunnelContext) === null || _adPlayer_setFunnelContext === void 0 ? void 0 : _adPlayer_setFunnelContext.call(adPlayer, {
|
|
2235
|
+
breakId: this.timing.adBreakEpoch,
|
|
2236
|
+
requestId: requestToken
|
|
2237
|
+
});
|
|
2238
|
+
}
|
|
2239
|
+
},
|
|
2240
|
+
{
|
|
2241
|
+
key: "isAdLoadingWithoutPlayback",
|
|
2242
|
+
value: function isAdLoadingWithoutPlayback() {
|
|
2243
|
+
return this.host.getAdPlayer().isAdPlaying() && !this.playbackStartedForCurrentRequest;
|
|
2244
|
+
}
|
|
2245
|
+
},
|
|
2246
|
+
{
|
|
2247
|
+
key: "noteStopBeforeStart",
|
|
2248
|
+
value: function noteStopBeforeStart(reason) {
|
|
2249
|
+
if (!this.isAdLoadingWithoutPlayback()) return;
|
|
2250
|
+
this.logOrchestratorFunnel("ad_stopped_before_start", {
|
|
2251
|
+
reason: reason,
|
|
2252
|
+
elapsedSinceRequestMs: this.requestStartedAt != null ? Date.now() - this.requestStartedAt : void 0
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
},
|
|
2256
|
+
{
|
|
2257
|
+
key: "handleRequestWatchdogTimeout",
|
|
2258
|
+
value: function handleRequestWatchdogTimeout() {
|
|
2259
|
+
var adPlayer = this.host.getAdPlayer();
|
|
2260
|
+
if (this.controllerCallInFlight && adPlayer.abortPendingRequest) {
|
|
2261
|
+
this.logOrchestratorFunnel("request_aborted_timeout", {
|
|
2262
|
+
elapsedSinceRequestMs: this.requestStartedAt != null ? Date.now() - this.requestStartedAt : void 0
|
|
2263
|
+
});
|
|
2264
|
+
adPlayer.abortPendingRequest("VAST request aborted after request watchdog timeout");
|
|
2265
|
+
return;
|
|
2266
|
+
}
|
|
2267
|
+
this.handleAdFailure();
|
|
2268
|
+
}
|
|
2269
|
+
},
|
|
2270
|
+
{
|
|
2271
|
+
key: "callController",
|
|
2272
|
+
value: function callController(call) {
|
|
2273
|
+
return _async_to_generator(function() {
|
|
2274
|
+
return _ts_generator(this, function(_state) {
|
|
2275
|
+
switch(_state.label){
|
|
2276
|
+
case 0:
|
|
2277
|
+
this.controllerCallInFlight = true;
|
|
2278
|
+
_state.label = 1;
|
|
2279
|
+
case 1:
|
|
2280
|
+
_state.trys.push([
|
|
2281
|
+
1,
|
|
2282
|
+
,
|
|
2283
|
+
3,
|
|
2284
|
+
4
|
|
2285
|
+
]);
|
|
2286
|
+
return [
|
|
2287
|
+
4,
|
|
2288
|
+
call()
|
|
2289
|
+
];
|
|
2290
|
+
case 2:
|
|
2291
|
+
_state.sent();
|
|
2292
|
+
return [
|
|
2293
|
+
3,
|
|
2294
|
+
4
|
|
2295
|
+
];
|
|
2296
|
+
case 3:
|
|
2297
|
+
this.controllerCallInFlight = false;
|
|
2298
|
+
return [
|
|
2299
|
+
7
|
|
2300
|
+
];
|
|
2301
|
+
case 4:
|
|
2302
|
+
return [
|
|
2303
|
+
2
|
|
2304
|
+
];
|
|
2305
|
+
}
|
|
2306
|
+
});
|
|
2307
|
+
}).call(this);
|
|
2308
|
+
}
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
key: "playSingleAd",
|
|
2312
|
+
value: function playSingleAd(vastTagUrl) {
|
|
2112
2313
|
return _async_to_generator(function() {
|
|
2113
|
-
var adPlayer, requestToken, ap, playError, error, errorMessage;
|
|
2314
|
+
var adPlayer, requestToken, ap, requestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, playError, error, errorMessage;
|
|
2114
2315
|
return _ts_generator(this, function(_state) {
|
|
2115
2316
|
switch(_state.label){
|
|
2116
2317
|
case 0:
|
|
@@ -2137,7 +2338,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2137
2338
|
this.recreateAdController();
|
|
2138
2339
|
requestToken = ++this.timing.adRequestTokenCounter;
|
|
2139
2340
|
this.timing.activeAdRequestToken = requestToken;
|
|
2140
|
-
this.timing.startAdRequestWatchdog(requestToken);
|
|
2141
2341
|
_state.label = 1;
|
|
2142
2342
|
case 1:
|
|
2143
2343
|
_state.trys.push([
|
|
@@ -2152,17 +2352,23 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2152
2352
|
];
|
|
2153
2353
|
case 2:
|
|
2154
2354
|
_state.sent();
|
|
2155
|
-
this.timing.
|
|
2355
|
+
this.timing.startAdRequestWatchdog(requestToken);
|
|
2356
|
+
this.timing.noteAdRequestSent();
|
|
2156
2357
|
ap = this.host.getAdPlayer();
|
|
2358
|
+
requestUrl = this.withCurrentPodBudget(vastTagUrl);
|
|
2359
|
+
this.currentVastUrl = requestUrl;
|
|
2360
|
+
this.beginFunnelRequest(ap, requestToken);
|
|
2157
2361
|
return [
|
|
2158
2362
|
4,
|
|
2159
|
-
|
|
2363
|
+
this.callController(function() {
|
|
2364
|
+
return ap.requestAds(requestUrl);
|
|
2365
|
+
})
|
|
2160
2366
|
];
|
|
2161
2367
|
case 3:
|
|
2162
2368
|
_state.sent();
|
|
2163
2369
|
sendAdLoadedTracking(this.host.config.licenseKey, {
|
|
2164
2370
|
source: "hls",
|
|
2165
|
-
vastUrl:
|
|
2371
|
+
vastUrl: requestUrl,
|
|
2166
2372
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2167
2373
|
}, this.analyticsContext).catch(function() {});
|
|
2168
2374
|
this.timing.clearAdRequestWatchdog();
|
|
@@ -2170,6 +2376,14 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2170
2376
|
2
|
|
2171
2377
|
];
|
|
2172
2378
|
if (!this.timing.ensureLoadedAdFitsBudget(ap)) {
|
|
2379
|
+
;
|
|
2380
|
+
adDurationS = (_ap_getLoadedAdDuration = ap.getLoadedAdDuration) === null || _ap_getLoadedAdDuration === void 0 ? void 0 : _ap_getLoadedAdDuration.call(ap);
|
|
2381
|
+
remainingMs = Math.min(this.timing.getWallClockRemainingAdMs(), this.timing.getDurationBudgetRemainingMs());
|
|
2382
|
+
this.logOrchestratorFunnel("discarded_budget", {
|
|
2383
|
+
vastUrl: requestUrl,
|
|
2384
|
+
adDurationMs: adDurationS != null ? adDurationS * 1e3 : void 0,
|
|
2385
|
+
remainingMs: remainingMs
|
|
2386
|
+
});
|
|
2173
2387
|
this.timing.rejectLoadedAdForDuration(ap);
|
|
2174
2388
|
this.recreateAdController();
|
|
2175
2389
|
throw new Error("ad_duration_exceeds_budget");
|
|
@@ -2185,16 +2399,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2185
2399
|
this.timing.startAdFailsafeTimer(requestToken);
|
|
2186
2400
|
return [
|
|
2187
2401
|
4,
|
|
2188
|
-
|
|
2402
|
+
this.callController(function() {
|
|
2403
|
+
return ap.play();
|
|
2404
|
+
})
|
|
2189
2405
|
];
|
|
2190
2406
|
case 5:
|
|
2191
2407
|
_state.sent();
|
|
2192
|
-
this.timing.markAdStarted();
|
|
2193
2408
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
2194
2409
|
this.timing.scheduleAdStopAtBreakBoundary();
|
|
2195
2410
|
}
|
|
2196
2411
|
ap.setAdVolume(getAdAudioVolume(ap));
|
|
2197
|
-
this.timing.consecutiveFailures = 0;
|
|
2198
2412
|
this.timing.temporaryFailureUrls.delete(vastTagUrl);
|
|
2199
2413
|
return [
|
|
2200
2414
|
3,
|
|
@@ -2358,7 +2572,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2358
2572
|
];
|
|
2359
2573
|
case 5:
|
|
2360
2574
|
_state.sent();
|
|
2361
|
-
this.timing.consecutiveFailures = 0;
|
|
2362
2575
|
return [
|
|
2363
2576
|
3,
|
|
2364
2577
|
10
|
|
@@ -2370,6 +2583,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2370
2583
|
3,
|
|
2371
2584
|
8
|
|
2372
2585
|
];
|
|
2586
|
+
this.timing.consecutiveFailures++;
|
|
2373
2587
|
return [
|
|
2374
2588
|
4,
|
|
2375
2589
|
this.tryNextAvailableAdWithRateLimit()
|
|
@@ -2420,6 +2634,67 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2420
2634
|
// ───────────────────────────────────────────────────────────────
|
|
2421
2635
|
// Ad break completion
|
|
2422
2636
|
// ───────────────────────────────────────────────────────────────
|
|
2637
|
+
key: "logBreakFunnel",
|
|
2638
|
+
value: function logBreakFunnel() {
|
|
2639
|
+
var funnel = this.breakFunnel;
|
|
2640
|
+
this.breakFunnel = {};
|
|
2641
|
+
if (Object.keys(funnel).length === 0) return;
|
|
2642
|
+
var count = function count(stage) {
|
|
2643
|
+
var _funnel_stage;
|
|
2644
|
+
return (_funnel_stage = funnel[stage]) !== null && _funnel_stage !== void 0 ? _funnel_stage : 0;
|
|
2645
|
+
};
|
|
2646
|
+
var breakId = this.opportunityEpoch;
|
|
2647
|
+
if (count("request_sent") > 0 && count("impression_fired") === 0) {
|
|
2648
|
+
console.log("[AdBreak][FUNNEL] break_abandoned_before_start", {
|
|
2649
|
+
breakId: breakId,
|
|
2650
|
+
requests: count("request_sent")
|
|
2651
|
+
});
|
|
2652
|
+
}
|
|
2653
|
+
console.log("[AdBreak][FUNNEL] Break summary", {
|
|
2654
|
+
breakId: breakId,
|
|
2655
|
+
opportunities: count("opportunity_created"),
|
|
2656
|
+
requests: count("request_sent"),
|
|
2657
|
+
duplicates: count("duplicate_request_detected") + count("duplicate_break_start"),
|
|
2658
|
+
filled: count("vast_received"),
|
|
2659
|
+
noFill: count("no_fill"),
|
|
2660
|
+
requestFailed: count("request_failed"),
|
|
2661
|
+
requestAbortedTimeout: count("request_aborted_timeout"),
|
|
2662
|
+
credentialsRetries: count("vast_credentials_retry"),
|
|
2663
|
+
wrapperFailures: count("wrapper_fetch:failure"),
|
|
2664
|
+
noSupportedMedia: count("vast_no_supported_media"),
|
|
2665
|
+
vpaidOnly: count("vast_no_supported_media:vpaid_only"),
|
|
2666
|
+
missingImpression: count("vast_missing_impression"),
|
|
2667
|
+
discardedBudget: count("discarded_budget"),
|
|
2668
|
+
mediaCandidates: count("media_candidate:accepted") + count("media_candidate:rejected"),
|
|
2669
|
+
mediaRejected: count("media_candidate:rejected"),
|
|
2670
|
+
mediaFallbacks: count("media_fallback"),
|
|
2671
|
+
playCalled: count("play_called"),
|
|
2672
|
+
playRejected: count("play_rejected"),
|
|
2673
|
+
mutedRetry: count("muted_retry"),
|
|
2674
|
+
startTimeouts: count("play_resolved_but_never_started"),
|
|
2675
|
+
impressions: count("impression_fired"),
|
|
2676
|
+
impressionUrls: count("impression_urls"),
|
|
2677
|
+
trackingRequests: count("tracking_request_created"),
|
|
2678
|
+
trackingNotLoaded: count("tracking_request_settled:error") + count("tracking_request_settled:timeout"),
|
|
2679
|
+
trackingUnexpandedMacros: count("tracking_url_unexpanded_macro"),
|
|
2680
|
+
trackingInvalidUrls: count("tracking_url_invalid"),
|
|
2681
|
+
vastAdFallbacks: count("vast_ad_fallback"),
|
|
2682
|
+
mediaEvents: count("media_event"),
|
|
2683
|
+
quartile25: count("first_quartile"),
|
|
2684
|
+
quartile50: count("midpoint"),
|
|
2685
|
+
quartile75: count("third_quartile"),
|
|
2686
|
+
complete: count("complete"),
|
|
2687
|
+
stoppedBeforeStart: count("stopped_before_start"),
|
|
2688
|
+
stoppedBeforeStartByBreakEnd: count("ad_stopped_before_start"),
|
|
2689
|
+
unexpectedUnmutes: count("unexpected_unmute"),
|
|
2690
|
+
unmuteBlocked: count("unmute_blocked_without_gesture"),
|
|
2691
|
+
visibilityHidden: count("while_hidden"),
|
|
2692
|
+
playbackFailures: count("play_failed") + count("media_error") + count("hls_fatal") + count("stall") + count("decode_failure") + count("media_unsupported"),
|
|
2693
|
+
stages: funnel
|
|
2694
|
+
});
|
|
2695
|
+
}
|
|
2696
|
+
},
|
|
2697
|
+
{
|
|
2423
2698
|
key: "handleAdPodComplete",
|
|
2424
2699
|
value: function handleAdPodComplete() {
|
|
2425
2700
|
if (this.debug) {
|
|
@@ -2440,6 +2715,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2440
2715
|
this.adPodQueue = [];
|
|
2441
2716
|
this.showAds = false;
|
|
2442
2717
|
this.host.getAdPlayer().stop().catch(function() {});
|
|
2718
|
+
this.logBreakFunnel();
|
|
2443
2719
|
var restoredMuted = this.host.getAdPlayer().getOriginalMutedState();
|
|
2444
2720
|
var restoredVolume = this.host.getAdPlayer().getOriginalVolume();
|
|
2445
2721
|
if (this.host.video.muted !== restoredMuted) {
|