stormcloud-video-player 0.8.42 → 0.8.43
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/index.cjs +65 -17
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +65 -17
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +25 -17
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +1 -0
- package/lib/player/HlsEngine.cjs +29 -0
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +2 -0
- package/lib/player/StormcloudVideoPlayer.cjs +65 -17
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +65 -17
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +65 -17
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +65 -17
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -6483,6 +6483,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6483
6483
|
this.isLiveStream = false;
|
|
6484
6484
|
this.nativeHlsMode = false;
|
|
6485
6485
|
this.videoSrcProtection = null;
|
|
6486
|
+
this.reloadingLiveStream = false;
|
|
6486
6487
|
this.bufferedSegmentsCount = 0;
|
|
6487
6488
|
this.shouldAutoplayAfterBuffering = false;
|
|
6488
6489
|
this.hasInitialBufferCompleted = false;
|
|
@@ -6616,6 +6617,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6616
6617
|
_state.sent();
|
|
6617
6618
|
_state.label = 3;
|
|
6618
6619
|
case 3:
|
|
6620
|
+
this.reloadingLiveStream = false;
|
|
6619
6621
|
return [
|
|
6620
6622
|
2
|
|
6621
6623
|
];
|
|
@@ -6960,6 +6962,33 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6960
6962
|
}
|
|
6961
6963
|
}
|
|
6962
6964
|
},
|
|
6965
|
+
{
|
|
6966
|
+
key: "reloadLiveStream",
|
|
6967
|
+
value: function reloadLiveStream() {
|
|
6968
|
+
var hls = this.hls;
|
|
6969
|
+
if (!hls) {
|
|
6970
|
+
return;
|
|
6971
|
+
}
|
|
6972
|
+
if (this.debug) {
|
|
6973
|
+
console.log("[StormcloudVideoPlayer] Hard-reloading live stream (detach \u2192 reset video \u2192 re-attach)");
|
|
6974
|
+
}
|
|
6975
|
+
try {
|
|
6976
|
+
this.reloadingLiveStream = true;
|
|
6977
|
+
hls.stopLoad();
|
|
6978
|
+
hls.detachMedia();
|
|
6979
|
+
try {
|
|
6980
|
+
this.video.removeAttribute("src");
|
|
6981
|
+
this.video.load();
|
|
6982
|
+
} catch (unused) {}
|
|
6983
|
+
hls.attachMedia(this.video);
|
|
6984
|
+
} catch (error) {
|
|
6985
|
+
this.reloadingLiveStream = false;
|
|
6986
|
+
if (this.debug) {
|
|
6987
|
+
console.warn("[StormcloudVideoPlayer] Failed to hard-reload live stream:", error);
|
|
6988
|
+
}
|
|
6989
|
+
}
|
|
6990
|
+
}
|
|
6991
|
+
},
|
|
6963
6992
|
{
|
|
6964
6993
|
key: "destroy",
|
|
6965
6994
|
value: function destroy() {
|
|
@@ -8305,13 +8334,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8305
8334
|
var _this = this;
|
|
8306
8335
|
var pollIntervalMs = 1e3;
|
|
8307
8336
|
var graceMs = 5e3;
|
|
8308
|
-
var
|
|
8309
|
-
var
|
|
8310
|
-
var maxMonitorMs =
|
|
8337
|
+
var recoveryCooldownMs = 5e3;
|
|
8338
|
+
var maxRecoveries = 2;
|
|
8339
|
+
var maxMonitorMs = 3e4;
|
|
8311
8340
|
var startTime = Date.now();
|
|
8312
8341
|
var baseline = resumeBaseline;
|
|
8313
|
-
var
|
|
8314
|
-
var
|
|
8342
|
+
var recoveries = 0;
|
|
8343
|
+
var lastRecoveryAt = 0;
|
|
8315
8344
|
var poll = function poll1() {
|
|
8316
8345
|
if (_this.inAdBreak) {
|
|
8317
8346
|
return;
|
|
@@ -8339,19 +8368,27 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8339
8368
|
}
|
|
8340
8369
|
return;
|
|
8341
8370
|
}
|
|
8342
|
-
var
|
|
8343
|
-
if (
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
var
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8371
|
+
var canRecover = wedged && elapsed >= graceMs && Date.now() - lastRecoveryAt >= recoveryCooldownMs && recoveries < maxRecoveries;
|
|
8372
|
+
if (canRecover) {
|
|
8373
|
+
recoveries++;
|
|
8374
|
+
lastRecoveryAt = Date.now();
|
|
8375
|
+
var isFinalAttempt = recoveries >= maxRecoveries;
|
|
8376
|
+
if (!isFinalAttempt) {
|
|
8377
|
+
var liveSyncPos = _this.host.getLiveSyncPosition();
|
|
8378
|
+
var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
|
|
8379
|
+
if (_this.debug) {
|
|
8380
|
+
console.warn("[StormcloudVideoPlayer] Content wedged after ad break (t=".concat(currentTime.toFixed(2), "s, buffered=").concat(bufferedAhead.toFixed(2), "s) — restarting HLS load at ").concat(reloadPos.toFixed(2), "s (recovery ").concat(recoveries, "/").concat(maxRecoveries, ")"));
|
|
8381
|
+
}
|
|
8382
|
+
if (liveSyncPos != null && liveSyncPos > currentTime) {
|
|
8383
|
+
video.currentTime = liveSyncPos;
|
|
8384
|
+
}
|
|
8385
|
+
_this.host.restartHlsLoad(reloadPos);
|
|
8386
|
+
} else {
|
|
8387
|
+
if (_this.debug) {
|
|
8388
|
+
console.warn("[StormcloudVideoPlayer] Content still wedged after ad break (t=".concat(currentTime.toFixed(2), "s, buffered=").concat(bufferedAhead.toFixed(2), "s) — hard-reloading live stream (recovery ").concat(recoveries, "/").concat(maxRecoveries, ")"));
|
|
8389
|
+
}
|
|
8390
|
+
_this.host.reloadLiveStream();
|
|
8353
8391
|
}
|
|
8354
|
-
_this.host.restartHlsLoad(reloadPos);
|
|
8355
8392
|
baseline = video.currentTime;
|
|
8356
8393
|
if (video.paused) {
|
|
8357
8394
|
var _video_play1;
|
|
@@ -8514,6 +8551,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8514
8551
|
restartHlsLoad: function restartHlsLoad(position) {
|
|
8515
8552
|
return _this.hlsEngine.restartLoadAt(position);
|
|
8516
8553
|
},
|
|
8554
|
+
reloadLiveStream: function reloadLiveStream() {
|
|
8555
|
+
return _this.hlsEngine.reloadLiveStream();
|
|
8556
|
+
},
|
|
8517
8557
|
generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
|
|
8518
8558
|
return _this.generatePodVastUrl(base, breakDurationMs);
|
|
8519
8559
|
}
|
|
@@ -8645,6 +8685,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8645
8685
|
return _async_to_generator(function() {
|
|
8646
8686
|
var prerollKey, adBehavior;
|
|
8647
8687
|
return _ts_generator(this, function(_state) {
|
|
8688
|
+
if (this.hlsEngine.reloadingLiveStream) {
|
|
8689
|
+
if (this.debug) {
|
|
8690
|
+
console.log("[StormcloudVideoPlayer] Manifest re-parsed after hard reload \u2014 skipping ad-player setup");
|
|
8691
|
+
}
|
|
8692
|
+
return [
|
|
8693
|
+
2
|
|
8694
|
+
];
|
|
8695
|
+
}
|
|
8648
8696
|
if (!this.adConfig.isVmapEnabled() && !isLive && this.adConfig.vmapBreaks.length === 0 && this.adConfig.apiVastTagUrl) {
|
|
8649
8697
|
prerollKey = "synthetic-vod-preroll";
|
|
8650
8698
|
if (!this.adConfig.consumedVmapBreakIds.has(prerollKey)) {
|