stormcloud-video-player 0.8.36 → 0.8.37
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 +68 -4
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +68 -4
- 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 +17 -1
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +68 -4
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +68 -4
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +68 -4
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +1 -1
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +68 -4
- 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
|
@@ -1099,7 +1099,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1099
1099
|
adHls.destroy();
|
|
1100
1100
|
}
|
|
1101
1101
|
adHls = new import_hls.default({
|
|
1102
|
-
enableWorker:
|
|
1102
|
+
enableWorker: typeof globalThis !== "undefined",
|
|
1103
1103
|
lowLatencyMode: false
|
|
1104
1104
|
});
|
|
1105
1105
|
adHls.loadSource(mediaFile.url);
|
|
@@ -3463,7 +3463,7 @@ function removeBrokenAppNameOrphans(params, appName) {
|
|
|
3463
3463
|
try {
|
|
3464
3464
|
for(var _iterator = appName.split("&").slice(1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3465
3465
|
var suffix = _step.value;
|
|
3466
|
-
var trimmed = suffix.
|
|
3466
|
+
var trimmed = suffix.replace(/^\s+/, "");
|
|
3467
3467
|
if (!trimmed) continue;
|
|
3468
3468
|
toDelete.push(suffix, " ".concat(trimmed), trimmed);
|
|
3469
3469
|
}
|
|
@@ -3517,7 +3517,7 @@ function normalizeVastTagUrl(raw) {
|
|
|
3517
3517
|
});
|
|
3518
3518
|
if (orphanFragments.length > 0) {
|
|
3519
3519
|
var reconstructed = [
|
|
3520
|
-
anValue.
|
|
3520
|
+
anValue.replace(/\s+$/, "")
|
|
3521
3521
|
].concat(_to_consumable_array(orphanFragments)).filter(Boolean).join(" & ");
|
|
3522
3522
|
url.searchParams.forEach(function(_value, key) {
|
|
3523
3523
|
if (key && INVALID_VAST_PARAM_KEY.test(key)) {
|
|
@@ -6205,7 +6205,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6205
6205
|
value: function setupHls() {
|
|
6206
6206
|
var _this = this;
|
|
6207
6207
|
this.hls = new import_hls2.default(_object_spread_props(_object_spread({
|
|
6208
|
-
enableWorker:
|
|
6208
|
+
enableWorker: typeof globalThis !== "undefined",
|
|
6209
6209
|
backBufferLength: 30,
|
|
6210
6210
|
liveDurationInfinity: true,
|
|
6211
6211
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
@@ -6594,6 +6594,22 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6594
6594
|
return typeof pos === "number" && Number.isFinite(pos) ? pos : void 0;
|
|
6595
6595
|
}
|
|
6596
6596
|
},
|
|
6597
|
+
{
|
|
6598
|
+
key: "restartLoadAt",
|
|
6599
|
+
value: function restartLoadAt(position) {
|
|
6600
|
+
if (!this.hls) {
|
|
6601
|
+
return;
|
|
6602
|
+
}
|
|
6603
|
+
try {
|
|
6604
|
+
this.hls.stopLoad();
|
|
6605
|
+
this.hls.startLoad(position);
|
|
6606
|
+
} catch (error) {
|
|
6607
|
+
if (this.debug) {
|
|
6608
|
+
console.warn("[StormcloudVideoPlayer] Failed to restart HLS load at live edge:", error);
|
|
6609
|
+
}
|
|
6610
|
+
}
|
|
6611
|
+
}
|
|
6612
|
+
},
|
|
6597
6613
|
{
|
|
6598
6614
|
key: "destroy",
|
|
6599
6615
|
value: function destroy() {
|
|
@@ -7910,11 +7926,56 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
7910
7926
|
console.log("[StormcloudVideoPlayer] Live break end — snapping to live edge: ".concat(this.host.video.currentTime.toFixed(2), "s → ").concat(liveSyncPos.toFixed(2), "s"));
|
|
7911
7927
|
}
|
|
7912
7928
|
this.host.video.currentTime = liveSyncPos;
|
|
7929
|
+
this.host.restartHlsLoad(liveSyncPos);
|
|
7913
7930
|
}
|
|
7931
|
+
this.resumeContentPlayback();
|
|
7932
|
+
this.monitorLiveResumeStall(0, this.host.video.currentTime);
|
|
7933
|
+
return;
|
|
7914
7934
|
}
|
|
7915
7935
|
this.resumeContentPlayback();
|
|
7916
7936
|
}
|
|
7917
7937
|
},
|
|
7938
|
+
{
|
|
7939
|
+
key: "monitorLiveResumeStall",
|
|
7940
|
+
value: function monitorLiveResumeStall(attempt, lastTime) {
|
|
7941
|
+
var _this = this;
|
|
7942
|
+
var maxAttempts = 3;
|
|
7943
|
+
var checkDelayMs = 2500;
|
|
7944
|
+
window.setTimeout(function() {
|
|
7945
|
+
if (_this.inAdBreak) {
|
|
7946
|
+
return;
|
|
7947
|
+
}
|
|
7948
|
+
var currentTime = _this.host.video.currentTime;
|
|
7949
|
+
var advanced = currentTime > lastTime + 0.25;
|
|
7950
|
+
if (advanced && !_this.host.video.paused) {
|
|
7951
|
+
if (_this.debug) {
|
|
7952
|
+
console.log("[StormcloudVideoPlayer] Live stream resumed successfully after ad break");
|
|
7953
|
+
}
|
|
7954
|
+
return;
|
|
7955
|
+
}
|
|
7956
|
+
if (attempt >= maxAttempts) {
|
|
7957
|
+
if (_this.debug) {
|
|
7958
|
+
console.warn("[StormcloudVideoPlayer] Live stream failed to resume after ".concat(maxAttempts, " recovery attempts (t=").concat(currentTime.toFixed(2), "s)"));
|
|
7959
|
+
}
|
|
7960
|
+
return;
|
|
7961
|
+
}
|
|
7962
|
+
if (_this.debug) {
|
|
7963
|
+
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, ")"));
|
|
7964
|
+
}
|
|
7965
|
+
var liveSyncPos = _this.host.getLiveSyncPosition();
|
|
7966
|
+
var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
|
|
7967
|
+
if (liveSyncPos != null && liveSyncPos > currentTime) {
|
|
7968
|
+
_this.host.video.currentTime = liveSyncPos;
|
|
7969
|
+
}
|
|
7970
|
+
_this.host.restartHlsLoad(reloadPos);
|
|
7971
|
+
if (_this.host.video.paused) {
|
|
7972
|
+
var _this_host_video_play;
|
|
7973
|
+
(_this_host_video_play = _this.host.video.play()) === null || _this_host_video_play === void 0 ? void 0 : _this_host_video_play.catch(function() {});
|
|
7974
|
+
}
|
|
7975
|
+
_this.monitorLiveResumeStall(attempt + 1, _this.host.video.currentTime);
|
|
7976
|
+
}, checkDelayMs);
|
|
7977
|
+
}
|
|
7978
|
+
},
|
|
7918
7979
|
{
|
|
7919
7980
|
key: "resumeContentPlayback",
|
|
7920
7981
|
value: function resumeContentPlayback() {
|
|
@@ -8063,6 +8124,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8063
8124
|
getLiveSyncPosition: function getLiveSyncPosition() {
|
|
8064
8125
|
return _this.hlsEngine.getLiveSyncPosition();
|
|
8065
8126
|
},
|
|
8127
|
+
restartHlsLoad: function restartHlsLoad(position) {
|
|
8128
|
+
return _this.hlsEngine.restartLoadAt(position);
|
|
8129
|
+
},
|
|
8066
8130
|
generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
|
|
8067
8131
|
return _this.generatePodVastUrl(base, breakDurationMs);
|
|
8068
8132
|
}
|