stormcloud-video-player 0.8.24 → 0.8.26
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 +1 -1
- package/lib/index.cjs +669 -126
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +10 -1
- package/lib/index.d.ts +10 -1
- package/lib/index.js +666 -127
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +228 -48
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +5 -1
- package/lib/player/AdConfigManager.cjs +81 -4
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdConfigManager.d.cts +12 -1
- package/lib/player/AdPreloadPool.d.cts +1 -1
- package/lib/player/AdTimingService.cjs +7 -0
- package/lib/player/AdTimingService.cjs.map +1 -1
- package/lib/player/AdTimingService.d.cts +2 -1
- package/lib/player/HlsEngine.d.cts +1 -1
- package/lib/player/PlayerControls.d.cts +1 -1
- package/lib/player/Scte35CueManager.d.cts +1 -1
- package/lib/player/Scte35Parser.d.cts +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +665 -126
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +2 -1
- package/lib/player/playerTypes.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +665 -126
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +665 -126
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +343 -71
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/{types-DNiBmPKK.d.cts → types-Xgz2_W1C.d.cts} +7 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +665 -126
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/tracking.cjs +22 -1
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +3 -2
- package/lib/utils/vastMacros.cjs +14 -1
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +3 -0
- package/package.json +1 -1
|
@@ -722,6 +722,16 @@ function normalizeBoolean(value) {
|
|
|
722
722
|
}
|
|
723
723
|
// src/utils/tracking.ts
|
|
724
724
|
var cachedBrowserId = null;
|
|
725
|
+
function buildAnalyticsContext(config) {
|
|
726
|
+
var context = {};
|
|
727
|
+
if (config.debugAdTiming) {
|
|
728
|
+
context.debugAdTiming = true;
|
|
729
|
+
}
|
|
730
|
+
if (config.isLiveStream !== void 0) {
|
|
731
|
+
context.inputStreamType = config.isLiveStream ? "live" : "vod";
|
|
732
|
+
}
|
|
733
|
+
return context;
|
|
734
|
+
}
|
|
725
735
|
function getClientInfo() {
|
|
726
736
|
var _screen, _screen1, _screen2, _screen3, _screen_orientation, _screen4, _screen5, _window, _window1, _window_screen_orientation, _window_screen, _navigator_languages;
|
|
727
737
|
var ua = navigator.userAgent;
|
|
@@ -980,19 +990,26 @@ function canPublish(licenseKey) {
|
|
|
980
990
|
}
|
|
981
991
|
function buildPlayerMetricEvent() {
|
|
982
992
|
return _async_to_generator(function() {
|
|
983
|
-
var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, playerId, captureAt;
|
|
993
|
+
var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, debugAdTiming, playerId, captureAt;
|
|
984
994
|
var _arguments = arguments;
|
|
985
995
|
return _ts_generator(this, function(_state) {
|
|
986
996
|
switch(_state.label){
|
|
987
997
|
case 0:
|
|
988
998
|
context = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, flags = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
989
999
|
clientInfo = getClientInfo();
|
|
1000
|
+
debugAdTiming = !!context.debugAdTiming;
|
|
1001
|
+
if (debugAdTiming) {
|
|
1002
|
+
console.log("[StormcloudVideoPlayer] clientInfo: ", JSON.stringify(clientInfo, null, 2));
|
|
1003
|
+
}
|
|
990
1004
|
return [
|
|
991
1005
|
4,
|
|
992
1006
|
getBrowserID(clientInfo)
|
|
993
1007
|
];
|
|
994
1008
|
case 1:
|
|
995
1009
|
playerId = _state.sent();
|
|
1010
|
+
if (debugAdTiming) {
|
|
1011
|
+
console.log("[StormcloudVideoPlayer] playerId: ", playerId);
|
|
1012
|
+
}
|
|
996
1013
|
captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
|
|
997
1014
|
return [
|
|
998
1015
|
2,
|
|
@@ -1194,19 +1211,38 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1194
1211
|
}
|
|
1195
1212
|
},
|
|
1196
1213
|
{
|
|
1197
|
-
|
|
1214
|
+
key: "analyticsContext",
|
|
1215
|
+
get: function get() {
|
|
1216
|
+
return buildAnalyticsContext(this.host.config);
|
|
1217
|
+
}
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
key: "optimizedPodsEnabled",
|
|
1221
|
+
get: // ───────────────────────────────────────────────────────────────
|
|
1198
1222
|
// IMA event listeners
|
|
1199
1223
|
// ───────────────────────────────────────────────────────────────
|
|
1224
|
+
function get() {
|
|
1225
|
+
return !!this.host.config.optimizedPods;
|
|
1226
|
+
}
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1200
1229
|
key: "attachImaEventListeners",
|
|
1201
1230
|
value: function attachImaEventListeners() {
|
|
1202
1231
|
var _this = this;
|
|
1203
1232
|
var adPlayer = this.host.getAdPlayer();
|
|
1233
|
+
adPlayer.on("pod_ad_started", function(payload) {
|
|
1234
|
+
_this.timing.notePodAdStarted();
|
|
1235
|
+
if (_this.debug) {
|
|
1236
|
+
var _ref;
|
|
1237
|
+
console.log("[POD] Playing pod ad ".concat((payload === null || payload === void 0 ? void 0 : payload.index) != null ? payload.index + 1 : "?", "/").concat((_ref = payload === null || payload === void 0 ? void 0 : payload.total) !== null && _ref !== void 0 ? _ref : "?"));
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1204
1240
|
adPlayer.on("all_ads_completed", function() {
|
|
1205
1241
|
sendAdImpressionTracking(_this.host.config.licenseKey, {
|
|
1206
1242
|
source: "hls",
|
|
1207
1243
|
adIndex: _this.timing.currentAdIndex,
|
|
1208
1244
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
1209
|
-
}).catch(function() {});
|
|
1245
|
+
}, _this.analyticsContext).catch(function() {});
|
|
1210
1246
|
_this.timing.recordPlayedAdDuration(_this.host.getAdPlayer());
|
|
1211
1247
|
var remaining = _this.timing.getRemainingAdMs();
|
|
1212
1248
|
_this.timing.consecutiveFailures = 0;
|
|
@@ -1268,7 +1304,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1268
1304
|
source: "hls",
|
|
1269
1305
|
adIndex: _this.timing.currentAdIndex,
|
|
1270
1306
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
1271
|
-
}).catch(function() {});
|
|
1307
|
+
}, _this.analyticsContext).catch(function() {});
|
|
1272
1308
|
if (!_this.host.video.muted) {
|
|
1273
1309
|
_this.host.video.muted = true;
|
|
1274
1310
|
if (_this.debug) {
|
|
@@ -1358,7 +1394,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1358
1394
|
// ───────────────────────────────────────────────────────────────
|
|
1359
1395
|
function handleAdStart(_marker) {
|
|
1360
1396
|
return _async_to_generator(function() {
|
|
1361
|
-
var scheduled, tags, baseVastUrl, adBreakDurationMs, mode, currentMuted, currentVolume, firstAdUrl, usePreloadedAd, preloadedController, preloaded, firstAdUrlArray, adPlayer, preservedMuted, preservedVolume, adVolume, adPlayer1, adVolume1, error, fallbackPreloaded, ap, adVolume2, fallbackError;
|
|
1397
|
+
var scheduled, tags, baseVastUrl, adBreakDurationMs, mode, currentMuted, currentVolume, podPlayed, firstAdUrl, usePreloadedAd, preloadedController, preloaded, firstAdUrlArray, adPlayer, preservedMuted, preservedVolume, adVolume, adPlayer1, adVolume1, error, fallbackPreloaded, ap, adVolume2, fallbackError;
|
|
1362
1398
|
return _ts_generator(this, function(_state) {
|
|
1363
1399
|
switch(_state.label){
|
|
1364
1400
|
case 0:
|
|
@@ -1405,6 +1441,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1405
1441
|
if (this.timing.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
|
|
1406
1442
|
this.timing.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
1407
1443
|
}
|
|
1444
|
+
if (!this.optimizedPodsEnabled) return [
|
|
1445
|
+
3,
|
|
1446
|
+
2
|
|
1447
|
+
];
|
|
1448
|
+
return [
|
|
1449
|
+
4,
|
|
1450
|
+
this.startOptimizedPod(baseVastUrl, adBreakDurationMs, currentMuted, currentVolume)
|
|
1451
|
+
];
|
|
1452
|
+
case 1:
|
|
1453
|
+
podPlayed = _state.sent();
|
|
1454
|
+
if (podPlayed) {
|
|
1455
|
+
return [
|
|
1456
|
+
2
|
|
1457
|
+
];
|
|
1458
|
+
}
|
|
1459
|
+
if (this.debug) {
|
|
1460
|
+
console.log("[POD] Optimized pod unavailable, falling back to sequential single-ad path");
|
|
1461
|
+
}
|
|
1462
|
+
_state.label = 2;
|
|
1463
|
+
case 2:
|
|
1408
1464
|
usePreloadedAd = false;
|
|
1409
1465
|
preloaded = this.preloadPool.getPreloadedAd();
|
|
1410
1466
|
if (preloaded) {
|
|
@@ -1415,7 +1471,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1415
1471
|
source: "hls",
|
|
1416
1472
|
vastUrl: firstAdUrl,
|
|
1417
1473
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
1418
|
-
}).catch(function() {});
|
|
1474
|
+
}, this.analyticsContext).catch(function() {});
|
|
1419
1475
|
if (this.debug) {
|
|
1420
1476
|
console.log("[CONTINUOUS-FETCH] Using preloaded ad from pool (preloaded in advance, ready immediately!)");
|
|
1421
1477
|
}
|
|
@@ -1446,21 +1502,21 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1446
1502
|
if (this.debug) {
|
|
1447
1503
|
console.log("[CONTINUOUS-FETCH] First VAST URL:", firstAdUrl);
|
|
1448
1504
|
}
|
|
1449
|
-
_state.label =
|
|
1450
|
-
case
|
|
1505
|
+
_state.label = 3;
|
|
1506
|
+
case 3:
|
|
1451
1507
|
_state.trys.push([
|
|
1452
|
-
|
|
1453
|
-
|
|
1508
|
+
3,
|
|
1509
|
+
14,
|
|
1454
1510
|
,
|
|
1455
|
-
|
|
1511
|
+
22
|
|
1456
1512
|
]);
|
|
1457
1513
|
if (!(usePreloadedAd && preloadedController)) return [
|
|
1458
1514
|
3,
|
|
1459
|
-
|
|
1515
|
+
7
|
|
1460
1516
|
];
|
|
1461
1517
|
if (!!this.timing.ensureLoadedAdFitsBudget(preloadedController)) return [
|
|
1462
1518
|
3,
|
|
1463
|
-
|
|
1519
|
+
5
|
|
1464
1520
|
];
|
|
1465
1521
|
this.timing.rejectLoadedAdForDuration(preloadedController);
|
|
1466
1522
|
this.startContinuousFetching(baseVastUrl);
|
|
@@ -1468,12 +1524,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1468
1524
|
4,
|
|
1469
1525
|
this.tryNextAvailableAdWithRateLimit()
|
|
1470
1526
|
];
|
|
1471
|
-
case
|
|
1527
|
+
case 4:
|
|
1472
1528
|
_state.sent();
|
|
1473
1529
|
return [
|
|
1474
1530
|
2
|
|
1475
1531
|
];
|
|
1476
|
-
case
|
|
1532
|
+
case 5:
|
|
1477
1533
|
adPlayer = this.host.getAdPlayer();
|
|
1478
1534
|
preservedMuted = adPlayer.getOriginalMutedState();
|
|
1479
1535
|
preservedVolume = adPlayer.getOriginalVolume();
|
|
@@ -1498,7 +1554,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1498
1554
|
4,
|
|
1499
1555
|
preloadedController.play()
|
|
1500
1556
|
];
|
|
1501
|
-
case
|
|
1557
|
+
case 6:
|
|
1502
1558
|
_state.sent();
|
|
1503
1559
|
this.timing.markAdStarted();
|
|
1504
1560
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
@@ -1508,34 +1564,34 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1508
1564
|
preloadedController.setAdVolume(adVolume);
|
|
1509
1565
|
return [
|
|
1510
1566
|
3,
|
|
1511
|
-
|
|
1567
|
+
13
|
|
1512
1568
|
];
|
|
1513
|
-
case
|
|
1569
|
+
case 7:
|
|
1514
1570
|
adPlayer1 = this.host.getAdPlayer();
|
|
1515
1571
|
return [
|
|
1516
1572
|
4,
|
|
1517
1573
|
this.timing.enforceGlobalRateLimit()
|
|
1518
1574
|
];
|
|
1519
|
-
case
|
|
1575
|
+
case 8:
|
|
1520
1576
|
_state.sent();
|
|
1521
1577
|
this.timing.lastAdRequestTime = Date.now();
|
|
1522
1578
|
return [
|
|
1523
1579
|
4,
|
|
1524
1580
|
adPlayer1.requestAds(firstAdUrl)
|
|
1525
1581
|
];
|
|
1526
|
-
case
|
|
1582
|
+
case 9:
|
|
1527
1583
|
_state.sent();
|
|
1528
1584
|
sendAdLoadedTracking(this.host.config.licenseKey, {
|
|
1529
1585
|
source: "hls",
|
|
1530
1586
|
vastUrl: firstAdUrl,
|
|
1531
1587
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
1532
|
-
}).catch(function() {});
|
|
1588
|
+
}, this.analyticsContext).catch(function() {});
|
|
1533
1589
|
if (this.debug) {
|
|
1534
1590
|
console.log("[CONTINUOUS-FETCH] First ad request successful, starting playback");
|
|
1535
1591
|
}
|
|
1536
1592
|
if (!!this.timing.ensureLoadedAdFitsBudget(adPlayer1)) return [
|
|
1537
1593
|
3,
|
|
1538
|
-
|
|
1594
|
+
11
|
|
1539
1595
|
];
|
|
1540
1596
|
this.timing.rejectLoadedAdForDuration(adPlayer1);
|
|
1541
1597
|
this.recreateAdController();
|
|
@@ -1544,12 +1600,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1544
1600
|
4,
|
|
1545
1601
|
this.tryNextAvailableAdWithRateLimit()
|
|
1546
1602
|
];
|
|
1547
|
-
case
|
|
1603
|
+
case 10:
|
|
1548
1604
|
_state.sent();
|
|
1549
1605
|
return [
|
|
1550
1606
|
2
|
|
1551
1607
|
];
|
|
1552
|
-
case
|
|
1608
|
+
case 11:
|
|
1553
1609
|
this.timing.consecutiveFailures = 0;
|
|
1554
1610
|
this.startContinuousFetching(baseVastUrl);
|
|
1555
1611
|
if (!this.preloadPool.active) {
|
|
@@ -1559,7 +1615,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1559
1615
|
4,
|
|
1560
1616
|
adPlayer1.play()
|
|
1561
1617
|
];
|
|
1562
|
-
case
|
|
1618
|
+
case 12:
|
|
1563
1619
|
_state.sent();
|
|
1564
1620
|
this.timing.markAdStarted();
|
|
1565
1621
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
@@ -1567,40 +1623,40 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1567
1623
|
}
|
|
1568
1624
|
adVolume1 = currentMuted ? 0 : currentVolume;
|
|
1569
1625
|
adPlayer1.setAdVolume(adVolume1);
|
|
1570
|
-
_state.label =
|
|
1571
|
-
case
|
|
1626
|
+
_state.label = 13;
|
|
1627
|
+
case 13:
|
|
1572
1628
|
return [
|
|
1573
1629
|
3,
|
|
1574
|
-
|
|
1630
|
+
22
|
|
1575
1631
|
];
|
|
1576
|
-
case
|
|
1632
|
+
case 14:
|
|
1577
1633
|
error = _state.sent();
|
|
1578
1634
|
if (this.debug) {
|
|
1579
1635
|
console.warn("[CONTINUOUS-FETCH] First ad request failed:", error);
|
|
1580
1636
|
}
|
|
1581
1637
|
if (!!usePreloadedAd) return [
|
|
1582
1638
|
3,
|
|
1583
|
-
|
|
1639
|
+
20
|
|
1584
1640
|
];
|
|
1585
1641
|
fallbackPreloaded = this.preloadPool.getPreloadedAd();
|
|
1586
1642
|
if (!fallbackPreloaded) return [
|
|
1587
1643
|
3,
|
|
1588
|
-
|
|
1644
|
+
20
|
|
1589
1645
|
];
|
|
1590
1646
|
if (this.debug) {
|
|
1591
1647
|
console.log("[CONTINUOUS-FETCH] First ad failed, using preloaded fallback");
|
|
1592
1648
|
}
|
|
1593
|
-
_state.label =
|
|
1594
|
-
case
|
|
1649
|
+
_state.label = 15;
|
|
1650
|
+
case 15:
|
|
1595
1651
|
_state.trys.push([
|
|
1596
|
-
|
|
1597
|
-
|
|
1652
|
+
15,
|
|
1653
|
+
19,
|
|
1598
1654
|
,
|
|
1599
|
-
|
|
1655
|
+
20
|
|
1600
1656
|
]);
|
|
1601
1657
|
if (!!this.timing.ensureLoadedAdFitsBudget(fallbackPreloaded.adController)) return [
|
|
1602
1658
|
3,
|
|
1603
|
-
|
|
1659
|
+
17
|
|
1604
1660
|
];
|
|
1605
1661
|
this.timing.rejectLoadedAdForDuration(fallbackPreloaded.adController);
|
|
1606
1662
|
this.startContinuousFetching(baseVastUrl);
|
|
@@ -1608,12 +1664,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1608
1664
|
4,
|
|
1609
1665
|
this.tryNextAvailableAdWithRateLimit()
|
|
1610
1666
|
];
|
|
1611
|
-
case
|
|
1667
|
+
case 16:
|
|
1612
1668
|
_state.sent();
|
|
1613
1669
|
return [
|
|
1614
1670
|
2
|
|
1615
1671
|
];
|
|
1616
|
-
case
|
|
1672
|
+
case 17:
|
|
1617
1673
|
this.swapToPreloadedAdPlayer(fallbackPreloaded.adController);
|
|
1618
1674
|
this.timing.consecutiveFailures = 0;
|
|
1619
1675
|
this.startContinuousFetching(baseVastUrl);
|
|
@@ -1626,7 +1682,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1626
1682
|
4,
|
|
1627
1683
|
ap.play()
|
|
1628
1684
|
];
|
|
1629
|
-
case
|
|
1685
|
+
case 18:
|
|
1630
1686
|
_state.sent();
|
|
1631
1687
|
this.timing.markAdStarted();
|
|
1632
1688
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
@@ -1637,16 +1693,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1637
1693
|
return [
|
|
1638
1694
|
2
|
|
1639
1695
|
];
|
|
1640
|
-
case
|
|
1696
|
+
case 19:
|
|
1641
1697
|
fallbackError = _state.sent();
|
|
1642
1698
|
if (this.debug) {
|
|
1643
1699
|
console.warn("[CONTINUOUS-FETCH] Preloaded fallback also failed:", fallbackError);
|
|
1644
1700
|
}
|
|
1645
1701
|
return [
|
|
1646
1702
|
3,
|
|
1647
|
-
|
|
1703
|
+
20
|
|
1648
1704
|
];
|
|
1649
|
-
case
|
|
1705
|
+
case 20:
|
|
1650
1706
|
if (this.timing.isTemporaryAdError(error)) {
|
|
1651
1707
|
this.timing.temporaryFailureUrls.set(firstAdUrl, Date.now());
|
|
1652
1708
|
if (this.debug) {
|
|
@@ -1664,13 +1720,137 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1664
1720
|
4,
|
|
1665
1721
|
this.tryNextAvailableAdWithRateLimit()
|
|
1666
1722
|
];
|
|
1667
|
-
case
|
|
1723
|
+
case 21:
|
|
1668
1724
|
_state.sent();
|
|
1669
1725
|
return [
|
|
1670
1726
|
3,
|
|
1671
|
-
|
|
1727
|
+
22
|
|
1672
1728
|
];
|
|
1673
|
-
case
|
|
1729
|
+
case 22:
|
|
1730
|
+
return [
|
|
1731
|
+
2
|
|
1732
|
+
];
|
|
1733
|
+
}
|
|
1734
|
+
});
|
|
1735
|
+
}).call(this);
|
|
1736
|
+
}
|
|
1737
|
+
},
|
|
1738
|
+
{
|
|
1739
|
+
key: "startOptimizedPod",
|
|
1740
|
+
value: // ───────────────────────────────────────────────────────────────
|
|
1741
|
+
// Optimized pod (single multi-ad request)
|
|
1742
|
+
// ───────────────────────────────────────────────────────────────
|
|
1743
|
+
function startOptimizedPod(baseVastUrl, breakDurationMs, currentMuted, currentVolume) {
|
|
1744
|
+
return _async_to_generator(function() {
|
|
1745
|
+
var podUrl, adPlayer, requestToken, _ref, _adPlayer_getPodAdCount, podCount, error;
|
|
1746
|
+
return _ts_generator(this, function(_state) {
|
|
1747
|
+
switch(_state.label){
|
|
1748
|
+
case 0:
|
|
1749
|
+
if (this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0) {
|
|
1750
|
+
podUrl = this.pendingAdBreak.vastUrls[0];
|
|
1751
|
+
this.clearPendingAdBreak();
|
|
1752
|
+
} else {
|
|
1753
|
+
podUrl = this.host.generatePodVastUrl(baseVastUrl, breakDurationMs);
|
|
1754
|
+
}
|
|
1755
|
+
if (!podUrl) {
|
|
1756
|
+
return [
|
|
1757
|
+
2,
|
|
1758
|
+
false
|
|
1759
|
+
];
|
|
1760
|
+
}
|
|
1761
|
+
this.continuousFetchingActive = false;
|
|
1762
|
+
this.recreateAdController();
|
|
1763
|
+
adPlayer = this.host.getAdPlayer();
|
|
1764
|
+
requestToken = ++this.timing.adRequestTokenCounter;
|
|
1765
|
+
this.timing.activeAdRequestToken = requestToken;
|
|
1766
|
+
this.timing.startAdRequestWatchdog(requestToken);
|
|
1767
|
+
_state.label = 1;
|
|
1768
|
+
case 1:
|
|
1769
|
+
_state.trys.push([
|
|
1770
|
+
1,
|
|
1771
|
+
5,
|
|
1772
|
+
,
|
|
1773
|
+
6
|
|
1774
|
+
]);
|
|
1775
|
+
return [
|
|
1776
|
+
4,
|
|
1777
|
+
this.timing.enforceGlobalRateLimit()
|
|
1778
|
+
];
|
|
1779
|
+
case 2:
|
|
1780
|
+
_state.sent();
|
|
1781
|
+
this.timing.lastAdRequestTime = Date.now();
|
|
1782
|
+
return [
|
|
1783
|
+
4,
|
|
1784
|
+
adPlayer.requestAds(podUrl)
|
|
1785
|
+
];
|
|
1786
|
+
case 3:
|
|
1787
|
+
_state.sent();
|
|
1788
|
+
this.timing.clearAdRequestWatchdog();
|
|
1789
|
+
if (this.timing.activeAdRequestToken !== requestToken) {
|
|
1790
|
+
return [
|
|
1791
|
+
2,
|
|
1792
|
+
true
|
|
1793
|
+
];
|
|
1794
|
+
}
|
|
1795
|
+
podCount = (_ref = (_adPlayer_getPodAdCount = adPlayer.getPodAdCount) === null || _adPlayer_getPodAdCount === void 0 ? void 0 : _adPlayer_getPodAdCount.call(adPlayer)) !== null && _ref !== void 0 ? _ref : 1;
|
|
1796
|
+
if (podCount < 1) {
|
|
1797
|
+
return [
|
|
1798
|
+
2,
|
|
1799
|
+
false
|
|
1800
|
+
];
|
|
1801
|
+
}
|
|
1802
|
+
if (this.debug) {
|
|
1803
|
+
console.log(podCount === 1 ? "[POD] Response contained a single ad; playing it and enabling sequential top-up" : "[POD] Optimized pod returned ".concat(podCount, " ads; playing pod in one controller"));
|
|
1804
|
+
}
|
|
1805
|
+
sendAdLoadedTracking(this.host.config.licenseKey, {
|
|
1806
|
+
source: "hls",
|
|
1807
|
+
vastUrl: podUrl,
|
|
1808
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
1809
|
+
}, this.analyticsContext).catch(function() {});
|
|
1810
|
+
this.timing.startAdFailsafeTimer(requestToken);
|
|
1811
|
+
return [
|
|
1812
|
+
4,
|
|
1813
|
+
adPlayer.play()
|
|
1814
|
+
];
|
|
1815
|
+
case 4:
|
|
1816
|
+
_state.sent();
|
|
1817
|
+
this.timing.markAdStarted();
|
|
1818
|
+
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
1819
|
+
this.timing.scheduleAdStopAtBreakBoundary();
|
|
1820
|
+
}
|
|
1821
|
+
adPlayer.setAdVolume(currentMuted ? 0 : currentVolume);
|
|
1822
|
+
this.timing.consecutiveFailures = 0;
|
|
1823
|
+
if (podCount === 1) {
|
|
1824
|
+
this.continuousFetchingActive = true;
|
|
1825
|
+
this.startContinuousFetching(baseVastUrl);
|
|
1826
|
+
if (!this.preloadPool.active) {
|
|
1827
|
+
this.preloadPool.startPreloadPool(baseVastUrl, []);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
return [
|
|
1831
|
+
2,
|
|
1832
|
+
true
|
|
1833
|
+
];
|
|
1834
|
+
case 5:
|
|
1835
|
+
error = _state.sent();
|
|
1836
|
+
this.timing.clearAdRequestWatchdog();
|
|
1837
|
+
this.timing.clearAdFailsafeTimer();
|
|
1838
|
+
if (this.timing.activeAdRequestToken === requestToken) {
|
|
1839
|
+
this.timing.activeAdRequestToken = null;
|
|
1840
|
+
}
|
|
1841
|
+
if (this.debug) {
|
|
1842
|
+
console.warn("[POD] Optimized pod request/play failed:", error);
|
|
1843
|
+
}
|
|
1844
|
+
if (this.timing.isTemporaryAdError(error)) {
|
|
1845
|
+
this.timing.temporaryFailureUrls.set(podUrl, Date.now());
|
|
1846
|
+
}
|
|
1847
|
+
this.continuousFetchingActive = true;
|
|
1848
|
+
this.recreateAdController();
|
|
1849
|
+
return [
|
|
1850
|
+
2,
|
|
1851
|
+
false
|
|
1852
|
+
];
|
|
1853
|
+
case 6:
|
|
1674
1854
|
return [
|
|
1675
1855
|
2
|
|
1676
1856
|
];
|
|
@@ -1993,7 +2173,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1993
2173
|
source: "hls",
|
|
1994
2174
|
vastUrl: preloaded.vastUrl,
|
|
1995
2175
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
1996
|
-
}).catch(function() {});
|
|
2176
|
+
}, this.analyticsContext).catch(function() {});
|
|
1997
2177
|
_state.label = 1;
|
|
1998
2178
|
case 1:
|
|
1999
2179
|
_state.trys.push([
|
|
@@ -2226,7 +2406,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2226
2406
|
source: "hls",
|
|
2227
2407
|
vastUrl: vastTagUrl,
|
|
2228
2408
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
2229
|
-
}).catch(function() {});
|
|
2409
|
+
}, this.analyticsContext).catch(function() {});
|
|
2230
2410
|
this.timing.clearAdRequestWatchdog();
|
|
2231
2411
|
if (this.timing.activeAdRequestToken !== requestToken) return [
|
|
2232
2412
|
2
|