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/index.js
CHANGED
|
@@ -8907,6 +8907,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8907
8907
|
this.adPodQueue = [];
|
|
8908
8908
|
this.defaultMinRemainingMsToRequestAd = 1e4;
|
|
8909
8909
|
this.defaultMaxNoFillsPerBreak = 2;
|
|
8910
|
+
this.defaultLiveMaxNoFillsPerBreak = 1;
|
|
8911
|
+
this.breakDurationWaitMs = 300;
|
|
8910
8912
|
this.pendingAdBreak = null;
|
|
8911
8913
|
this.host = host;
|
|
8912
8914
|
this.timing = timing;
|
|
@@ -9023,7 +9025,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9023
9025
|
}
|
|
9024
9026
|
});
|
|
9025
9027
|
adPlayer.on("ad_error", function(errorPayload) {
|
|
9026
|
-
|
|
9028
|
+
if (_this.controllerCallInFlight) {
|
|
9029
|
+
if (_this.debug) {
|
|
9030
|
+
console.log("[AdBreak] ad_error during request/play; outcome reported by the caller", errorPayload || "");
|
|
9031
|
+
}
|
|
9032
|
+
return;
|
|
9033
|
+
}
|
|
9034
|
+
var errorMessage = "Ad error (no details)";
|
|
9027
9035
|
if (errorPayload) {
|
|
9028
9036
|
var errorCode = errorPayload.code || errorPayload.errorCode || "unknown";
|
|
9029
9037
|
var vastErrorCode = errorPayload.vastErrorCode;
|
|
@@ -9039,9 +9047,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9039
9047
|
}
|
|
9040
9048
|
}
|
|
9041
9049
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
9042
|
-
if (_this.controllerCallInFlight) {
|
|
9043
|
-
return;
|
|
9044
|
-
}
|
|
9045
9050
|
_this.handleAdFailure("ad_error");
|
|
9046
9051
|
});
|
|
9047
9052
|
adPlayer.on("content_pause", function() {
|
|
@@ -9192,7 +9197,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9192
9197
|
key: "handleAdStart",
|
|
9193
9198
|
value: function handleAdStart(marker) {
|
|
9194
9199
|
return _async_to_generator(function() {
|
|
9195
|
-
var baseVastUrl, adBreakDurationMs,
|
|
9200
|
+
var baseVastUrl, adBreakDurationMs, currentMuted, currentVolume, epoch, hasPrefetchedUrl, mode, podPlayed;
|
|
9196
9201
|
return _ts_generator(this, function(_state) {
|
|
9197
9202
|
switch(_state.label){
|
|
9198
9203
|
case 0:
|
|
@@ -9214,10 +9219,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9214
9219
|
];
|
|
9215
9220
|
}
|
|
9216
9221
|
adBreakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : this.timing.expectedAdBreakDurationMs;
|
|
9217
|
-
if (this.debug) {
|
|
9218
|
-
mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
|
|
9219
|
-
console.log("[CONTINUOUS-FETCH] ".concat(mode, " MODE: Target duration=").concat(adBreakDurationMs, "ms"));
|
|
9220
|
-
}
|
|
9221
9222
|
this.timing.failedVastUrls.clear();
|
|
9222
9223
|
this.timing.temporaryFailureUrls.clear();
|
|
9223
9224
|
this.timing.consecutiveFailures = 0;
|
|
@@ -9246,11 +9247,31 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9246
9247
|
}
|
|
9247
9248
|
this.noteOpportunity("scte35", this.cueManager.activeScte35BreakKey);
|
|
9248
9249
|
epoch = this.timing.adBreakEpoch;
|
|
9250
|
+
hasPrefetchedUrl = !!(this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0);
|
|
9251
|
+
if (!(adBreakDurationMs == null && !hasPrefetchedUrl)) return [
|
|
9252
|
+
3,
|
|
9253
|
+
2
|
|
9254
|
+
];
|
|
9249
9255
|
return [
|
|
9250
9256
|
4,
|
|
9251
|
-
this.
|
|
9257
|
+
this.waitForBreakDuration(this.breakDurationWaitMs)
|
|
9252
9258
|
];
|
|
9253
9259
|
case 1:
|
|
9260
|
+
adBreakDurationMs = _state.sent();
|
|
9261
|
+
if (!this.inAdBreak || epoch !== this.timing.adBreakEpoch) return [
|
|
9262
|
+
2
|
|
9263
|
+
];
|
|
9264
|
+
_state.label = 2;
|
|
9265
|
+
case 2:
|
|
9266
|
+
if (this.debug) {
|
|
9267
|
+
mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
|
|
9268
|
+
console.log("[AdBreak] ".concat(mode, " break start: target duration=").concat(adBreakDurationMs != null ? "".concat(adBreakDurationMs, "ms") : "unknown"));
|
|
9269
|
+
}
|
|
9270
|
+
return [
|
|
9271
|
+
4,
|
|
9272
|
+
this.startOptimizedPod(baseVastUrl, adBreakDurationMs)
|
|
9273
|
+
];
|
|
9274
|
+
case 3:
|
|
9254
9275
|
podPlayed = _state.sent();
|
|
9255
9276
|
if (!podPlayed && this.inAdBreak && epoch === this.timing.adBreakEpoch) {
|
|
9256
9277
|
this.setSlotState("NEEDS_NEXT_AD", "initial_request_failed");
|
|
@@ -9264,6 +9285,53 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9264
9285
|
}).call(this);
|
|
9265
9286
|
}
|
|
9266
9287
|
},
|
|
9288
|
+
{
|
|
9289
|
+
key: "waitForBreakDuration",
|
|
9290
|
+
value: function waitForBreakDuration(maxWaitMs) {
|
|
9291
|
+
return _async_to_generator(function() {
|
|
9292
|
+
var deadline, durationMs;
|
|
9293
|
+
return _ts_generator(this, function(_state) {
|
|
9294
|
+
switch(_state.label){
|
|
9295
|
+
case 0:
|
|
9296
|
+
deadline = Date.now() + maxWaitMs;
|
|
9297
|
+
_state.label = 1;
|
|
9298
|
+
case 1:
|
|
9299
|
+
if (!(this.timing.expectedAdBreakDurationMs == null && Date.now() < deadline)) return [
|
|
9300
|
+
3,
|
|
9301
|
+
3
|
|
9302
|
+
];
|
|
9303
|
+
return [
|
|
9304
|
+
4,
|
|
9305
|
+
new Promise(function(resolve) {
|
|
9306
|
+
return setTimeout(resolve, 50);
|
|
9307
|
+
})
|
|
9308
|
+
];
|
|
9309
|
+
case 2:
|
|
9310
|
+
_state.sent();
|
|
9311
|
+
if (!this.inAdBreak) return [
|
|
9312
|
+
3,
|
|
9313
|
+
3
|
|
9314
|
+
];
|
|
9315
|
+
return [
|
|
9316
|
+
3,
|
|
9317
|
+
1
|
|
9318
|
+
];
|
|
9319
|
+
case 3:
|
|
9320
|
+
durationMs = this.timing.expectedAdBreakDurationMs;
|
|
9321
|
+
this.logOrchestratorFunnel("break_duration_wait", {
|
|
9322
|
+
waitedForMs: maxWaitMs - Math.max(0, deadline - Date.now()),
|
|
9323
|
+
durationMs: durationMs,
|
|
9324
|
+
resolved: durationMs != null
|
|
9325
|
+
});
|
|
9326
|
+
return [
|
|
9327
|
+
2,
|
|
9328
|
+
durationMs
|
|
9329
|
+
];
|
|
9330
|
+
}
|
|
9331
|
+
});
|
|
9332
|
+
}).call(this);
|
|
9333
|
+
}
|
|
9334
|
+
},
|
|
9267
9335
|
{
|
|
9268
9336
|
key: "startOptimizedPod",
|
|
9269
9337
|
value: // ───────────────────────────────────────────────────────────────
|
|
@@ -9450,7 +9518,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9450
9518
|
key: "getMaxNoFillsPerBreak",
|
|
9451
9519
|
value: function getMaxNoFillsPerBreak() {
|
|
9452
9520
|
var configured = this.host.config.maxNoFillsPerBreak;
|
|
9453
|
-
|
|
9521
|
+
if (typeof configured === "number" && configured > 0) return configured;
|
|
9522
|
+
return this.breakSource === "scte35" ? this.defaultLiveMaxNoFillsPerBreak : this.defaultMaxNoFillsPerBreak;
|
|
9454
9523
|
}
|
|
9455
9524
|
},
|
|
9456
9525
|
{
|
|
@@ -9646,6 +9715,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9646
9715
|
} catch (unused) {}
|
|
9647
9716
|
var adType = (_ref = params === null || params === void 0 ? void 0 : params.get("ad_type")) !== null && _ref !== void 0 ? _ref : void 0;
|
|
9648
9717
|
this.logOrchestratorFunnel("vast_url_generated", {
|
|
9718
|
+
requestId: void 0,
|
|
9649
9719
|
source: source,
|
|
9650
9720
|
pod: (_ref1 = params === null || params === void 0 ? void 0 : params.get("pod")) !== null && _ref1 !== void 0 ? _ref1 : void 0,
|
|
9651
9721
|
pmad: (_ref2 = params === null || params === void 0 ? void 0 : params.get("pmad")) !== null && _ref2 !== void 0 ? _ref2 : void 0,
|
|
@@ -10180,6 +10250,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10180
10250
|
key: "handleAdPodComplete",
|
|
10181
10251
|
value: function handleAdPodComplete() {
|
|
10182
10252
|
var reason = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "unspecified";
|
|
10253
|
+
var _this_breakFunnel_play_called, _this_breakFunnel_impression_fired;
|
|
10183
10254
|
if (this.debug) {
|
|
10184
10255
|
console.log("[StormcloudVideoPlayer] Ad pod complete - cleaning up", {
|
|
10185
10256
|
reason: reason
|
|
@@ -10204,6 +10275,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10204
10275
|
}
|
|
10205
10276
|
this.finalizeRequestDiagnostics(this.currentRequestId, "break_ended:".concat(reason));
|
|
10206
10277
|
this.currentRequestId = void 0;
|
|
10278
|
+
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;
|
|
10207
10279
|
this.timing.resetForBreakEnd();
|
|
10208
10280
|
this.placeholder.hide();
|
|
10209
10281
|
this.clearPendingAdBreak();
|
|
@@ -10242,6 +10314,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10242
10314
|
this.monitorLiveResumeStall(this.host.video.currentTime);
|
|
10243
10315
|
return;
|
|
10244
10316
|
}
|
|
10317
|
+
if (!contentWasInterrupted) {
|
|
10318
|
+
if (this.debug) {
|
|
10319
|
+
console.log("[StormcloudVideoPlayer] Live break end \u2014 no ad was shown, leaving playback position unchanged");
|
|
10320
|
+
}
|
|
10321
|
+
this.resumeContentPlayback();
|
|
10322
|
+
return;
|
|
10323
|
+
}
|
|
10245
10324
|
var liveSyncPos = this.host.getLiveSyncPosition();
|
|
10246
10325
|
if (liveSyncPos != null && liveSyncPos > this.host.video.currentTime) {
|
|
10247
10326
|
if (this.debug) {
|