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
package/lib/index.cjs
CHANGED
|
@@ -9091,6 +9091,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9091
9091
|
this.adPodQueue = [];
|
|
9092
9092
|
this.defaultMinRemainingMsToRequestAd = 1e4;
|
|
9093
9093
|
this.defaultMaxNoFillsPerBreak = 2;
|
|
9094
|
+
this.defaultLiveMaxNoFillsPerBreak = 1;
|
|
9095
|
+
this.breakDurationWaitMs = 300;
|
|
9094
9096
|
this.pendingAdBreak = null;
|
|
9095
9097
|
this.host = host;
|
|
9096
9098
|
this.timing = timing;
|
|
@@ -9207,7 +9209,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9207
9209
|
}
|
|
9208
9210
|
});
|
|
9209
9211
|
adPlayer.on("ad_error", function(errorPayload) {
|
|
9210
|
-
|
|
9212
|
+
if (_this.controllerCallInFlight) {
|
|
9213
|
+
if (_this.debug) {
|
|
9214
|
+
console.log("[AdBreak] ad_error during request/play; outcome reported by the caller", errorPayload || "");
|
|
9215
|
+
}
|
|
9216
|
+
return;
|
|
9217
|
+
}
|
|
9218
|
+
var errorMessage = "Ad error (no details)";
|
|
9211
9219
|
if (errorPayload) {
|
|
9212
9220
|
var errorCode = errorPayload.code || errorPayload.errorCode || "unknown";
|
|
9213
9221
|
var vastErrorCode = errorPayload.vastErrorCode;
|
|
@@ -9223,9 +9231,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9223
9231
|
}
|
|
9224
9232
|
}
|
|
9225
9233
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
9226
|
-
if (_this.controllerCallInFlight) {
|
|
9227
|
-
return;
|
|
9228
|
-
}
|
|
9229
9234
|
_this.handleAdFailure("ad_error");
|
|
9230
9235
|
});
|
|
9231
9236
|
adPlayer.on("content_pause", function() {
|
|
@@ -9376,7 +9381,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9376
9381
|
key: "handleAdStart",
|
|
9377
9382
|
value: function handleAdStart(marker) {
|
|
9378
9383
|
return _async_to_generator(function() {
|
|
9379
|
-
var baseVastUrl, adBreakDurationMs,
|
|
9384
|
+
var baseVastUrl, adBreakDurationMs, currentMuted, currentVolume, epoch, hasPrefetchedUrl, mode, podPlayed;
|
|
9380
9385
|
return _ts_generator(this, function(_state) {
|
|
9381
9386
|
switch(_state.label){
|
|
9382
9387
|
case 0:
|
|
@@ -9398,10 +9403,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9398
9403
|
];
|
|
9399
9404
|
}
|
|
9400
9405
|
adBreakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : this.timing.expectedAdBreakDurationMs;
|
|
9401
|
-
if (this.debug) {
|
|
9402
|
-
mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
|
|
9403
|
-
console.log("[CONTINUOUS-FETCH] ".concat(mode, " MODE: Target duration=").concat(adBreakDurationMs, "ms"));
|
|
9404
|
-
}
|
|
9405
9406
|
this.timing.failedVastUrls.clear();
|
|
9406
9407
|
this.timing.temporaryFailureUrls.clear();
|
|
9407
9408
|
this.timing.consecutiveFailures = 0;
|
|
@@ -9430,11 +9431,31 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9430
9431
|
}
|
|
9431
9432
|
this.noteOpportunity("scte35", this.cueManager.activeScte35BreakKey);
|
|
9432
9433
|
epoch = this.timing.adBreakEpoch;
|
|
9434
|
+
hasPrefetchedUrl = !!(this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0);
|
|
9435
|
+
if (!(adBreakDurationMs == null && !hasPrefetchedUrl)) return [
|
|
9436
|
+
3,
|
|
9437
|
+
2
|
|
9438
|
+
];
|
|
9433
9439
|
return [
|
|
9434
9440
|
4,
|
|
9435
|
-
this.
|
|
9441
|
+
this.waitForBreakDuration(this.breakDurationWaitMs)
|
|
9436
9442
|
];
|
|
9437
9443
|
case 1:
|
|
9444
|
+
adBreakDurationMs = _state.sent();
|
|
9445
|
+
if (!this.inAdBreak || epoch !== this.timing.adBreakEpoch) return [
|
|
9446
|
+
2
|
|
9447
|
+
];
|
|
9448
|
+
_state.label = 2;
|
|
9449
|
+
case 2:
|
|
9450
|
+
if (this.debug) {
|
|
9451
|
+
mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
|
|
9452
|
+
console.log("[AdBreak] ".concat(mode, " break start: target duration=").concat(adBreakDurationMs != null ? "".concat(adBreakDurationMs, "ms") : "unknown"));
|
|
9453
|
+
}
|
|
9454
|
+
return [
|
|
9455
|
+
4,
|
|
9456
|
+
this.startOptimizedPod(baseVastUrl, adBreakDurationMs)
|
|
9457
|
+
];
|
|
9458
|
+
case 3:
|
|
9438
9459
|
podPlayed = _state.sent();
|
|
9439
9460
|
if (!podPlayed && this.inAdBreak && epoch === this.timing.adBreakEpoch) {
|
|
9440
9461
|
this.setSlotState("NEEDS_NEXT_AD", "initial_request_failed");
|
|
@@ -9448,6 +9469,53 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9448
9469
|
}).call(this);
|
|
9449
9470
|
}
|
|
9450
9471
|
},
|
|
9472
|
+
{
|
|
9473
|
+
key: "waitForBreakDuration",
|
|
9474
|
+
value: function waitForBreakDuration(maxWaitMs) {
|
|
9475
|
+
return _async_to_generator(function() {
|
|
9476
|
+
var deadline, durationMs;
|
|
9477
|
+
return _ts_generator(this, function(_state) {
|
|
9478
|
+
switch(_state.label){
|
|
9479
|
+
case 0:
|
|
9480
|
+
deadline = Date.now() + maxWaitMs;
|
|
9481
|
+
_state.label = 1;
|
|
9482
|
+
case 1:
|
|
9483
|
+
if (!(this.timing.expectedAdBreakDurationMs == null && Date.now() < deadline)) return [
|
|
9484
|
+
3,
|
|
9485
|
+
3
|
|
9486
|
+
];
|
|
9487
|
+
return [
|
|
9488
|
+
4,
|
|
9489
|
+
new Promise(function(resolve) {
|
|
9490
|
+
return setTimeout(resolve, 50);
|
|
9491
|
+
})
|
|
9492
|
+
];
|
|
9493
|
+
case 2:
|
|
9494
|
+
_state.sent();
|
|
9495
|
+
if (!this.inAdBreak) return [
|
|
9496
|
+
3,
|
|
9497
|
+
3
|
|
9498
|
+
];
|
|
9499
|
+
return [
|
|
9500
|
+
3,
|
|
9501
|
+
1
|
|
9502
|
+
];
|
|
9503
|
+
case 3:
|
|
9504
|
+
durationMs = this.timing.expectedAdBreakDurationMs;
|
|
9505
|
+
this.logOrchestratorFunnel("break_duration_wait", {
|
|
9506
|
+
waitedForMs: maxWaitMs - Math.max(0, deadline - Date.now()),
|
|
9507
|
+
durationMs: durationMs,
|
|
9508
|
+
resolved: durationMs != null
|
|
9509
|
+
});
|
|
9510
|
+
return [
|
|
9511
|
+
2,
|
|
9512
|
+
durationMs
|
|
9513
|
+
];
|
|
9514
|
+
}
|
|
9515
|
+
});
|
|
9516
|
+
}).call(this);
|
|
9517
|
+
}
|
|
9518
|
+
},
|
|
9451
9519
|
{
|
|
9452
9520
|
key: "startOptimizedPod",
|
|
9453
9521
|
value: // ───────────────────────────────────────────────────────────────
|
|
@@ -9634,7 +9702,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9634
9702
|
key: "getMaxNoFillsPerBreak",
|
|
9635
9703
|
value: function getMaxNoFillsPerBreak() {
|
|
9636
9704
|
var configured = this.host.config.maxNoFillsPerBreak;
|
|
9637
|
-
|
|
9705
|
+
if (typeof configured === "number" && configured > 0) return configured;
|
|
9706
|
+
return this.breakSource === "scte35" ? this.defaultLiveMaxNoFillsPerBreak : this.defaultMaxNoFillsPerBreak;
|
|
9638
9707
|
}
|
|
9639
9708
|
},
|
|
9640
9709
|
{
|
|
@@ -9830,6 +9899,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9830
9899
|
} catch (unused) {}
|
|
9831
9900
|
var adType = (_ref = params === null || params === void 0 ? void 0 : params.get("ad_type")) !== null && _ref !== void 0 ? _ref : void 0;
|
|
9832
9901
|
this.logOrchestratorFunnel("vast_url_generated", {
|
|
9902
|
+
requestId: void 0,
|
|
9833
9903
|
source: source,
|
|
9834
9904
|
pod: (_ref1 = params === null || params === void 0 ? void 0 : params.get("pod")) !== null && _ref1 !== void 0 ? _ref1 : void 0,
|
|
9835
9905
|
pmad: (_ref2 = params === null || params === void 0 ? void 0 : params.get("pmad")) !== null && _ref2 !== void 0 ? _ref2 : void 0,
|
|
@@ -10364,6 +10434,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10364
10434
|
key: "handleAdPodComplete",
|
|
10365
10435
|
value: function handleAdPodComplete() {
|
|
10366
10436
|
var reason = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "unspecified";
|
|
10437
|
+
var _this_breakFunnel_play_called, _this_breakFunnel_impression_fired;
|
|
10367
10438
|
if (this.debug) {
|
|
10368
10439
|
console.log("[StormcloudVideoPlayer] Ad pod complete - cleaning up", {
|
|
10369
10440
|
reason: reason
|
|
@@ -10388,6 +10459,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10388
10459
|
}
|
|
10389
10460
|
this.finalizeRequestDiagnostics(this.currentRequestId, "break_ended:".concat(reason));
|
|
10390
10461
|
this.currentRequestId = void 0;
|
|
10462
|
+
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;
|
|
10391
10463
|
this.timing.resetForBreakEnd();
|
|
10392
10464
|
this.placeholder.hide();
|
|
10393
10465
|
this.clearPendingAdBreak();
|
|
@@ -10426,6 +10498,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10426
10498
|
this.monitorLiveResumeStall(this.host.video.currentTime);
|
|
10427
10499
|
return;
|
|
10428
10500
|
}
|
|
10501
|
+
if (!contentWasInterrupted) {
|
|
10502
|
+
if (this.debug) {
|
|
10503
|
+
console.log("[StormcloudVideoPlayer] Live break end \u2014 no ad was shown, leaving playback position unchanged");
|
|
10504
|
+
}
|
|
10505
|
+
this.resumeContentPlayback();
|
|
10506
|
+
return;
|
|
10507
|
+
}
|
|
10429
10508
|
var liveSyncPos = this.host.getLiveSyncPosition();
|
|
10430
10509
|
if (liveSyncPos != null && liveSyncPos > this.host.video.currentTime) {
|
|
10431
10510
|
if (this.debug) {
|
|
@@ -11674,7 +11753,7 @@ var CRITICAL_PROPS = [
|
|
|
11674
11753
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
11675
11754
|
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
11676
11755
|
var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
11677
|
-
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, isLiveStream = props.isLiveStream, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastMode = props.vastMode, vastTagUrl = props.vastTagUrl, isVmap = props.isVmap, vmapUrl = props.vmapUrl, minSegmentsBeforePlay = props.minSegmentsBeforePlay, ctvAdRequest = props.ctvAdRequest, programTitle = props.programTitle, channelName = props.channelName, restVideoAttrs = _object_without_properties(props, [
|
|
11756
|
+
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, isLiveStream = props.isLiveStream, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastMode = props.vastMode, vastTagUrl = props.vastTagUrl, isVmap = props.isVmap, vmapUrl = props.vmapUrl, minSegmentsBeforePlay = props.minSegmentsBeforePlay, ctvAdRequest = props.ctvAdRequest, programTitle = props.programTitle, channelName = props.channelName, minRemainingMsToStartAd = props.minRemainingMsToStartAd, minRemainingMsToRequestAd = props.minRemainingMsToRequestAd, maxNoFillsPerBreak = props.maxNoFillsPerBreak, restVideoAttrs = _object_without_properties(props, [
|
|
11678
11757
|
"src",
|
|
11679
11758
|
"autoplay",
|
|
11680
11759
|
"muted",
|
|
@@ -11707,7 +11786,10 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
11707
11786
|
"minSegmentsBeforePlay",
|
|
11708
11787
|
"ctvAdRequest",
|
|
11709
11788
|
"programTitle",
|
|
11710
|
-
"channelName"
|
|
11789
|
+
"channelName",
|
|
11790
|
+
"minRemainingMsToStartAd",
|
|
11791
|
+
"minRemainingMsToRequestAd",
|
|
11792
|
+
"maxNoFillsPerBreak"
|
|
11711
11793
|
]);
|
|
11712
11794
|
var videoRef = (0, import_react.useRef)(null);
|
|
11713
11795
|
var playerRef = (0, import_react.useRef)(null);
|
|
@@ -11900,6 +11982,9 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
11900
11982
|
if (ctvAdRequest !== void 0) cfg.ctvAdRequest = ctvAdRequest;
|
|
11901
11983
|
if (programTitle !== void 0) cfg.programTitle = programTitle;
|
|
11902
11984
|
if (channelName !== void 0) cfg.channelName = channelName;
|
|
11985
|
+
if (minRemainingMsToStartAd !== void 0) cfg.minRemainingMsToStartAd = minRemainingMsToStartAd;
|
|
11986
|
+
if (minRemainingMsToRequestAd !== void 0) cfg.minRemainingMsToRequestAd = minRemainingMsToRequestAd;
|
|
11987
|
+
if (maxNoFillsPerBreak !== void 0) cfg.maxNoFillsPerBreak = maxNoFillsPerBreak;
|
|
11903
11988
|
var player = new StormcloudVideoPlayer(cfg);
|
|
11904
11989
|
playerRef.current = player;
|
|
11905
11990
|
player.load().then(function() {
|