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
|
@@ -48,6 +48,8 @@ declare class AdBreakOrchestrator {
|
|
|
48
48
|
adPodQueue: string[];
|
|
49
49
|
private readonly defaultMinRemainingMsToRequestAd;
|
|
50
50
|
private readonly defaultMaxNoFillsPerBreak;
|
|
51
|
+
private readonly defaultLiveMaxNoFillsPerBreak;
|
|
52
|
+
private readonly breakDurationWaitMs;
|
|
51
53
|
pendingAdBreak: {
|
|
52
54
|
marker: Scte35Marker;
|
|
53
55
|
detectedAtFragmentSn?: number;
|
|
@@ -72,6 +74,7 @@ declare class AdBreakOrchestrator {
|
|
|
72
74
|
getSlotState(): AdSlotState;
|
|
73
75
|
beginVmapBreak(breakKey: string): void;
|
|
74
76
|
handleAdStart(marker: Scte35Marker): Promise<void>;
|
|
77
|
+
private waitForBreakDuration;
|
|
75
78
|
private startOptimizedPod;
|
|
76
79
|
private setSlotState;
|
|
77
80
|
private isStale;
|
|
@@ -8888,6 +8888,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8888
8888
|
this.adPodQueue = [];
|
|
8889
8889
|
this.defaultMinRemainingMsToRequestAd = 1e4;
|
|
8890
8890
|
this.defaultMaxNoFillsPerBreak = 2;
|
|
8891
|
+
this.defaultLiveMaxNoFillsPerBreak = 1;
|
|
8892
|
+
this.breakDurationWaitMs = 300;
|
|
8891
8893
|
this.pendingAdBreak = null;
|
|
8892
8894
|
this.host = host;
|
|
8893
8895
|
this.timing = timing;
|
|
@@ -9004,7 +9006,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9004
9006
|
}
|
|
9005
9007
|
});
|
|
9006
9008
|
adPlayer.on("ad_error", function(errorPayload) {
|
|
9007
|
-
|
|
9009
|
+
if (_this.controllerCallInFlight) {
|
|
9010
|
+
if (_this.debug) {
|
|
9011
|
+
console.log("[AdBreak] ad_error during request/play; outcome reported by the caller", errorPayload || "");
|
|
9012
|
+
}
|
|
9013
|
+
return;
|
|
9014
|
+
}
|
|
9015
|
+
var errorMessage = "Ad error (no details)";
|
|
9008
9016
|
if (errorPayload) {
|
|
9009
9017
|
var errorCode = errorPayload.code || errorPayload.errorCode || "unknown";
|
|
9010
9018
|
var vastErrorCode = errorPayload.vastErrorCode;
|
|
@@ -9020,9 +9028,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9020
9028
|
}
|
|
9021
9029
|
}
|
|
9022
9030
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
9023
|
-
if (_this.controllerCallInFlight) {
|
|
9024
|
-
return;
|
|
9025
|
-
}
|
|
9026
9031
|
_this.handleAdFailure("ad_error");
|
|
9027
9032
|
});
|
|
9028
9033
|
adPlayer.on("content_pause", function() {
|
|
@@ -9173,7 +9178,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9173
9178
|
key: "handleAdStart",
|
|
9174
9179
|
value: function handleAdStart(marker) {
|
|
9175
9180
|
return _async_to_generator(function() {
|
|
9176
|
-
var baseVastUrl, adBreakDurationMs,
|
|
9181
|
+
var baseVastUrl, adBreakDurationMs, currentMuted, currentVolume, epoch, hasPrefetchedUrl, mode, podPlayed;
|
|
9177
9182
|
return _ts_generator(this, function(_state) {
|
|
9178
9183
|
switch(_state.label){
|
|
9179
9184
|
case 0:
|
|
@@ -9195,10 +9200,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9195
9200
|
];
|
|
9196
9201
|
}
|
|
9197
9202
|
adBreakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : this.timing.expectedAdBreakDurationMs;
|
|
9198
|
-
if (this.debug) {
|
|
9199
|
-
mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
|
|
9200
|
-
console.log("[CONTINUOUS-FETCH] ".concat(mode, " MODE: Target duration=").concat(adBreakDurationMs, "ms"));
|
|
9201
|
-
}
|
|
9202
9203
|
this.timing.failedVastUrls.clear();
|
|
9203
9204
|
this.timing.temporaryFailureUrls.clear();
|
|
9204
9205
|
this.timing.consecutiveFailures = 0;
|
|
@@ -9227,11 +9228,31 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9227
9228
|
}
|
|
9228
9229
|
this.noteOpportunity("scte35", this.cueManager.activeScte35BreakKey);
|
|
9229
9230
|
epoch = this.timing.adBreakEpoch;
|
|
9231
|
+
hasPrefetchedUrl = !!(this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0);
|
|
9232
|
+
if (!(adBreakDurationMs == null && !hasPrefetchedUrl)) return [
|
|
9233
|
+
3,
|
|
9234
|
+
2
|
|
9235
|
+
];
|
|
9230
9236
|
return [
|
|
9231
9237
|
4,
|
|
9232
|
-
this.
|
|
9238
|
+
this.waitForBreakDuration(this.breakDurationWaitMs)
|
|
9233
9239
|
];
|
|
9234
9240
|
case 1:
|
|
9241
|
+
adBreakDurationMs = _state.sent();
|
|
9242
|
+
if (!this.inAdBreak || epoch !== this.timing.adBreakEpoch) return [
|
|
9243
|
+
2
|
|
9244
|
+
];
|
|
9245
|
+
_state.label = 2;
|
|
9246
|
+
case 2:
|
|
9247
|
+
if (this.debug) {
|
|
9248
|
+
mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
|
|
9249
|
+
console.log("[AdBreak] ".concat(mode, " break start: target duration=").concat(adBreakDurationMs != null ? "".concat(adBreakDurationMs, "ms") : "unknown"));
|
|
9250
|
+
}
|
|
9251
|
+
return [
|
|
9252
|
+
4,
|
|
9253
|
+
this.startOptimizedPod(baseVastUrl, adBreakDurationMs)
|
|
9254
|
+
];
|
|
9255
|
+
case 3:
|
|
9235
9256
|
podPlayed = _state.sent();
|
|
9236
9257
|
if (!podPlayed && this.inAdBreak && epoch === this.timing.adBreakEpoch) {
|
|
9237
9258
|
this.setSlotState("NEEDS_NEXT_AD", "initial_request_failed");
|
|
@@ -9245,6 +9266,53 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9245
9266
|
}).call(this);
|
|
9246
9267
|
}
|
|
9247
9268
|
},
|
|
9269
|
+
{
|
|
9270
|
+
key: "waitForBreakDuration",
|
|
9271
|
+
value: function waitForBreakDuration(maxWaitMs) {
|
|
9272
|
+
return _async_to_generator(function() {
|
|
9273
|
+
var deadline, durationMs;
|
|
9274
|
+
return _ts_generator(this, function(_state) {
|
|
9275
|
+
switch(_state.label){
|
|
9276
|
+
case 0:
|
|
9277
|
+
deadline = Date.now() + maxWaitMs;
|
|
9278
|
+
_state.label = 1;
|
|
9279
|
+
case 1:
|
|
9280
|
+
if (!(this.timing.expectedAdBreakDurationMs == null && Date.now() < deadline)) return [
|
|
9281
|
+
3,
|
|
9282
|
+
3
|
|
9283
|
+
];
|
|
9284
|
+
return [
|
|
9285
|
+
4,
|
|
9286
|
+
new Promise(function(resolve) {
|
|
9287
|
+
return setTimeout(resolve, 50);
|
|
9288
|
+
})
|
|
9289
|
+
];
|
|
9290
|
+
case 2:
|
|
9291
|
+
_state.sent();
|
|
9292
|
+
if (!this.inAdBreak) return [
|
|
9293
|
+
3,
|
|
9294
|
+
3
|
|
9295
|
+
];
|
|
9296
|
+
return [
|
|
9297
|
+
3,
|
|
9298
|
+
1
|
|
9299
|
+
];
|
|
9300
|
+
case 3:
|
|
9301
|
+
durationMs = this.timing.expectedAdBreakDurationMs;
|
|
9302
|
+
this.logOrchestratorFunnel("break_duration_wait", {
|
|
9303
|
+
waitedForMs: maxWaitMs - Math.max(0, deadline - Date.now()),
|
|
9304
|
+
durationMs: durationMs,
|
|
9305
|
+
resolved: durationMs != null
|
|
9306
|
+
});
|
|
9307
|
+
return [
|
|
9308
|
+
2,
|
|
9309
|
+
durationMs
|
|
9310
|
+
];
|
|
9311
|
+
}
|
|
9312
|
+
});
|
|
9313
|
+
}).call(this);
|
|
9314
|
+
}
|
|
9315
|
+
},
|
|
9248
9316
|
{
|
|
9249
9317
|
key: "startOptimizedPod",
|
|
9250
9318
|
value: // ───────────────────────────────────────────────────────────────
|
|
@@ -9431,7 +9499,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9431
9499
|
key: "getMaxNoFillsPerBreak",
|
|
9432
9500
|
value: function getMaxNoFillsPerBreak() {
|
|
9433
9501
|
var configured = this.host.config.maxNoFillsPerBreak;
|
|
9434
|
-
|
|
9502
|
+
if (typeof configured === "number" && configured > 0) return configured;
|
|
9503
|
+
return this.breakSource === "scte35" ? this.defaultLiveMaxNoFillsPerBreak : this.defaultMaxNoFillsPerBreak;
|
|
9435
9504
|
}
|
|
9436
9505
|
},
|
|
9437
9506
|
{
|
|
@@ -9627,6 +9696,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9627
9696
|
} catch (unused) {}
|
|
9628
9697
|
var adType = (_ref = params === null || params === void 0 ? void 0 : params.get("ad_type")) !== null && _ref !== void 0 ? _ref : void 0;
|
|
9629
9698
|
this.logOrchestratorFunnel("vast_url_generated", {
|
|
9699
|
+
requestId: void 0,
|
|
9630
9700
|
source: source,
|
|
9631
9701
|
pod: (_ref1 = params === null || params === void 0 ? void 0 : params.get("pod")) !== null && _ref1 !== void 0 ? _ref1 : void 0,
|
|
9632
9702
|
pmad: (_ref2 = params === null || params === void 0 ? void 0 : params.get("pmad")) !== null && _ref2 !== void 0 ? _ref2 : void 0,
|
|
@@ -10161,6 +10231,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10161
10231
|
key: "handleAdPodComplete",
|
|
10162
10232
|
value: function handleAdPodComplete() {
|
|
10163
10233
|
var reason = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "unspecified";
|
|
10234
|
+
var _this_breakFunnel_play_called, _this_breakFunnel_impression_fired;
|
|
10164
10235
|
if (this.debug) {
|
|
10165
10236
|
console.log("[StormcloudVideoPlayer] Ad pod complete - cleaning up", {
|
|
10166
10237
|
reason: reason
|
|
@@ -10185,6 +10256,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10185
10256
|
}
|
|
10186
10257
|
this.finalizeRequestDiagnostics(this.currentRequestId, "break_ended:".concat(reason));
|
|
10187
10258
|
this.currentRequestId = void 0;
|
|
10259
|
+
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;
|
|
10188
10260
|
this.timing.resetForBreakEnd();
|
|
10189
10261
|
this.placeholder.hide();
|
|
10190
10262
|
this.clearPendingAdBreak();
|
|
@@ -10223,6 +10295,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10223
10295
|
this.monitorLiveResumeStall(this.host.video.currentTime);
|
|
10224
10296
|
return;
|
|
10225
10297
|
}
|
|
10298
|
+
if (!contentWasInterrupted) {
|
|
10299
|
+
if (this.debug) {
|
|
10300
|
+
console.log("[StormcloudVideoPlayer] Live break end \u2014 no ad was shown, leaving playback position unchanged");
|
|
10301
|
+
}
|
|
10302
|
+
this.resumeContentPlayback();
|
|
10303
|
+
return;
|
|
10304
|
+
}
|
|
10226
10305
|
var liveSyncPos = this.host.getLiveSyncPosition();
|
|
10227
10306
|
if (liveSyncPos != null && liveSyncPos > this.host.video.currentTime) {
|
|
10228
10307
|
if (this.debug) {
|