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.js
CHANGED
|
@@ -6274,6 +6274,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6274
6274
|
this.isLiveStream = false;
|
|
6275
6275
|
this.nativeHlsMode = false;
|
|
6276
6276
|
this.videoSrcProtection = null;
|
|
6277
|
+
this.reloadingLiveStream = false;
|
|
6277
6278
|
this.bufferedSegmentsCount = 0;
|
|
6278
6279
|
this.shouldAutoplayAfterBuffering = false;
|
|
6279
6280
|
this.hasInitialBufferCompleted = false;
|
|
@@ -6407,6 +6408,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6407
6408
|
_state.sent();
|
|
6408
6409
|
_state.label = 3;
|
|
6409
6410
|
case 3:
|
|
6411
|
+
this.reloadingLiveStream = false;
|
|
6410
6412
|
return [
|
|
6411
6413
|
2
|
|
6412
6414
|
];
|
|
@@ -6751,6 +6753,33 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6751
6753
|
}
|
|
6752
6754
|
}
|
|
6753
6755
|
},
|
|
6756
|
+
{
|
|
6757
|
+
key: "reloadLiveStream",
|
|
6758
|
+
value: function reloadLiveStream() {
|
|
6759
|
+
var hls = this.hls;
|
|
6760
|
+
if (!hls) {
|
|
6761
|
+
return;
|
|
6762
|
+
}
|
|
6763
|
+
if (this.debug) {
|
|
6764
|
+
console.log("[StormcloudVideoPlayer] Hard-reloading live stream (detach \u2192 reset video \u2192 re-attach)");
|
|
6765
|
+
}
|
|
6766
|
+
try {
|
|
6767
|
+
this.reloadingLiveStream = true;
|
|
6768
|
+
hls.stopLoad();
|
|
6769
|
+
hls.detachMedia();
|
|
6770
|
+
try {
|
|
6771
|
+
this.video.removeAttribute("src");
|
|
6772
|
+
this.video.load();
|
|
6773
|
+
} catch (unused) {}
|
|
6774
|
+
hls.attachMedia(this.video);
|
|
6775
|
+
} catch (error) {
|
|
6776
|
+
this.reloadingLiveStream = false;
|
|
6777
|
+
if (this.debug) {
|
|
6778
|
+
console.warn("[StormcloudVideoPlayer] Failed to hard-reload live stream:", error);
|
|
6779
|
+
}
|
|
6780
|
+
}
|
|
6781
|
+
}
|
|
6782
|
+
},
|
|
6754
6783
|
{
|
|
6755
6784
|
key: "destroy",
|
|
6756
6785
|
value: function destroy() {
|
|
@@ -8097,13 +8126,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8097
8126
|
var _this = this;
|
|
8098
8127
|
var pollIntervalMs = 1e3;
|
|
8099
8128
|
var graceMs = 5e3;
|
|
8100
|
-
var
|
|
8101
|
-
var
|
|
8102
|
-
var maxMonitorMs =
|
|
8129
|
+
var recoveryCooldownMs = 5e3;
|
|
8130
|
+
var maxRecoveries = 2;
|
|
8131
|
+
var maxMonitorMs = 3e4;
|
|
8103
8132
|
var startTime = Date.now();
|
|
8104
8133
|
var baseline = resumeBaseline;
|
|
8105
|
-
var
|
|
8106
|
-
var
|
|
8134
|
+
var recoveries = 0;
|
|
8135
|
+
var lastRecoveryAt = 0;
|
|
8107
8136
|
var poll = function poll1() {
|
|
8108
8137
|
if (_this.inAdBreak) {
|
|
8109
8138
|
return;
|
|
@@ -8131,19 +8160,27 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8131
8160
|
}
|
|
8132
8161
|
return;
|
|
8133
8162
|
}
|
|
8134
|
-
var
|
|
8135
|
-
if (
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
var
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8163
|
+
var canRecover = wedged && elapsed >= graceMs && Date.now() - lastRecoveryAt >= recoveryCooldownMs && recoveries < maxRecoveries;
|
|
8164
|
+
if (canRecover) {
|
|
8165
|
+
recoveries++;
|
|
8166
|
+
lastRecoveryAt = Date.now();
|
|
8167
|
+
var isFinalAttempt = recoveries >= maxRecoveries;
|
|
8168
|
+
if (!isFinalAttempt) {
|
|
8169
|
+
var liveSyncPos = _this.host.getLiveSyncPosition();
|
|
8170
|
+
var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
|
|
8171
|
+
if (_this.debug) {
|
|
8172
|
+
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, ")"));
|
|
8173
|
+
}
|
|
8174
|
+
if (liveSyncPos != null && liveSyncPos > currentTime) {
|
|
8175
|
+
video.currentTime = liveSyncPos;
|
|
8176
|
+
}
|
|
8177
|
+
_this.host.restartHlsLoad(reloadPos);
|
|
8178
|
+
} else {
|
|
8179
|
+
if (_this.debug) {
|
|
8180
|
+
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, ")"));
|
|
8181
|
+
}
|
|
8182
|
+
_this.host.reloadLiveStream();
|
|
8145
8183
|
}
|
|
8146
|
-
_this.host.restartHlsLoad(reloadPos);
|
|
8147
8184
|
baseline = video.currentTime;
|
|
8148
8185
|
if (video.paused) {
|
|
8149
8186
|
var _video_play1;
|
|
@@ -8307,6 +8344,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8307
8344
|
restartHlsLoad: function restartHlsLoad(position) {
|
|
8308
8345
|
return _this.hlsEngine.restartLoadAt(position);
|
|
8309
8346
|
},
|
|
8347
|
+
reloadLiveStream: function reloadLiveStream() {
|
|
8348
|
+
return _this.hlsEngine.reloadLiveStream();
|
|
8349
|
+
},
|
|
8310
8350
|
generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
|
|
8311
8351
|
return _this.generatePodVastUrl(base, breakDurationMs);
|
|
8312
8352
|
}
|
|
@@ -8438,6 +8478,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8438
8478
|
return _async_to_generator(function() {
|
|
8439
8479
|
var prerollKey, adBehavior;
|
|
8440
8480
|
return _ts_generator(this, function(_state) {
|
|
8481
|
+
if (this.hlsEngine.reloadingLiveStream) {
|
|
8482
|
+
if (this.debug) {
|
|
8483
|
+
console.log("[StormcloudVideoPlayer] Manifest re-parsed after hard reload \u2014 skipping ad-player setup");
|
|
8484
|
+
}
|
|
8485
|
+
return [
|
|
8486
|
+
2
|
|
8487
|
+
];
|
|
8488
|
+
}
|
|
8441
8489
|
if (!this.adConfig.isVmapEnabled() && !isLive && this.adConfig.vmapBreaks.length === 0 && this.adConfig.apiVastTagUrl) {
|
|
8442
8490
|
prerollKey = "synthetic-vod-preroll";
|
|
8443
8491
|
if (!this.adConfig.consumedVmapBreakIds.has(prerollKey)) {
|