stormcloud-video-player 0.8.36 → 0.8.38
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 +2 -2
- package/lib/index.cjs +66 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +66 -2
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +45 -0
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +2 -0
- package/lib/player/AdConfigManager.cjs +2 -2
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/HlsEngine.cjs +16 -0
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +66 -2
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +66 -2
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +66 -2
- package/lib/players/index.cjs.map +1 -1
- package/lib/types-iDjS8f_7.d.cts +133 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +66 -2
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/vastMacros.cjs +2 -2
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/package.json +1 -1
- package/rollup.config.js +6 -0
package/lib/index.cjs
CHANGED
|
@@ -3722,7 +3722,7 @@ function removeBrokenAppNameOrphans(params, appName) {
|
|
|
3722
3722
|
try {
|
|
3723
3723
|
for(var _iterator = appName.split("&").slice(1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3724
3724
|
var suffix = _step.value;
|
|
3725
|
-
var trimmed = suffix.
|
|
3725
|
+
var trimmed = suffix.replace(/^\s+/, "");
|
|
3726
3726
|
if (!trimmed) continue;
|
|
3727
3727
|
toDelete.push(suffix, " ".concat(trimmed), trimmed);
|
|
3728
3728
|
}
|
|
@@ -3776,7 +3776,7 @@ function normalizeVastTagUrl(raw) {
|
|
|
3776
3776
|
});
|
|
3777
3777
|
if (orphanFragments.length > 0) {
|
|
3778
3778
|
var reconstructed = [
|
|
3779
|
-
anValue.
|
|
3779
|
+
anValue.replace(/\s+$/, "")
|
|
3780
3780
|
].concat(_to_consumable_array(orphanFragments)).filter(Boolean).join(" & ");
|
|
3781
3781
|
url.searchParams.forEach(function(_value, key) {
|
|
3782
3782
|
if (key && INVALID_VAST_PARAM_KEY.test(key)) {
|
|
@@ -6876,6 +6876,22 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6876
6876
|
return typeof pos === "number" && Number.isFinite(pos) ? pos : void 0;
|
|
6877
6877
|
}
|
|
6878
6878
|
},
|
|
6879
|
+
{
|
|
6880
|
+
key: "restartLoadAt",
|
|
6881
|
+
value: function restartLoadAt(position) {
|
|
6882
|
+
if (!this.hls) {
|
|
6883
|
+
return;
|
|
6884
|
+
}
|
|
6885
|
+
try {
|
|
6886
|
+
this.hls.stopLoad();
|
|
6887
|
+
this.hls.startLoad(position);
|
|
6888
|
+
} catch (error) {
|
|
6889
|
+
if (this.debug) {
|
|
6890
|
+
console.warn("[StormcloudVideoPlayer] Failed to restart HLS load at live edge:", error);
|
|
6891
|
+
}
|
|
6892
|
+
}
|
|
6893
|
+
}
|
|
6894
|
+
},
|
|
6879
6895
|
{
|
|
6880
6896
|
key: "destroy",
|
|
6881
6897
|
value: function destroy() {
|
|
@@ -8192,11 +8208,56 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8192
8208
|
console.log("[StormcloudVideoPlayer] Live break end — snapping to live edge: ".concat(this.host.video.currentTime.toFixed(2), "s → ").concat(liveSyncPos.toFixed(2), "s"));
|
|
8193
8209
|
}
|
|
8194
8210
|
this.host.video.currentTime = liveSyncPos;
|
|
8211
|
+
this.host.restartHlsLoad(liveSyncPos);
|
|
8195
8212
|
}
|
|
8213
|
+
this.resumeContentPlayback();
|
|
8214
|
+
this.monitorLiveResumeStall(0, this.host.video.currentTime);
|
|
8215
|
+
return;
|
|
8196
8216
|
}
|
|
8197
8217
|
this.resumeContentPlayback();
|
|
8198
8218
|
}
|
|
8199
8219
|
},
|
|
8220
|
+
{
|
|
8221
|
+
key: "monitorLiveResumeStall",
|
|
8222
|
+
value: function monitorLiveResumeStall(attempt, lastTime) {
|
|
8223
|
+
var _this = this;
|
|
8224
|
+
var maxAttempts = 3;
|
|
8225
|
+
var checkDelayMs = 2500;
|
|
8226
|
+
window.setTimeout(function() {
|
|
8227
|
+
if (_this.inAdBreak) {
|
|
8228
|
+
return;
|
|
8229
|
+
}
|
|
8230
|
+
var currentTime = _this.host.video.currentTime;
|
|
8231
|
+
var advanced = currentTime > lastTime + 0.25;
|
|
8232
|
+
if (advanced && !_this.host.video.paused) {
|
|
8233
|
+
if (_this.debug) {
|
|
8234
|
+
console.log("[StormcloudVideoPlayer] Live stream resumed successfully after ad break");
|
|
8235
|
+
}
|
|
8236
|
+
return;
|
|
8237
|
+
}
|
|
8238
|
+
if (attempt >= maxAttempts) {
|
|
8239
|
+
if (_this.debug) {
|
|
8240
|
+
console.warn("[StormcloudVideoPlayer] Live stream failed to resume after ".concat(maxAttempts, " recovery attempts (t=").concat(currentTime.toFixed(2), "s)"));
|
|
8241
|
+
}
|
|
8242
|
+
return;
|
|
8243
|
+
}
|
|
8244
|
+
if (_this.debug) {
|
|
8245
|
+
console.warn("[StormcloudVideoPlayer] Content stalled after ad break (t=".concat(currentTime.toFixed(2), "s) — forcing HLS reload at live edge (attempt ").concat(attempt + 1, "/").concat(maxAttempts, ")"));
|
|
8246
|
+
}
|
|
8247
|
+
var liveSyncPos = _this.host.getLiveSyncPosition();
|
|
8248
|
+
var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
|
|
8249
|
+
if (liveSyncPos != null && liveSyncPos > currentTime) {
|
|
8250
|
+
_this.host.video.currentTime = liveSyncPos;
|
|
8251
|
+
}
|
|
8252
|
+
_this.host.restartHlsLoad(reloadPos);
|
|
8253
|
+
if (_this.host.video.paused) {
|
|
8254
|
+
var _this_host_video_play;
|
|
8255
|
+
(_this_host_video_play = _this.host.video.play()) === null || _this_host_video_play === void 0 ? void 0 : _this_host_video_play.catch(function() {});
|
|
8256
|
+
}
|
|
8257
|
+
_this.monitorLiveResumeStall(attempt + 1, _this.host.video.currentTime);
|
|
8258
|
+
}, checkDelayMs);
|
|
8259
|
+
}
|
|
8260
|
+
},
|
|
8200
8261
|
{
|
|
8201
8262
|
key: "resumeContentPlayback",
|
|
8202
8263
|
value: function resumeContentPlayback() {
|
|
@@ -8345,6 +8406,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8345
8406
|
getLiveSyncPosition: function getLiveSyncPosition() {
|
|
8346
8407
|
return _this.hlsEngine.getLiveSyncPosition();
|
|
8347
8408
|
},
|
|
8409
|
+
restartHlsLoad: function restartHlsLoad(position) {
|
|
8410
|
+
return _this.hlsEngine.restartLoadAt(position);
|
|
8411
|
+
},
|
|
8348
8412
|
generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
|
|
8349
8413
|
return _this.generatePodVastUrl(base, breakDurationMs);
|
|
8350
8414
|
}
|