stormcloud-video-player 0.8.66 → 0.8.68
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/Player.d.cts +1 -1
- package/lib/StormcloudPlayer.cjs +90 -11
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/index.cjs +98 -13
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +98 -13
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +90 -11
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +3 -0
- package/lib/player/StormcloudVideoPlayer.cjs +90 -11
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +90 -11
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +90 -11
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +98 -13
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -1335,6 +1335,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1335
1335
|
this.adPodQueue = [];
|
|
1336
1336
|
this.defaultMinRemainingMsToRequestAd = 1e4;
|
|
1337
1337
|
this.defaultMaxNoFillsPerBreak = 2;
|
|
1338
|
+
this.defaultLiveMaxNoFillsPerBreak = 1;
|
|
1339
|
+
this.breakDurationWaitMs = 300;
|
|
1338
1340
|
this.pendingAdBreak = null;
|
|
1339
1341
|
this.host = host;
|
|
1340
1342
|
this.timing = timing;
|
|
@@ -1451,7 +1453,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1451
1453
|
}
|
|
1452
1454
|
});
|
|
1453
1455
|
adPlayer.on("ad_error", function(errorPayload) {
|
|
1454
|
-
|
|
1456
|
+
if (_this.controllerCallInFlight) {
|
|
1457
|
+
if (_this.debug) {
|
|
1458
|
+
console.log("[AdBreak] ad_error during request/play; outcome reported by the caller", errorPayload || "");
|
|
1459
|
+
}
|
|
1460
|
+
return;
|
|
1461
|
+
}
|
|
1462
|
+
var errorMessage = "Ad error (no details)";
|
|
1455
1463
|
if (errorPayload) {
|
|
1456
1464
|
var errorCode = errorPayload.code || errorPayload.errorCode || "unknown";
|
|
1457
1465
|
var vastErrorCode = errorPayload.vastErrorCode;
|
|
@@ -1467,9 +1475,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1467
1475
|
}
|
|
1468
1476
|
}
|
|
1469
1477
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
1470
|
-
if (_this.controllerCallInFlight) {
|
|
1471
|
-
return;
|
|
1472
|
-
}
|
|
1473
1478
|
_this.handleAdFailure("ad_error");
|
|
1474
1479
|
});
|
|
1475
1480
|
adPlayer.on("content_pause", function() {
|
|
@@ -1620,7 +1625,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1620
1625
|
key: "handleAdStart",
|
|
1621
1626
|
value: function handleAdStart(marker) {
|
|
1622
1627
|
return _async_to_generator(function() {
|
|
1623
|
-
var baseVastUrl, adBreakDurationMs,
|
|
1628
|
+
var baseVastUrl, adBreakDurationMs, currentMuted, currentVolume, epoch, hasPrefetchedUrl, mode, podPlayed;
|
|
1624
1629
|
return _ts_generator(this, function(_state) {
|
|
1625
1630
|
switch(_state.label){
|
|
1626
1631
|
case 0:
|
|
@@ -1642,10 +1647,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1642
1647
|
];
|
|
1643
1648
|
}
|
|
1644
1649
|
adBreakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : this.timing.expectedAdBreakDurationMs;
|
|
1645
|
-
if (this.debug) {
|
|
1646
|
-
mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
|
|
1647
|
-
console.log("[CONTINUOUS-FETCH] ".concat(mode, " MODE: Target duration=").concat(adBreakDurationMs, "ms"));
|
|
1648
|
-
}
|
|
1649
1650
|
this.timing.failedVastUrls.clear();
|
|
1650
1651
|
this.timing.temporaryFailureUrls.clear();
|
|
1651
1652
|
this.timing.consecutiveFailures = 0;
|
|
@@ -1674,11 +1675,31 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1674
1675
|
}
|
|
1675
1676
|
this.noteOpportunity("scte35", this.cueManager.activeScte35BreakKey);
|
|
1676
1677
|
epoch = this.timing.adBreakEpoch;
|
|
1678
|
+
hasPrefetchedUrl = !!(this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0);
|
|
1679
|
+
if (!(adBreakDurationMs == null && !hasPrefetchedUrl)) return [
|
|
1680
|
+
3,
|
|
1681
|
+
2
|
|
1682
|
+
];
|
|
1677
1683
|
return [
|
|
1678
1684
|
4,
|
|
1679
|
-
this.
|
|
1685
|
+
this.waitForBreakDuration(this.breakDurationWaitMs)
|
|
1680
1686
|
];
|
|
1681
1687
|
case 1:
|
|
1688
|
+
adBreakDurationMs = _state.sent();
|
|
1689
|
+
if (!this.inAdBreak || epoch !== this.timing.adBreakEpoch) return [
|
|
1690
|
+
2
|
|
1691
|
+
];
|
|
1692
|
+
_state.label = 2;
|
|
1693
|
+
case 2:
|
|
1694
|
+
if (this.debug) {
|
|
1695
|
+
mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
|
|
1696
|
+
console.log("[AdBreak] ".concat(mode, " break start: target duration=").concat(adBreakDurationMs != null ? "".concat(adBreakDurationMs, "ms") : "unknown"));
|
|
1697
|
+
}
|
|
1698
|
+
return [
|
|
1699
|
+
4,
|
|
1700
|
+
this.startOptimizedPod(baseVastUrl, adBreakDurationMs)
|
|
1701
|
+
];
|
|
1702
|
+
case 3:
|
|
1682
1703
|
podPlayed = _state.sent();
|
|
1683
1704
|
if (!podPlayed && this.inAdBreak && epoch === this.timing.adBreakEpoch) {
|
|
1684
1705
|
this.setSlotState("NEEDS_NEXT_AD", "initial_request_failed");
|
|
@@ -1692,6 +1713,53 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1692
1713
|
}).call(this);
|
|
1693
1714
|
}
|
|
1694
1715
|
},
|
|
1716
|
+
{
|
|
1717
|
+
key: "waitForBreakDuration",
|
|
1718
|
+
value: function waitForBreakDuration(maxWaitMs) {
|
|
1719
|
+
return _async_to_generator(function() {
|
|
1720
|
+
var deadline, durationMs;
|
|
1721
|
+
return _ts_generator(this, function(_state) {
|
|
1722
|
+
switch(_state.label){
|
|
1723
|
+
case 0:
|
|
1724
|
+
deadline = Date.now() + maxWaitMs;
|
|
1725
|
+
_state.label = 1;
|
|
1726
|
+
case 1:
|
|
1727
|
+
if (!(this.timing.expectedAdBreakDurationMs == null && Date.now() < deadline)) return [
|
|
1728
|
+
3,
|
|
1729
|
+
3
|
|
1730
|
+
];
|
|
1731
|
+
return [
|
|
1732
|
+
4,
|
|
1733
|
+
new Promise(function(resolve) {
|
|
1734
|
+
return setTimeout(resolve, 50);
|
|
1735
|
+
})
|
|
1736
|
+
];
|
|
1737
|
+
case 2:
|
|
1738
|
+
_state.sent();
|
|
1739
|
+
if (!this.inAdBreak) return [
|
|
1740
|
+
3,
|
|
1741
|
+
3
|
|
1742
|
+
];
|
|
1743
|
+
return [
|
|
1744
|
+
3,
|
|
1745
|
+
1
|
|
1746
|
+
];
|
|
1747
|
+
case 3:
|
|
1748
|
+
durationMs = this.timing.expectedAdBreakDurationMs;
|
|
1749
|
+
this.logOrchestratorFunnel("break_duration_wait", {
|
|
1750
|
+
waitedForMs: maxWaitMs - Math.max(0, deadline - Date.now()),
|
|
1751
|
+
durationMs: durationMs,
|
|
1752
|
+
resolved: durationMs != null
|
|
1753
|
+
});
|
|
1754
|
+
return [
|
|
1755
|
+
2,
|
|
1756
|
+
durationMs
|
|
1757
|
+
];
|
|
1758
|
+
}
|
|
1759
|
+
});
|
|
1760
|
+
}).call(this);
|
|
1761
|
+
}
|
|
1762
|
+
},
|
|
1695
1763
|
{
|
|
1696
1764
|
key: "startOptimizedPod",
|
|
1697
1765
|
value: // ───────────────────────────────────────────────────────────────
|
|
@@ -1878,7 +1946,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1878
1946
|
key: "getMaxNoFillsPerBreak",
|
|
1879
1947
|
value: function getMaxNoFillsPerBreak() {
|
|
1880
1948
|
var configured = this.host.config.maxNoFillsPerBreak;
|
|
1881
|
-
|
|
1949
|
+
if (typeof configured === "number" && configured > 0) return configured;
|
|
1950
|
+
return this.breakSource === "scte35" ? this.defaultLiveMaxNoFillsPerBreak : this.defaultMaxNoFillsPerBreak;
|
|
1882
1951
|
}
|
|
1883
1952
|
},
|
|
1884
1953
|
{
|
|
@@ -2074,6 +2143,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2074
2143
|
} catch (unused) {}
|
|
2075
2144
|
var adType = (_ref = params === null || params === void 0 ? void 0 : params.get("ad_type")) !== null && _ref !== void 0 ? _ref : void 0;
|
|
2076
2145
|
this.logOrchestratorFunnel("vast_url_generated", {
|
|
2146
|
+
requestId: void 0,
|
|
2077
2147
|
source: source,
|
|
2078
2148
|
pod: (_ref1 = params === null || params === void 0 ? void 0 : params.get("pod")) !== null && _ref1 !== void 0 ? _ref1 : void 0,
|
|
2079
2149
|
pmad: (_ref2 = params === null || params === void 0 ? void 0 : params.get("pmad")) !== null && _ref2 !== void 0 ? _ref2 : void 0,
|
|
@@ -2608,6 +2678,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2608
2678
|
key: "handleAdPodComplete",
|
|
2609
2679
|
value: function handleAdPodComplete() {
|
|
2610
2680
|
var reason = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "unspecified";
|
|
2681
|
+
var _this_breakFunnel_play_called, _this_breakFunnel_impression_fired;
|
|
2611
2682
|
if (this.debug) {
|
|
2612
2683
|
console.log("[StormcloudVideoPlayer] Ad pod complete - cleaning up", {
|
|
2613
2684
|
reason: reason
|
|
@@ -2632,6 +2703,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2632
2703
|
}
|
|
2633
2704
|
this.finalizeRequestDiagnostics(this.currentRequestId, "break_ended:".concat(reason));
|
|
2634
2705
|
this.currentRequestId = void 0;
|
|
2706
|
+
var contentWasInterrupted = this.showAds || this.isShowingPlaceholder || ((_this_breakFunnel_play_called = this.breakFunnel["play_called"]) !== null && _this_breakFunnel_play_called !== void 0 ? _this_breakFunnel_play_called : 0) > 0 || ((_this_breakFunnel_impression_fired = this.breakFunnel["impression_fired"]) !== null && _this_breakFunnel_impression_fired !== void 0 ? _this_breakFunnel_impression_fired : 0) > 0;
|
|
2635
2707
|
this.timing.resetForBreakEnd();
|
|
2636
2708
|
this.placeholder.hide();
|
|
2637
2709
|
this.clearPendingAdBreak();
|
|
@@ -2670,6 +2742,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
2670
2742
|
this.monitorLiveResumeStall(this.host.video.currentTime);
|
|
2671
2743
|
return;
|
|
2672
2744
|
}
|
|
2745
|
+
if (!contentWasInterrupted) {
|
|
2746
|
+
if (this.debug) {
|
|
2747
|
+
console.log("[StormcloudVideoPlayer] Live break end \u2014 no ad was shown, leaving playback position unchanged");
|
|
2748
|
+
}
|
|
2749
|
+
this.resumeContentPlayback();
|
|
2750
|
+
return;
|
|
2751
|
+
}
|
|
2673
2752
|
var liveSyncPos = this.host.getLiveSyncPosition();
|
|
2674
2753
|
if (liveSyncPos != null && liveSyncPos > this.host.video.currentTime) {
|
|
2675
2754
|
if (this.debug) {
|