stormcloud-video-player 0.7.4 → 0.7.6

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.
@@ -491,8 +491,8 @@ var UNSUPPORTED_VIDEO_EXTENSIONS = [
491
491
  var REQUEST_TIMEOUT_MS = 5e3;
492
492
  var REQUEST_MAX_RETRIES = 3;
493
493
  var REQUEST_RETRY_BACKOFF_MS = 1500;
494
- var AD_LAYER_Z_INDEX = "2147483646";
495
- var COUNTDOWN_Z_INDEX = "2147483647";
494
+ var AD_LAYER_Z_INDEX = "30";
495
+ var COUNTDOWN_Z_INDEX = "31";
496
496
  var STALL_TIMEOUT_MS = 8e3;
497
497
  function getFileExtension(url) {
498
498
  try {
@@ -1196,7 +1196,7 @@ function createAdStormPlayer(contentVideo, options) {
1196
1196
  container.style.isolation = "isolate";
1197
1197
  var countdown = document.createElement("div");
1198
1198
  countdown.style.position = "absolute";
1199
- countdown.style.right = "12px";
1199
+ countdown.style.left = "12px";
1200
1200
  countdown.style.top = "12px";
1201
1201
  countdown.style.padding = "4px 8px";
1202
1202
  countdown.style.borderRadius = "4px";
@@ -1647,7 +1647,7 @@ function createAdStormPlayer(contentVideo, options) {
1647
1647
  container.style.isolation = "isolate";
1648
1648
  var countdown = document.createElement("div");
1649
1649
  countdown.style.position = "absolute";
1650
- countdown.style.right = "12px";
1650
+ countdown.style.left = "12px";
1651
1651
  countdown.style.top = "12px";
1652
1652
  countdown.style.padding = "4px 8px";
1653
1653
  countdown.style.borderRadius = "4px";
@@ -2743,6 +2743,7 @@ function getBrowserConfigOverrides() {
2743
2743
  return overrides;
2744
2744
  }
2745
2745
  // src/player/StormcloudVideoPlayer.ts
2746
+ var DEBUG_HISTORY_LIMIT = 120;
2746
2747
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2747
2748
  function StormcloudVideoPlayer(config) {
2748
2749
  _class_call_check(this, StormcloudVideoPlayer);
@@ -2785,6 +2786,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2785
2786
  this.adRequestMaxRetries = 3;
2786
2787
  this.adRequestRetryBackoffMs = 1500;
2787
2788
  this.preloadedTokens = [];
2789
+ this.debugLogEntries = [];
2790
+ this.scteMarkerHistory = [];
2788
2791
  initializePolyfills();
2789
2792
  var browserOverrides = getBrowserConfigOverrides();
2790
2793
  this.config = _object_spread({}, browserOverrides, config);
@@ -3291,6 +3294,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3291
3294
  errorMessage += ". Caused by: ".concat(causeMessage);
3292
3295
  }
3293
3296
  }
3297
+ _this.pushDebugLog("error", "ad", errorMessage, _object_spread({}, errorPayload ? {
3298
+ payload: errorPayload
3299
+ } : {}));
3294
3300
  console.error("[AD-ERROR]", errorMessage, errorPayload || "");
3295
3301
  _this.adLayer.stop().catch(function() {});
3296
3302
  _this.handleAdFailure();
@@ -3732,6 +3738,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3732
3738
  value: function onScte35Marker(marker) {
3733
3739
  var _this = this;
3734
3740
  if (this.config.disableAds) return;
3741
+ this.pushScteMarker(marker);
3742
+ this.pushDebugLog("info", "scte35", "SCTE-35 marker detected", {
3743
+ type: marker.type,
3744
+ ptsSeconds: marker.ptsSeconds,
3745
+ durationSeconds: marker.durationSeconds,
3746
+ currentTime: this.video.currentTime
3747
+ });
3735
3748
  if (this.config.debugAdTiming) {
3736
3749
  console.log("[StormcloudVideoPlayer] SCTE-35 marker detected:", {
3737
3750
  type: marker.type,
@@ -5600,6 +5613,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5600
5613
  if (!this.config.debugAdTiming) {
5601
5614
  return;
5602
5615
  }
5616
+ this.pushDebugLog("info", "ad-state", event, extra);
5603
5617
  console.log("[StormcloudVideoPlayer][AdState]", _object_spread({
5604
5618
  event: event,
5605
5619
  timestamp: /* @__PURE__ */ new Date().toISOString(),
@@ -5619,6 +5633,59 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5619
5633
  return Math.max(0, this.expectedAdBreakDurationMs - elapsed);
5620
5634
  }
5621
5635
  },
5636
+ {
5637
+ key: "pushScteMarker",
5638
+ value: function pushScteMarker(marker) {
5639
+ if (!this.config.debugAdTiming) return;
5640
+ this.scteMarkerHistory.push({
5641
+ timestampMs: Date.now(),
5642
+ marker: marker
5643
+ });
5644
+ if (this.scteMarkerHistory.length > DEBUG_HISTORY_LIMIT) {
5645
+ this.scteMarkerHistory = this.scteMarkerHistory.slice(-DEBUG_HISTORY_LIMIT);
5646
+ }
5647
+ }
5648
+ },
5649
+ {
5650
+ key: "pushDebugLog",
5651
+ value: function pushDebugLog(level, category, message, details) {
5652
+ if (!this.config.debugAdTiming) return;
5653
+ this.debugLogEntries.push(_object_spread({
5654
+ timestampMs: Date.now(),
5655
+ level: level,
5656
+ category: category,
5657
+ message: message
5658
+ }, details ? {
5659
+ details: details
5660
+ } : {}));
5661
+ if (this.debugLogEntries.length > DEBUG_HISTORY_LIMIT) {
5662
+ this.debugLogEntries = this.debugLogEntries.slice(-DEBUG_HISTORY_LIMIT);
5663
+ }
5664
+ }
5665
+ },
5666
+ {
5667
+ key: "getRecentScteMarkers",
5668
+ value: function getRecentScteMarkers() {
5669
+ return this.scteMarkerHistory.map(function(entry) {
5670
+ return _object_spread({
5671
+ timestampMs: entry.timestampMs,
5672
+ type: entry.marker.type
5673
+ }, entry.marker.ptsSeconds !== void 0 ? {
5674
+ ptsSeconds: entry.marker.ptsSeconds
5675
+ } : {}, entry.marker.durationSeconds !== void 0 ? {
5676
+ durationSeconds: entry.marker.durationSeconds
5677
+ } : {}, entry.marker.raw !== void 0 ? {
5678
+ raw: entry.marker.raw
5679
+ } : {});
5680
+ });
5681
+ }
5682
+ },
5683
+ {
5684
+ key: "getDebugLogs",
5685
+ value: function getDebugLogs() {
5686
+ return this.debugLogEntries.slice();
5687
+ }
5688
+ },
5622
5689
  {
5623
5690
  key: "toggleMute",
5624
5691
  value: function toggleMute() {
@@ -5864,6 +5931,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5864
5931
  (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
5865
5932
  (_this_adLayer = this.adLayer) === null || _this_adLayer === void 0 ? void 0 : _this_adLayer.destroy();
5866
5933
  this.consecutiveFailures = 0;
5934
+ this.debugLogEntries = [];
5935
+ this.scteMarkerHistory = [];
5867
5936
  }
5868
5937
  }
5869
5938
  ]);