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.
@@ -3550,7 +3550,7 @@ function removeBrokenAppNameOrphans(params, appName) {
3550
3550
  try {
3551
3551
  for(var _iterator = appName.split("&").slice(1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
3552
3552
  var suffix = _step.value;
3553
- var trimmed = suffix.trimStart();
3553
+ var trimmed = suffix.replace(/^\s+/, "");
3554
3554
  if (!trimmed) continue;
3555
3555
  toDelete.push(suffix, " ".concat(trimmed), trimmed);
3556
3556
  }
@@ -3604,7 +3604,7 @@ function normalizeVastTagUrl(raw) {
3604
3604
  });
3605
3605
  if (orphanFragments.length > 0) {
3606
3606
  var reconstructed = [
3607
- anValue.trimEnd()
3607
+ anValue.replace(/\s+$/, "")
3608
3608
  ].concat(_to_consumable_array(orphanFragments)).filter(Boolean).join(" & ");
3609
3609
  url.searchParams.forEach(function(_value, key) {
3610
3610
  if (key && INVALID_VAST_PARAM_KEY.test(key)) {
@@ -6681,6 +6681,22 @@ var HlsEngine = /*#__PURE__*/ function() {
6681
6681
  return typeof pos === "number" && Number.isFinite(pos) ? pos : void 0;
6682
6682
  }
6683
6683
  },
6684
+ {
6685
+ key: "restartLoadAt",
6686
+ value: function restartLoadAt(position) {
6687
+ if (!this.hls) {
6688
+ return;
6689
+ }
6690
+ try {
6691
+ this.hls.stopLoad();
6692
+ this.hls.startLoad(position);
6693
+ } catch (error) {
6694
+ if (this.debug) {
6695
+ console.warn("[StormcloudVideoPlayer] Failed to restart HLS load at live edge:", error);
6696
+ }
6697
+ }
6698
+ }
6699
+ },
6684
6700
  {
6685
6701
  key: "destroy",
6686
6702
  value: function destroy() {
@@ -7997,11 +8013,56 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7997
8013
  console.log("[StormcloudVideoPlayer] Live break end — snapping to live edge: ".concat(this.host.video.currentTime.toFixed(2), "s → ").concat(liveSyncPos.toFixed(2), "s"));
7998
8014
  }
7999
8015
  this.host.video.currentTime = liveSyncPos;
8016
+ this.host.restartHlsLoad(liveSyncPos);
8000
8017
  }
8018
+ this.resumeContentPlayback();
8019
+ this.monitorLiveResumeStall(0, this.host.video.currentTime);
8020
+ return;
8001
8021
  }
8002
8022
  this.resumeContentPlayback();
8003
8023
  }
8004
8024
  },
8025
+ {
8026
+ key: "monitorLiveResumeStall",
8027
+ value: function monitorLiveResumeStall(attempt, lastTime) {
8028
+ var _this = this;
8029
+ var maxAttempts = 3;
8030
+ var checkDelayMs = 2500;
8031
+ window.setTimeout(function() {
8032
+ if (_this.inAdBreak) {
8033
+ return;
8034
+ }
8035
+ var currentTime = _this.host.video.currentTime;
8036
+ var advanced = currentTime > lastTime + 0.25;
8037
+ if (advanced && !_this.host.video.paused) {
8038
+ if (_this.debug) {
8039
+ console.log("[StormcloudVideoPlayer] Live stream resumed successfully after ad break");
8040
+ }
8041
+ return;
8042
+ }
8043
+ if (attempt >= maxAttempts) {
8044
+ if (_this.debug) {
8045
+ console.warn("[StormcloudVideoPlayer] Live stream failed to resume after ".concat(maxAttempts, " recovery attempts (t=").concat(currentTime.toFixed(2), "s)"));
8046
+ }
8047
+ return;
8048
+ }
8049
+ if (_this.debug) {
8050
+ 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, ")"));
8051
+ }
8052
+ var liveSyncPos = _this.host.getLiveSyncPosition();
8053
+ var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
8054
+ if (liveSyncPos != null && liveSyncPos > currentTime) {
8055
+ _this.host.video.currentTime = liveSyncPos;
8056
+ }
8057
+ _this.host.restartHlsLoad(reloadPos);
8058
+ if (_this.host.video.paused) {
8059
+ var _this_host_video_play;
8060
+ (_this_host_video_play = _this.host.video.play()) === null || _this_host_video_play === void 0 ? void 0 : _this_host_video_play.catch(function() {});
8061
+ }
8062
+ _this.monitorLiveResumeStall(attempt + 1, _this.host.video.currentTime);
8063
+ }, checkDelayMs);
8064
+ }
8065
+ },
8005
8066
  {
8006
8067
  key: "resumeContentPlayback",
8007
8068
  value: function resumeContentPlayback() {
@@ -8150,6 +8211,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8150
8211
  getLiveSyncPosition: function getLiveSyncPosition() {
8151
8212
  return _this.hlsEngine.getLiveSyncPosition();
8152
8213
  },
8214
+ restartHlsLoad: function restartHlsLoad(position) {
8215
+ return _this.hlsEngine.restartLoadAt(position);
8216
+ },
8153
8217
  generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
8154
8218
  return _this.generatePodVastUrl(base, breakDurationMs);
8155
8219
  }