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.
@@ -3514,7 +3514,7 @@ function removeBrokenAppNameOrphans(params, appName) {
3514
3514
  try {
3515
3515
  for(var _iterator = appName.split("&").slice(1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
3516
3516
  var suffix = _step.value;
3517
- var trimmed = suffix.trimStart();
3517
+ var trimmed = suffix.replace(/^\s+/, "");
3518
3518
  if (!trimmed) continue;
3519
3519
  toDelete.push(suffix, " ".concat(trimmed), trimmed);
3520
3520
  }
@@ -3568,7 +3568,7 @@ function normalizeVastTagUrl(raw) {
3568
3568
  });
3569
3569
  if (orphanFragments.length > 0) {
3570
3570
  var reconstructed = [
3571
- anValue.trimEnd()
3571
+ anValue.replace(/\s+$/, "")
3572
3572
  ].concat(_to_consumable_array(orphanFragments)).filter(Boolean).join(" & ");
3573
3573
  url.searchParams.forEach(function(_value, key) {
3574
3574
  if (key && INVALID_VAST_PARAM_KEY.test(key)) {
@@ -6645,6 +6645,22 @@ var HlsEngine = /*#__PURE__*/ function() {
6645
6645
  return typeof pos === "number" && Number.isFinite(pos) ? pos : void 0;
6646
6646
  }
6647
6647
  },
6648
+ {
6649
+ key: "restartLoadAt",
6650
+ value: function restartLoadAt(position) {
6651
+ if (!this.hls) {
6652
+ return;
6653
+ }
6654
+ try {
6655
+ this.hls.stopLoad();
6656
+ this.hls.startLoad(position);
6657
+ } catch (error) {
6658
+ if (this.debug) {
6659
+ console.warn("[StormcloudVideoPlayer] Failed to restart HLS load at live edge:", error);
6660
+ }
6661
+ }
6662
+ }
6663
+ },
6648
6664
  {
6649
6665
  key: "destroy",
6650
6666
  value: function destroy() {
@@ -7961,11 +7977,56 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7961
7977
  console.log("[StormcloudVideoPlayer] Live break end — snapping to live edge: ".concat(this.host.video.currentTime.toFixed(2), "s → ").concat(liveSyncPos.toFixed(2), "s"));
7962
7978
  }
7963
7979
  this.host.video.currentTime = liveSyncPos;
7980
+ this.host.restartHlsLoad(liveSyncPos);
7964
7981
  }
7982
+ this.resumeContentPlayback();
7983
+ this.monitorLiveResumeStall(0, this.host.video.currentTime);
7984
+ return;
7965
7985
  }
7966
7986
  this.resumeContentPlayback();
7967
7987
  }
7968
7988
  },
7989
+ {
7990
+ key: "monitorLiveResumeStall",
7991
+ value: function monitorLiveResumeStall(attempt, lastTime) {
7992
+ var _this = this;
7993
+ var maxAttempts = 3;
7994
+ var checkDelayMs = 2500;
7995
+ window.setTimeout(function() {
7996
+ if (_this.inAdBreak) {
7997
+ return;
7998
+ }
7999
+ var currentTime = _this.host.video.currentTime;
8000
+ var advanced = currentTime > lastTime + 0.25;
8001
+ if (advanced && !_this.host.video.paused) {
8002
+ if (_this.debug) {
8003
+ console.log("[StormcloudVideoPlayer] Live stream resumed successfully after ad break");
8004
+ }
8005
+ return;
8006
+ }
8007
+ if (attempt >= maxAttempts) {
8008
+ if (_this.debug) {
8009
+ console.warn("[StormcloudVideoPlayer] Live stream failed to resume after ".concat(maxAttempts, " recovery attempts (t=").concat(currentTime.toFixed(2), "s)"));
8010
+ }
8011
+ return;
8012
+ }
8013
+ if (_this.debug) {
8014
+ 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, ")"));
8015
+ }
8016
+ var liveSyncPos = _this.host.getLiveSyncPosition();
8017
+ var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
8018
+ if (liveSyncPos != null && liveSyncPos > currentTime) {
8019
+ _this.host.video.currentTime = liveSyncPos;
8020
+ }
8021
+ _this.host.restartHlsLoad(reloadPos);
8022
+ if (_this.host.video.paused) {
8023
+ var _this_host_video_play;
8024
+ (_this_host_video_play = _this.host.video.play()) === null || _this_host_video_play === void 0 ? void 0 : _this_host_video_play.catch(function() {});
8025
+ }
8026
+ _this.monitorLiveResumeStall(attempt + 1, _this.host.video.currentTime);
8027
+ }, checkDelayMs);
8028
+ }
8029
+ },
7969
8030
  {
7970
8031
  key: "resumeContentPlayback",
7971
8032
  value: function resumeContentPlayback() {
@@ -8114,6 +8175,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8114
8175
  getLiveSyncPosition: function getLiveSyncPosition() {
8115
8176
  return _this.hlsEngine.getLiveSyncPosition();
8116
8177
  },
8178
+ restartHlsLoad: function restartHlsLoad(position) {
8179
+ return _this.hlsEngine.restartLoadAt(position);
8180
+ },
8117
8181
  generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
8118
8182
  return _this.generatePodVastUrl(base, breakDurationMs);
8119
8183
  }