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
|
@@ -6252,6 +6252,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6252
6252
|
this.isLiveStream = false;
|
|
6253
6253
|
this.nativeHlsMode = false;
|
|
6254
6254
|
this.videoSrcProtection = null;
|
|
6255
|
+
this.reloadingLiveStream = false;
|
|
6255
6256
|
this.bufferedSegmentsCount = 0;
|
|
6256
6257
|
this.shouldAutoplayAfterBuffering = false;
|
|
6257
6258
|
this.hasInitialBufferCompleted = false;
|
|
@@ -6385,6 +6386,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6385
6386
|
_state.sent();
|
|
6386
6387
|
_state.label = 3;
|
|
6387
6388
|
case 3:
|
|
6389
|
+
this.reloadingLiveStream = false;
|
|
6388
6390
|
return [
|
|
6389
6391
|
2
|
|
6390
6392
|
];
|
|
@@ -6729,6 +6731,33 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6729
6731
|
}
|
|
6730
6732
|
}
|
|
6731
6733
|
},
|
|
6734
|
+
{
|
|
6735
|
+
key: "reloadLiveStream",
|
|
6736
|
+
value: function reloadLiveStream() {
|
|
6737
|
+
var hls = this.hls;
|
|
6738
|
+
if (!hls) {
|
|
6739
|
+
return;
|
|
6740
|
+
}
|
|
6741
|
+
if (this.debug) {
|
|
6742
|
+
console.log("[StormcloudVideoPlayer] Hard-reloading live stream (detach \u2192 reset video \u2192 re-attach)");
|
|
6743
|
+
}
|
|
6744
|
+
try {
|
|
6745
|
+
this.reloadingLiveStream = true;
|
|
6746
|
+
hls.stopLoad();
|
|
6747
|
+
hls.detachMedia();
|
|
6748
|
+
try {
|
|
6749
|
+
this.video.removeAttribute("src");
|
|
6750
|
+
this.video.load();
|
|
6751
|
+
} catch (unused) {}
|
|
6752
|
+
hls.attachMedia(this.video);
|
|
6753
|
+
} catch (error) {
|
|
6754
|
+
this.reloadingLiveStream = false;
|
|
6755
|
+
if (this.debug) {
|
|
6756
|
+
console.warn("[StormcloudVideoPlayer] Failed to hard-reload live stream:", error);
|
|
6757
|
+
}
|
|
6758
|
+
}
|
|
6759
|
+
}
|
|
6760
|
+
},
|
|
6732
6761
|
{
|
|
6733
6762
|
key: "destroy",
|
|
6734
6763
|
value: function destroy() {
|
|
@@ -8074,13 +8103,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8074
8103
|
var _this = this;
|
|
8075
8104
|
var pollIntervalMs = 1e3;
|
|
8076
8105
|
var graceMs = 5e3;
|
|
8077
|
-
var
|
|
8078
|
-
var
|
|
8079
|
-
var maxMonitorMs =
|
|
8106
|
+
var recoveryCooldownMs = 5e3;
|
|
8107
|
+
var maxRecoveries = 2;
|
|
8108
|
+
var maxMonitorMs = 3e4;
|
|
8080
8109
|
var startTime = Date.now();
|
|
8081
8110
|
var baseline = resumeBaseline;
|
|
8082
|
-
var
|
|
8083
|
-
var
|
|
8111
|
+
var recoveries = 0;
|
|
8112
|
+
var lastRecoveryAt = 0;
|
|
8084
8113
|
var poll = function poll1() {
|
|
8085
8114
|
if (_this.inAdBreak) {
|
|
8086
8115
|
return;
|
|
@@ -8108,19 +8137,27 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8108
8137
|
}
|
|
8109
8138
|
return;
|
|
8110
8139
|
}
|
|
8111
|
-
var
|
|
8112
|
-
if (
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
var
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8140
|
+
var canRecover = wedged && elapsed >= graceMs && Date.now() - lastRecoveryAt >= recoveryCooldownMs && recoveries < maxRecoveries;
|
|
8141
|
+
if (canRecover) {
|
|
8142
|
+
recoveries++;
|
|
8143
|
+
lastRecoveryAt = Date.now();
|
|
8144
|
+
var isFinalAttempt = recoveries >= maxRecoveries;
|
|
8145
|
+
if (!isFinalAttempt) {
|
|
8146
|
+
var liveSyncPos = _this.host.getLiveSyncPosition();
|
|
8147
|
+
var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
|
|
8148
|
+
if (_this.debug) {
|
|
8149
|
+
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, ")"));
|
|
8150
|
+
}
|
|
8151
|
+
if (liveSyncPos != null && liveSyncPos > currentTime) {
|
|
8152
|
+
video.currentTime = liveSyncPos;
|
|
8153
|
+
}
|
|
8154
|
+
_this.host.restartHlsLoad(reloadPos);
|
|
8155
|
+
} else {
|
|
8156
|
+
if (_this.debug) {
|
|
8157
|
+
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, ")"));
|
|
8158
|
+
}
|
|
8159
|
+
_this.host.reloadLiveStream();
|
|
8122
8160
|
}
|
|
8123
|
-
_this.host.restartHlsLoad(reloadPos);
|
|
8124
8161
|
baseline = video.currentTime;
|
|
8125
8162
|
if (video.paused) {
|
|
8126
8163
|
var _video_play1;
|
|
@@ -8283,6 +8320,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8283
8320
|
restartHlsLoad: function restartHlsLoad(position) {
|
|
8284
8321
|
return _this.hlsEngine.restartLoadAt(position);
|
|
8285
8322
|
},
|
|
8323
|
+
reloadLiveStream: function reloadLiveStream() {
|
|
8324
|
+
return _this.hlsEngine.reloadLiveStream();
|
|
8325
|
+
},
|
|
8286
8326
|
generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
|
|
8287
8327
|
return _this.generatePodVastUrl(base, breakDurationMs);
|
|
8288
8328
|
}
|
|
@@ -8414,6 +8454,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8414
8454
|
return _async_to_generator(function() {
|
|
8415
8455
|
var prerollKey, adBehavior;
|
|
8416
8456
|
return _ts_generator(this, function(_state) {
|
|
8457
|
+
if (this.hlsEngine.reloadingLiveStream) {
|
|
8458
|
+
if (this.debug) {
|
|
8459
|
+
console.log("[StormcloudVideoPlayer] Manifest re-parsed after hard reload \u2014 skipping ad-player setup");
|
|
8460
|
+
}
|
|
8461
|
+
return [
|
|
8462
|
+
2
|
|
8463
|
+
];
|
|
8464
|
+
}
|
|
8417
8465
|
if (!this.adConfig.isVmapEnabled() && !isLive && this.adConfig.vmapBreaks.length === 0 && this.adConfig.apiVastTagUrl) {
|
|
8418
8466
|
prerollKey = "synthetic-vod-preroll";
|
|
8419
8467
|
if (!this.adConfig.consumedVmapBreakIds.has(prerollKey)) {
|