stormcloud-video-player 0.8.25 → 0.8.27
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 +714 -128
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +7 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +714 -128
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +278 -49
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +4 -1
- package/lib/player/AdConfigManager.cjs +144 -14
- 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 +714 -128
- 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 +714 -128
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +714 -128
- 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-Bz4aRmzc.d.cts → types-Xgz2_W1C.d.cts} +6 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +714 -128
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/ctvVastSignals.cjs +80 -8
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/tracking.cjs +80 -8
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/lib/utils/vastEnvironmentSignals.cjs +83 -13
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
- package/lib/utils/vastMacros.cjs +15 -1
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +3 -0
- package/package.json +1 -1
|
@@ -417,26 +417,98 @@ function getOrCreateStoredUuid(storageKey) {
|
|
|
417
417
|
if (typeof window === "undefined") {
|
|
418
418
|
return void 0;
|
|
419
419
|
}
|
|
420
|
-
var existing =
|
|
420
|
+
var existing = readPersistentId(storageKey);
|
|
421
421
|
if (existing) {
|
|
422
|
+
writePersistentId(storageKey, existing);
|
|
422
423
|
return existing;
|
|
423
424
|
}
|
|
424
425
|
var id = createUuid();
|
|
426
|
+
writePersistentId(storageKey, id);
|
|
427
|
+
return id;
|
|
428
|
+
}
|
|
429
|
+
function readPersistentId(storageKey) {
|
|
430
|
+
return readStoredString(storageKey) || readCookie(storageKey);
|
|
431
|
+
}
|
|
432
|
+
function writePersistentId(storageKey, value) {
|
|
425
433
|
try {
|
|
426
434
|
var _window_localStorage;
|
|
427
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey,
|
|
435
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, value);
|
|
436
|
+
} catch (unused) {}
|
|
437
|
+
writeCookie(storageKey, value);
|
|
438
|
+
}
|
|
439
|
+
var PERSISTENT_ID_COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5;
|
|
440
|
+
function readCookie(name) {
|
|
441
|
+
if (typeof document === "undefined") {
|
|
442
|
+
return void 0;
|
|
443
|
+
}
|
|
444
|
+
try {
|
|
445
|
+
var prefix = encodeURIComponent(name) + "=";
|
|
446
|
+
var parts = document.cookie ? document.cookie.split(";") : [];
|
|
447
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
448
|
+
try {
|
|
449
|
+
for(var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
450
|
+
var part = _step.value;
|
|
451
|
+
var entry = part.trim();
|
|
452
|
+
if (entry.startsWith(prefix)) {
|
|
453
|
+
return decodeURIComponent(entry.slice(prefix.length)) || void 0;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
} catch (err) {
|
|
457
|
+
_didIteratorError = true;
|
|
458
|
+
_iteratorError = err;
|
|
459
|
+
} finally{
|
|
460
|
+
try {
|
|
461
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
462
|
+
_iterator.return();
|
|
463
|
+
}
|
|
464
|
+
} finally{
|
|
465
|
+
if (_didIteratorError) {
|
|
466
|
+
throw _iteratorError;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
} catch (unused) {}
|
|
471
|
+
return void 0;
|
|
472
|
+
}
|
|
473
|
+
function writeCookie(name, value) {
|
|
474
|
+
if (typeof document === "undefined") {
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
try {
|
|
478
|
+
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
|
|
428
479
|
} catch (unused) {}
|
|
429
|
-
return id;
|
|
430
480
|
}
|
|
431
481
|
function createUuid() {
|
|
482
|
+
var _bytes_, _bytes_1;
|
|
432
483
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
433
484
|
return crypto.randomUUID();
|
|
434
485
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
486
|
+
var bytes = new Uint8Array(16);
|
|
487
|
+
if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
|
|
488
|
+
crypto.getRandomValues(bytes);
|
|
489
|
+
} else {
|
|
490
|
+
var seed = Date.now() ^ Math.floor(performanceNow() * 1e3);
|
|
491
|
+
for(var i = 0; i < 16; i++){
|
|
492
|
+
seed = seed * 1103515245 + 12345 & 2147483647;
|
|
493
|
+
bytes[i] = (seed ^ Math.floor(Math.random() * 256)) & 255;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
|
|
497
|
+
bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
|
|
498
|
+
var hex = "";
|
|
499
|
+
for(var i1 = 0; i1 < 16; i1++){
|
|
500
|
+
var _bytes_i;
|
|
501
|
+
hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
|
|
502
|
+
}
|
|
503
|
+
return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20, 32);
|
|
504
|
+
}
|
|
505
|
+
function performanceNow() {
|
|
506
|
+
try {
|
|
507
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
508
|
+
return performance.now();
|
|
509
|
+
}
|
|
510
|
+
} catch (unused) {}
|
|
511
|
+
return 0;
|
|
440
512
|
}
|
|
441
513
|
function readPlatformNativeDeviceId() {
|
|
442
514
|
if (typeof window === "undefined") return {};
|
|
@@ -1217,13 +1289,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1217
1289
|
}
|
|
1218
1290
|
},
|
|
1219
1291
|
{
|
|
1220
|
-
|
|
1292
|
+
key: "optimizedPodsEnabled",
|
|
1293
|
+
get: // ───────────────────────────────────────────────────────────────
|
|
1221
1294
|
// IMA event listeners
|
|
1222
1295
|
// ───────────────────────────────────────────────────────────────
|
|
1296
|
+
function get() {
|
|
1297
|
+
return !!this.host.config.optimizedPods;
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1223
1301
|
key: "attachImaEventListeners",
|
|
1224
1302
|
value: function attachImaEventListeners() {
|
|
1225
1303
|
var _this = this;
|
|
1226
1304
|
var adPlayer = this.host.getAdPlayer();
|
|
1305
|
+
adPlayer.on("pod_ad_started", function(payload) {
|
|
1306
|
+
_this.timing.notePodAdStarted();
|
|
1307
|
+
if (_this.debug) {
|
|
1308
|
+
var _ref;
|
|
1309
|
+
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 : "?"));
|
|
1310
|
+
}
|
|
1311
|
+
});
|
|
1227
1312
|
adPlayer.on("all_ads_completed", function() {
|
|
1228
1313
|
sendAdImpressionTracking(_this.host.config.licenseKey, {
|
|
1229
1314
|
source: "hls",
|
|
@@ -1381,7 +1466,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1381
1466
|
// ───────────────────────────────────────────────────────────────
|
|
1382
1467
|
function handleAdStart(_marker) {
|
|
1383
1468
|
return _async_to_generator(function() {
|
|
1384
|
-
var scheduled, tags, baseVastUrl, adBreakDurationMs, mode, currentMuted, currentVolume, firstAdUrl, usePreloadedAd, preloadedController, preloaded, firstAdUrlArray, adPlayer, preservedMuted, preservedVolume, adVolume, adPlayer1, adVolume1, error, fallbackPreloaded, ap, adVolume2, fallbackError;
|
|
1469
|
+
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;
|
|
1385
1470
|
return _ts_generator(this, function(_state) {
|
|
1386
1471
|
switch(_state.label){
|
|
1387
1472
|
case 0:
|
|
@@ -1428,6 +1513,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1428
1513
|
if (this.timing.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
|
|
1429
1514
|
this.timing.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
1430
1515
|
}
|
|
1516
|
+
if (!this.optimizedPodsEnabled) return [
|
|
1517
|
+
3,
|
|
1518
|
+
2
|
|
1519
|
+
];
|
|
1520
|
+
return [
|
|
1521
|
+
4,
|
|
1522
|
+
this.startOptimizedPod(baseVastUrl, adBreakDurationMs, currentMuted, currentVolume)
|
|
1523
|
+
];
|
|
1524
|
+
case 1:
|
|
1525
|
+
podPlayed = _state.sent();
|
|
1526
|
+
if (podPlayed) {
|
|
1527
|
+
return [
|
|
1528
|
+
2
|
|
1529
|
+
];
|
|
1530
|
+
}
|
|
1531
|
+
if (this.debug) {
|
|
1532
|
+
console.log("[POD] Optimized pod unavailable, falling back to sequential single-ad path");
|
|
1533
|
+
}
|
|
1534
|
+
_state.label = 2;
|
|
1535
|
+
case 2:
|
|
1431
1536
|
usePreloadedAd = false;
|
|
1432
1537
|
preloaded = this.preloadPool.getPreloadedAd();
|
|
1433
1538
|
if (preloaded) {
|
|
@@ -1469,21 +1574,21 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1469
1574
|
if (this.debug) {
|
|
1470
1575
|
console.log("[CONTINUOUS-FETCH] First VAST URL:", firstAdUrl);
|
|
1471
1576
|
}
|
|
1472
|
-
_state.label =
|
|
1473
|
-
case
|
|
1577
|
+
_state.label = 3;
|
|
1578
|
+
case 3:
|
|
1474
1579
|
_state.trys.push([
|
|
1475
|
-
|
|
1476
|
-
|
|
1580
|
+
3,
|
|
1581
|
+
14,
|
|
1477
1582
|
,
|
|
1478
|
-
|
|
1583
|
+
22
|
|
1479
1584
|
]);
|
|
1480
1585
|
if (!(usePreloadedAd && preloadedController)) return [
|
|
1481
1586
|
3,
|
|
1482
|
-
|
|
1587
|
+
7
|
|
1483
1588
|
];
|
|
1484
1589
|
if (!!this.timing.ensureLoadedAdFitsBudget(preloadedController)) return [
|
|
1485
1590
|
3,
|
|
1486
|
-
|
|
1591
|
+
5
|
|
1487
1592
|
];
|
|
1488
1593
|
this.timing.rejectLoadedAdForDuration(preloadedController);
|
|
1489
1594
|
this.startContinuousFetching(baseVastUrl);
|
|
@@ -1491,12 +1596,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1491
1596
|
4,
|
|
1492
1597
|
this.tryNextAvailableAdWithRateLimit()
|
|
1493
1598
|
];
|
|
1494
|
-
case
|
|
1599
|
+
case 4:
|
|
1495
1600
|
_state.sent();
|
|
1496
1601
|
return [
|
|
1497
1602
|
2
|
|
1498
1603
|
];
|
|
1499
|
-
case
|
|
1604
|
+
case 5:
|
|
1500
1605
|
adPlayer = this.host.getAdPlayer();
|
|
1501
1606
|
preservedMuted = adPlayer.getOriginalMutedState();
|
|
1502
1607
|
preservedVolume = adPlayer.getOriginalVolume();
|
|
@@ -1521,7 +1626,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1521
1626
|
4,
|
|
1522
1627
|
preloadedController.play()
|
|
1523
1628
|
];
|
|
1524
|
-
case
|
|
1629
|
+
case 6:
|
|
1525
1630
|
_state.sent();
|
|
1526
1631
|
this.timing.markAdStarted();
|
|
1527
1632
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
@@ -1531,22 +1636,22 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1531
1636
|
preloadedController.setAdVolume(adVolume);
|
|
1532
1637
|
return [
|
|
1533
1638
|
3,
|
|
1534
|
-
|
|
1639
|
+
13
|
|
1535
1640
|
];
|
|
1536
|
-
case
|
|
1641
|
+
case 7:
|
|
1537
1642
|
adPlayer1 = this.host.getAdPlayer();
|
|
1538
1643
|
return [
|
|
1539
1644
|
4,
|
|
1540
1645
|
this.timing.enforceGlobalRateLimit()
|
|
1541
1646
|
];
|
|
1542
|
-
case
|
|
1647
|
+
case 8:
|
|
1543
1648
|
_state.sent();
|
|
1544
1649
|
this.timing.lastAdRequestTime = Date.now();
|
|
1545
1650
|
return [
|
|
1546
1651
|
4,
|
|
1547
1652
|
adPlayer1.requestAds(firstAdUrl)
|
|
1548
1653
|
];
|
|
1549
|
-
case
|
|
1654
|
+
case 9:
|
|
1550
1655
|
_state.sent();
|
|
1551
1656
|
sendAdLoadedTracking(this.host.config.licenseKey, {
|
|
1552
1657
|
source: "hls",
|
|
@@ -1558,7 +1663,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1558
1663
|
}
|
|
1559
1664
|
if (!!this.timing.ensureLoadedAdFitsBudget(adPlayer1)) return [
|
|
1560
1665
|
3,
|
|
1561
|
-
|
|
1666
|
+
11
|
|
1562
1667
|
];
|
|
1563
1668
|
this.timing.rejectLoadedAdForDuration(adPlayer1);
|
|
1564
1669
|
this.recreateAdController();
|
|
@@ -1567,12 +1672,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1567
1672
|
4,
|
|
1568
1673
|
this.tryNextAvailableAdWithRateLimit()
|
|
1569
1674
|
];
|
|
1570
|
-
case
|
|
1675
|
+
case 10:
|
|
1571
1676
|
_state.sent();
|
|
1572
1677
|
return [
|
|
1573
1678
|
2
|
|
1574
1679
|
];
|
|
1575
|
-
case
|
|
1680
|
+
case 11:
|
|
1576
1681
|
this.timing.consecutiveFailures = 0;
|
|
1577
1682
|
this.startContinuousFetching(baseVastUrl);
|
|
1578
1683
|
if (!this.preloadPool.active) {
|
|
@@ -1582,7 +1687,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1582
1687
|
4,
|
|
1583
1688
|
adPlayer1.play()
|
|
1584
1689
|
];
|
|
1585
|
-
case
|
|
1690
|
+
case 12:
|
|
1586
1691
|
_state.sent();
|
|
1587
1692
|
this.timing.markAdStarted();
|
|
1588
1693
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
@@ -1590,40 +1695,40 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1590
1695
|
}
|
|
1591
1696
|
adVolume1 = currentMuted ? 0 : currentVolume;
|
|
1592
1697
|
adPlayer1.setAdVolume(adVolume1);
|
|
1593
|
-
_state.label =
|
|
1594
|
-
case
|
|
1698
|
+
_state.label = 13;
|
|
1699
|
+
case 13:
|
|
1595
1700
|
return [
|
|
1596
1701
|
3,
|
|
1597
|
-
|
|
1702
|
+
22
|
|
1598
1703
|
];
|
|
1599
|
-
case
|
|
1704
|
+
case 14:
|
|
1600
1705
|
error = _state.sent();
|
|
1601
1706
|
if (this.debug) {
|
|
1602
1707
|
console.warn("[CONTINUOUS-FETCH] First ad request failed:", error);
|
|
1603
1708
|
}
|
|
1604
1709
|
if (!!usePreloadedAd) return [
|
|
1605
1710
|
3,
|
|
1606
|
-
|
|
1711
|
+
20
|
|
1607
1712
|
];
|
|
1608
1713
|
fallbackPreloaded = this.preloadPool.getPreloadedAd();
|
|
1609
1714
|
if (!fallbackPreloaded) return [
|
|
1610
1715
|
3,
|
|
1611
|
-
|
|
1716
|
+
20
|
|
1612
1717
|
];
|
|
1613
1718
|
if (this.debug) {
|
|
1614
1719
|
console.log("[CONTINUOUS-FETCH] First ad failed, using preloaded fallback");
|
|
1615
1720
|
}
|
|
1616
|
-
_state.label =
|
|
1617
|
-
case
|
|
1721
|
+
_state.label = 15;
|
|
1722
|
+
case 15:
|
|
1618
1723
|
_state.trys.push([
|
|
1619
|
-
|
|
1620
|
-
|
|
1724
|
+
15,
|
|
1725
|
+
19,
|
|
1621
1726
|
,
|
|
1622
|
-
|
|
1727
|
+
20
|
|
1623
1728
|
]);
|
|
1624
1729
|
if (!!this.timing.ensureLoadedAdFitsBudget(fallbackPreloaded.adController)) return [
|
|
1625
1730
|
3,
|
|
1626
|
-
|
|
1731
|
+
17
|
|
1627
1732
|
];
|
|
1628
1733
|
this.timing.rejectLoadedAdForDuration(fallbackPreloaded.adController);
|
|
1629
1734
|
this.startContinuousFetching(baseVastUrl);
|
|
@@ -1631,12 +1736,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1631
1736
|
4,
|
|
1632
1737
|
this.tryNextAvailableAdWithRateLimit()
|
|
1633
1738
|
];
|
|
1634
|
-
case
|
|
1739
|
+
case 16:
|
|
1635
1740
|
_state.sent();
|
|
1636
1741
|
return [
|
|
1637
1742
|
2
|
|
1638
1743
|
];
|
|
1639
|
-
case
|
|
1744
|
+
case 17:
|
|
1640
1745
|
this.swapToPreloadedAdPlayer(fallbackPreloaded.adController);
|
|
1641
1746
|
this.timing.consecutiveFailures = 0;
|
|
1642
1747
|
this.startContinuousFetching(baseVastUrl);
|
|
@@ -1649,7 +1754,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1649
1754
|
4,
|
|
1650
1755
|
ap.play()
|
|
1651
1756
|
];
|
|
1652
|
-
case
|
|
1757
|
+
case 18:
|
|
1653
1758
|
_state.sent();
|
|
1654
1759
|
this.timing.markAdStarted();
|
|
1655
1760
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
@@ -1660,16 +1765,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1660
1765
|
return [
|
|
1661
1766
|
2
|
|
1662
1767
|
];
|
|
1663
|
-
case
|
|
1768
|
+
case 19:
|
|
1664
1769
|
fallbackError = _state.sent();
|
|
1665
1770
|
if (this.debug) {
|
|
1666
1771
|
console.warn("[CONTINUOUS-FETCH] Preloaded fallback also failed:", fallbackError);
|
|
1667
1772
|
}
|
|
1668
1773
|
return [
|
|
1669
1774
|
3,
|
|
1670
|
-
|
|
1775
|
+
20
|
|
1671
1776
|
];
|
|
1672
|
-
case
|
|
1777
|
+
case 20:
|
|
1673
1778
|
if (this.timing.isTemporaryAdError(error)) {
|
|
1674
1779
|
this.timing.temporaryFailureUrls.set(firstAdUrl, Date.now());
|
|
1675
1780
|
if (this.debug) {
|
|
@@ -1687,13 +1792,137 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1687
1792
|
4,
|
|
1688
1793
|
this.tryNextAvailableAdWithRateLimit()
|
|
1689
1794
|
];
|
|
1690
|
-
case
|
|
1795
|
+
case 21:
|
|
1691
1796
|
_state.sent();
|
|
1692
1797
|
return [
|
|
1693
1798
|
3,
|
|
1694
|
-
|
|
1799
|
+
22
|
|
1695
1800
|
];
|
|
1696
|
-
case
|
|
1801
|
+
case 22:
|
|
1802
|
+
return [
|
|
1803
|
+
2
|
|
1804
|
+
];
|
|
1805
|
+
}
|
|
1806
|
+
});
|
|
1807
|
+
}).call(this);
|
|
1808
|
+
}
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
key: "startOptimizedPod",
|
|
1812
|
+
value: // ───────────────────────────────────────────────────────────────
|
|
1813
|
+
// Optimized pod (single multi-ad request)
|
|
1814
|
+
// ───────────────────────────────────────────────────────────────
|
|
1815
|
+
function startOptimizedPod(baseVastUrl, breakDurationMs, currentMuted, currentVolume) {
|
|
1816
|
+
return _async_to_generator(function() {
|
|
1817
|
+
var podUrl, adPlayer, requestToken, _ref, _adPlayer_getPodAdCount, podCount, error;
|
|
1818
|
+
return _ts_generator(this, function(_state) {
|
|
1819
|
+
switch(_state.label){
|
|
1820
|
+
case 0:
|
|
1821
|
+
if (this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0) {
|
|
1822
|
+
podUrl = this.pendingAdBreak.vastUrls[0];
|
|
1823
|
+
this.clearPendingAdBreak();
|
|
1824
|
+
} else {
|
|
1825
|
+
podUrl = this.host.generatePodVastUrl(baseVastUrl, breakDurationMs);
|
|
1826
|
+
}
|
|
1827
|
+
if (!podUrl) {
|
|
1828
|
+
return [
|
|
1829
|
+
2,
|
|
1830
|
+
false
|
|
1831
|
+
];
|
|
1832
|
+
}
|
|
1833
|
+
this.continuousFetchingActive = false;
|
|
1834
|
+
this.recreateAdController();
|
|
1835
|
+
adPlayer = this.host.getAdPlayer();
|
|
1836
|
+
requestToken = ++this.timing.adRequestTokenCounter;
|
|
1837
|
+
this.timing.activeAdRequestToken = requestToken;
|
|
1838
|
+
this.timing.startAdRequestWatchdog(requestToken);
|
|
1839
|
+
_state.label = 1;
|
|
1840
|
+
case 1:
|
|
1841
|
+
_state.trys.push([
|
|
1842
|
+
1,
|
|
1843
|
+
5,
|
|
1844
|
+
,
|
|
1845
|
+
6
|
|
1846
|
+
]);
|
|
1847
|
+
return [
|
|
1848
|
+
4,
|
|
1849
|
+
this.timing.enforceGlobalRateLimit()
|
|
1850
|
+
];
|
|
1851
|
+
case 2:
|
|
1852
|
+
_state.sent();
|
|
1853
|
+
this.timing.lastAdRequestTime = Date.now();
|
|
1854
|
+
return [
|
|
1855
|
+
4,
|
|
1856
|
+
adPlayer.requestAds(podUrl)
|
|
1857
|
+
];
|
|
1858
|
+
case 3:
|
|
1859
|
+
_state.sent();
|
|
1860
|
+
this.timing.clearAdRequestWatchdog();
|
|
1861
|
+
if (this.timing.activeAdRequestToken !== requestToken) {
|
|
1862
|
+
return [
|
|
1863
|
+
2,
|
|
1864
|
+
true
|
|
1865
|
+
];
|
|
1866
|
+
}
|
|
1867
|
+
podCount = (_ref = (_adPlayer_getPodAdCount = adPlayer.getPodAdCount) === null || _adPlayer_getPodAdCount === void 0 ? void 0 : _adPlayer_getPodAdCount.call(adPlayer)) !== null && _ref !== void 0 ? _ref : 1;
|
|
1868
|
+
if (podCount < 1) {
|
|
1869
|
+
return [
|
|
1870
|
+
2,
|
|
1871
|
+
false
|
|
1872
|
+
];
|
|
1873
|
+
}
|
|
1874
|
+
if (this.debug) {
|
|
1875
|
+
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"));
|
|
1876
|
+
}
|
|
1877
|
+
sendAdLoadedTracking(this.host.config.licenseKey, {
|
|
1878
|
+
source: "hls",
|
|
1879
|
+
vastUrl: podUrl,
|
|
1880
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
1881
|
+
}, this.analyticsContext).catch(function() {});
|
|
1882
|
+
this.timing.startAdFailsafeTimer(requestToken);
|
|
1883
|
+
return [
|
|
1884
|
+
4,
|
|
1885
|
+
adPlayer.play()
|
|
1886
|
+
];
|
|
1887
|
+
case 4:
|
|
1888
|
+
_state.sent();
|
|
1889
|
+
this.timing.markAdStarted();
|
|
1890
|
+
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
1891
|
+
this.timing.scheduleAdStopAtBreakBoundary();
|
|
1892
|
+
}
|
|
1893
|
+
adPlayer.setAdVolume(currentMuted ? 0 : currentVolume);
|
|
1894
|
+
this.timing.consecutiveFailures = 0;
|
|
1895
|
+
if (podCount === 1) {
|
|
1896
|
+
this.continuousFetchingActive = true;
|
|
1897
|
+
this.startContinuousFetching(baseVastUrl);
|
|
1898
|
+
if (!this.preloadPool.active) {
|
|
1899
|
+
this.preloadPool.startPreloadPool(baseVastUrl, []);
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
return [
|
|
1903
|
+
2,
|
|
1904
|
+
true
|
|
1905
|
+
];
|
|
1906
|
+
case 5:
|
|
1907
|
+
error = _state.sent();
|
|
1908
|
+
this.timing.clearAdRequestWatchdog();
|
|
1909
|
+
this.timing.clearAdFailsafeTimer();
|
|
1910
|
+
if (this.timing.activeAdRequestToken === requestToken) {
|
|
1911
|
+
this.timing.activeAdRequestToken = null;
|
|
1912
|
+
}
|
|
1913
|
+
if (this.debug) {
|
|
1914
|
+
console.warn("[POD] Optimized pod request/play failed:", error);
|
|
1915
|
+
}
|
|
1916
|
+
if (this.timing.isTemporaryAdError(error)) {
|
|
1917
|
+
this.timing.temporaryFailureUrls.set(podUrl, Date.now());
|
|
1918
|
+
}
|
|
1919
|
+
this.continuousFetchingActive = true;
|
|
1920
|
+
this.recreateAdController();
|
|
1921
|
+
return [
|
|
1922
|
+
2,
|
|
1923
|
+
false
|
|
1924
|
+
];
|
|
1925
|
+
case 6:
|
|
1697
1926
|
return [
|
|
1698
1927
|
2
|
|
1699
1928
|
];
|