stormcloud-video-player 0.8.67 → 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 +90 -11
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +90 -11
- 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 +90 -11
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/players/index.cjs
CHANGED
|
@@ -8971,6 +8971,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8971
8971
|
this.adPodQueue = [];
|
|
8972
8972
|
this.defaultMinRemainingMsToRequestAd = 1e4;
|
|
8973
8973
|
this.defaultMaxNoFillsPerBreak = 2;
|
|
8974
|
+
this.defaultLiveMaxNoFillsPerBreak = 1;
|
|
8975
|
+
this.breakDurationWaitMs = 300;
|
|
8974
8976
|
this.pendingAdBreak = null;
|
|
8975
8977
|
this.host = host;
|
|
8976
8978
|
this.timing = timing;
|
|
@@ -9087,7 +9089,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9087
9089
|
}
|
|
9088
9090
|
});
|
|
9089
9091
|
adPlayer.on("ad_error", function(errorPayload) {
|
|
9090
|
-
|
|
9092
|
+
if (_this.controllerCallInFlight) {
|
|
9093
|
+
if (_this.debug) {
|
|
9094
|
+
console.log("[AdBreak] ad_error during request/play; outcome reported by the caller", errorPayload || "");
|
|
9095
|
+
}
|
|
9096
|
+
return;
|
|
9097
|
+
}
|
|
9098
|
+
var errorMessage = "Ad error (no details)";
|
|
9091
9099
|
if (errorPayload) {
|
|
9092
9100
|
var errorCode = errorPayload.code || errorPayload.errorCode || "unknown";
|
|
9093
9101
|
var vastErrorCode = errorPayload.vastErrorCode;
|
|
@@ -9103,9 +9111,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9103
9111
|
}
|
|
9104
9112
|
}
|
|
9105
9113
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
9106
|
-
if (_this.controllerCallInFlight) {
|
|
9107
|
-
return;
|
|
9108
|
-
}
|
|
9109
9114
|
_this.handleAdFailure("ad_error");
|
|
9110
9115
|
});
|
|
9111
9116
|
adPlayer.on("content_pause", function() {
|
|
@@ -9256,7 +9261,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9256
9261
|
key: "handleAdStart",
|
|
9257
9262
|
value: function handleAdStart(marker) {
|
|
9258
9263
|
return _async_to_generator(function() {
|
|
9259
|
-
var baseVastUrl, adBreakDurationMs,
|
|
9264
|
+
var baseVastUrl, adBreakDurationMs, currentMuted, currentVolume, epoch, hasPrefetchedUrl, mode, podPlayed;
|
|
9260
9265
|
return _ts_generator(this, function(_state) {
|
|
9261
9266
|
switch(_state.label){
|
|
9262
9267
|
case 0:
|
|
@@ -9278,10 +9283,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9278
9283
|
];
|
|
9279
9284
|
}
|
|
9280
9285
|
adBreakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : this.timing.expectedAdBreakDurationMs;
|
|
9281
|
-
if (this.debug) {
|
|
9282
|
-
mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
|
|
9283
|
-
console.log("[CONTINUOUS-FETCH] ".concat(mode, " MODE: Target duration=").concat(adBreakDurationMs, "ms"));
|
|
9284
|
-
}
|
|
9285
9286
|
this.timing.failedVastUrls.clear();
|
|
9286
9287
|
this.timing.temporaryFailureUrls.clear();
|
|
9287
9288
|
this.timing.consecutiveFailures = 0;
|
|
@@ -9310,11 +9311,31 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9310
9311
|
}
|
|
9311
9312
|
this.noteOpportunity("scte35", this.cueManager.activeScte35BreakKey);
|
|
9312
9313
|
epoch = this.timing.adBreakEpoch;
|
|
9314
|
+
hasPrefetchedUrl = !!(this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0);
|
|
9315
|
+
if (!(adBreakDurationMs == null && !hasPrefetchedUrl)) return [
|
|
9316
|
+
3,
|
|
9317
|
+
2
|
|
9318
|
+
];
|
|
9313
9319
|
return [
|
|
9314
9320
|
4,
|
|
9315
|
-
this.
|
|
9321
|
+
this.waitForBreakDuration(this.breakDurationWaitMs)
|
|
9316
9322
|
];
|
|
9317
9323
|
case 1:
|
|
9324
|
+
adBreakDurationMs = _state.sent();
|
|
9325
|
+
if (!this.inAdBreak || epoch !== this.timing.adBreakEpoch) return [
|
|
9326
|
+
2
|
|
9327
|
+
];
|
|
9328
|
+
_state.label = 2;
|
|
9329
|
+
case 2:
|
|
9330
|
+
if (this.debug) {
|
|
9331
|
+
mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
|
|
9332
|
+
console.log("[AdBreak] ".concat(mode, " break start: target duration=").concat(adBreakDurationMs != null ? "".concat(adBreakDurationMs, "ms") : "unknown"));
|
|
9333
|
+
}
|
|
9334
|
+
return [
|
|
9335
|
+
4,
|
|
9336
|
+
this.startOptimizedPod(baseVastUrl, adBreakDurationMs)
|
|
9337
|
+
];
|
|
9338
|
+
case 3:
|
|
9318
9339
|
podPlayed = _state.sent();
|
|
9319
9340
|
if (!podPlayed && this.inAdBreak && epoch === this.timing.adBreakEpoch) {
|
|
9320
9341
|
this.setSlotState("NEEDS_NEXT_AD", "initial_request_failed");
|
|
@@ -9328,6 +9349,53 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9328
9349
|
}).call(this);
|
|
9329
9350
|
}
|
|
9330
9351
|
},
|
|
9352
|
+
{
|
|
9353
|
+
key: "waitForBreakDuration",
|
|
9354
|
+
value: function waitForBreakDuration(maxWaitMs) {
|
|
9355
|
+
return _async_to_generator(function() {
|
|
9356
|
+
var deadline, durationMs;
|
|
9357
|
+
return _ts_generator(this, function(_state) {
|
|
9358
|
+
switch(_state.label){
|
|
9359
|
+
case 0:
|
|
9360
|
+
deadline = Date.now() + maxWaitMs;
|
|
9361
|
+
_state.label = 1;
|
|
9362
|
+
case 1:
|
|
9363
|
+
if (!(this.timing.expectedAdBreakDurationMs == null && Date.now() < deadline)) return [
|
|
9364
|
+
3,
|
|
9365
|
+
3
|
|
9366
|
+
];
|
|
9367
|
+
return [
|
|
9368
|
+
4,
|
|
9369
|
+
new Promise(function(resolve) {
|
|
9370
|
+
return setTimeout(resolve, 50);
|
|
9371
|
+
})
|
|
9372
|
+
];
|
|
9373
|
+
case 2:
|
|
9374
|
+
_state.sent();
|
|
9375
|
+
if (!this.inAdBreak) return [
|
|
9376
|
+
3,
|
|
9377
|
+
3
|
|
9378
|
+
];
|
|
9379
|
+
return [
|
|
9380
|
+
3,
|
|
9381
|
+
1
|
|
9382
|
+
];
|
|
9383
|
+
case 3:
|
|
9384
|
+
durationMs = this.timing.expectedAdBreakDurationMs;
|
|
9385
|
+
this.logOrchestratorFunnel("break_duration_wait", {
|
|
9386
|
+
waitedForMs: maxWaitMs - Math.max(0, deadline - Date.now()),
|
|
9387
|
+
durationMs: durationMs,
|
|
9388
|
+
resolved: durationMs != null
|
|
9389
|
+
});
|
|
9390
|
+
return [
|
|
9391
|
+
2,
|
|
9392
|
+
durationMs
|
|
9393
|
+
];
|
|
9394
|
+
}
|
|
9395
|
+
});
|
|
9396
|
+
}).call(this);
|
|
9397
|
+
}
|
|
9398
|
+
},
|
|
9331
9399
|
{
|
|
9332
9400
|
key: "startOptimizedPod",
|
|
9333
9401
|
value: // ───────────────────────────────────────────────────────────────
|
|
@@ -9514,7 +9582,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9514
9582
|
key: "getMaxNoFillsPerBreak",
|
|
9515
9583
|
value: function getMaxNoFillsPerBreak() {
|
|
9516
9584
|
var configured = this.host.config.maxNoFillsPerBreak;
|
|
9517
|
-
|
|
9585
|
+
if (typeof configured === "number" && configured > 0) return configured;
|
|
9586
|
+
return this.breakSource === "scte35" ? this.defaultLiveMaxNoFillsPerBreak : this.defaultMaxNoFillsPerBreak;
|
|
9518
9587
|
}
|
|
9519
9588
|
},
|
|
9520
9589
|
{
|
|
@@ -9710,6 +9779,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9710
9779
|
} catch (unused) {}
|
|
9711
9780
|
var adType = (_ref = params === null || params === void 0 ? void 0 : params.get("ad_type")) !== null && _ref !== void 0 ? _ref : void 0;
|
|
9712
9781
|
this.logOrchestratorFunnel("vast_url_generated", {
|
|
9782
|
+
requestId: void 0,
|
|
9713
9783
|
source: source,
|
|
9714
9784
|
pod: (_ref1 = params === null || params === void 0 ? void 0 : params.get("pod")) !== null && _ref1 !== void 0 ? _ref1 : void 0,
|
|
9715
9785
|
pmad: (_ref2 = params === null || params === void 0 ? void 0 : params.get("pmad")) !== null && _ref2 !== void 0 ? _ref2 : void 0,
|
|
@@ -10244,6 +10314,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10244
10314
|
key: "handleAdPodComplete",
|
|
10245
10315
|
value: function handleAdPodComplete() {
|
|
10246
10316
|
var reason = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "unspecified";
|
|
10317
|
+
var _this_breakFunnel_play_called, _this_breakFunnel_impression_fired;
|
|
10247
10318
|
if (this.debug) {
|
|
10248
10319
|
console.log("[StormcloudVideoPlayer] Ad pod complete - cleaning up", {
|
|
10249
10320
|
reason: reason
|
|
@@ -10268,6 +10339,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10268
10339
|
}
|
|
10269
10340
|
this.finalizeRequestDiagnostics(this.currentRequestId, "break_ended:".concat(reason));
|
|
10270
10341
|
this.currentRequestId = void 0;
|
|
10342
|
+
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;
|
|
10271
10343
|
this.timing.resetForBreakEnd();
|
|
10272
10344
|
this.placeholder.hide();
|
|
10273
10345
|
this.clearPendingAdBreak();
|
|
@@ -10306,6 +10378,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10306
10378
|
this.monitorLiveResumeStall(this.host.video.currentTime);
|
|
10307
10379
|
return;
|
|
10308
10380
|
}
|
|
10381
|
+
if (!contentWasInterrupted) {
|
|
10382
|
+
if (this.debug) {
|
|
10383
|
+
console.log("[StormcloudVideoPlayer] Live break end \u2014 no ad was shown, leaving playback position unchanged");
|
|
10384
|
+
}
|
|
10385
|
+
this.resumeContentPlayback();
|
|
10386
|
+
return;
|
|
10387
|
+
}
|
|
10309
10388
|
var liveSyncPos = this.host.getLiveSyncPosition();
|
|
10310
10389
|
if (liveSyncPos != null && liveSyncPos > this.host.video.currentTime) {
|
|
10311
10390
|
if (this.debug) {
|