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.
@@ -1,5 +1,6 @@
1
- import { S as StormcloudVideoPlayerConfig } from '../types-vCa10HuQ.cjs';
1
+ import { S as StormcloudVideoPlayerConfig, a as Scte35Marker } from '../types-ClqQZM3U.cjs';
2
2
 
3
+ type DebugLogLevel = "info" | "warn" | "error";
3
4
  declare class StormcloudVideoPlayer {
4
5
  private readonly video;
5
6
  private readonly config;
@@ -56,6 +57,8 @@ declare class StormcloudVideoPlayer {
56
57
  private preloadedTokens;
57
58
  private fillerVideo;
58
59
  private fillerBreakTimerId;
60
+ private debugLogEntries;
61
+ private scteMarkerHistory;
59
62
  constructor(config: StormcloudVideoPlayerConfig);
60
63
  private adRequest;
61
64
  load(): Promise<void>;
@@ -115,6 +118,22 @@ declare class StormcloudVideoPlayer {
115
118
  private clearAdFailsafeTimer;
116
119
  private logAdState;
117
120
  private getRemainingAdMs;
121
+ private pushScteMarker;
122
+ private pushDebugLog;
123
+ getRecentScteMarkers(): ReadonlyArray<{
124
+ timestampMs: number;
125
+ type: Scte35Marker["type"];
126
+ ptsSeconds?: number;
127
+ durationSeconds?: number;
128
+ raw?: unknown;
129
+ }>;
130
+ getDebugLogs(): ReadonlyArray<{
131
+ timestampMs: number;
132
+ level: DebugLogLevel;
133
+ category: string;
134
+ message: string;
135
+ details?: Record<string, unknown>;
136
+ }>;
118
137
  toggleMute(): void;
119
138
  toggleFullscreen(): Promise<void>;
120
139
  isMuted(): boolean;
@@ -543,8 +543,8 @@ var UNSUPPORTED_VIDEO_EXTENSIONS = [
543
543
  var REQUEST_TIMEOUT_MS = 5e3;
544
544
  var REQUEST_MAX_RETRIES = 3;
545
545
  var REQUEST_RETRY_BACKOFF_MS = 1500;
546
- var AD_LAYER_Z_INDEX = "2147483646";
547
- var COUNTDOWN_Z_INDEX = "2147483647";
546
+ var AD_LAYER_Z_INDEX = "30";
547
+ var COUNTDOWN_Z_INDEX = "31";
548
548
  var STALL_TIMEOUT_MS = 8e3;
549
549
  function getFileExtension(url) {
550
550
  try {
@@ -1248,7 +1248,7 @@ function createAdStormPlayer(contentVideo, options) {
1248
1248
  container.style.isolation = "isolate";
1249
1249
  var countdown = document.createElement("div");
1250
1250
  countdown.style.position = "absolute";
1251
- countdown.style.right = "12px";
1251
+ countdown.style.left = "12px";
1252
1252
  countdown.style.top = "12px";
1253
1253
  countdown.style.padding = "4px 8px";
1254
1254
  countdown.style.borderRadius = "4px";
@@ -1699,7 +1699,7 @@ function createAdStormPlayer(contentVideo, options) {
1699
1699
  container.style.isolation = "isolate";
1700
1700
  var countdown = document.createElement("div");
1701
1701
  countdown.style.position = "absolute";
1702
- countdown.style.right = "12px";
1702
+ countdown.style.left = "12px";
1703
1703
  countdown.style.top = "12px";
1704
1704
  countdown.style.padding = "4px 8px";
1705
1705
  countdown.style.borderRadius = "4px";
@@ -2795,6 +2795,7 @@ function getBrowserConfigOverrides() {
2795
2795
  return overrides;
2796
2796
  }
2797
2797
  // src/player/StormcloudVideoPlayer.ts
2798
+ var DEBUG_HISTORY_LIMIT = 120;
2798
2799
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2799
2800
  function StormcloudVideoPlayer(config) {
2800
2801
  _class_call_check(this, StormcloudVideoPlayer);
@@ -2837,6 +2838,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2837
2838
  this.adRequestMaxRetries = 3;
2838
2839
  this.adRequestRetryBackoffMs = 1500;
2839
2840
  this.preloadedTokens = [];
2841
+ this.debugLogEntries = [];
2842
+ this.scteMarkerHistory = [];
2840
2843
  initializePolyfills();
2841
2844
  var browserOverrides = getBrowserConfigOverrides();
2842
2845
  this.config = _object_spread({}, browserOverrides, config);
@@ -3343,6 +3346,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3343
3346
  errorMessage += ". Caused by: ".concat(causeMessage);
3344
3347
  }
3345
3348
  }
3349
+ _this.pushDebugLog("error", "ad", errorMessage, _object_spread({}, errorPayload ? {
3350
+ payload: errorPayload
3351
+ } : {}));
3346
3352
  console.error("[AD-ERROR]", errorMessage, errorPayload || "");
3347
3353
  _this.adLayer.stop().catch(function() {});
3348
3354
  _this.handleAdFailure();
@@ -3784,6 +3790,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3784
3790
  value: function onScte35Marker(marker) {
3785
3791
  var _this = this;
3786
3792
  if (this.config.disableAds) return;
3793
+ this.pushScteMarker(marker);
3794
+ this.pushDebugLog("info", "scte35", "SCTE-35 marker detected", {
3795
+ type: marker.type,
3796
+ ptsSeconds: marker.ptsSeconds,
3797
+ durationSeconds: marker.durationSeconds,
3798
+ currentTime: this.video.currentTime
3799
+ });
3787
3800
  if (this.config.debugAdTiming) {
3788
3801
  console.log("[StormcloudVideoPlayer] SCTE-35 marker detected:", {
3789
3802
  type: marker.type,
@@ -5652,6 +5665,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5652
5665
  if (!this.config.debugAdTiming) {
5653
5666
  return;
5654
5667
  }
5668
+ this.pushDebugLog("info", "ad-state", event, extra);
5655
5669
  console.log("[StormcloudVideoPlayer][AdState]", _object_spread({
5656
5670
  event: event,
5657
5671
  timestamp: /* @__PURE__ */ new Date().toISOString(),
@@ -5671,6 +5685,59 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5671
5685
  return Math.max(0, this.expectedAdBreakDurationMs - elapsed);
5672
5686
  }
5673
5687
  },
5688
+ {
5689
+ key: "pushScteMarker",
5690
+ value: function pushScteMarker(marker) {
5691
+ if (!this.config.debugAdTiming) return;
5692
+ this.scteMarkerHistory.push({
5693
+ timestampMs: Date.now(),
5694
+ marker: marker
5695
+ });
5696
+ if (this.scteMarkerHistory.length > DEBUG_HISTORY_LIMIT) {
5697
+ this.scteMarkerHistory = this.scteMarkerHistory.slice(-DEBUG_HISTORY_LIMIT);
5698
+ }
5699
+ }
5700
+ },
5701
+ {
5702
+ key: "pushDebugLog",
5703
+ value: function pushDebugLog(level, category, message, details) {
5704
+ if (!this.config.debugAdTiming) return;
5705
+ this.debugLogEntries.push(_object_spread({
5706
+ timestampMs: Date.now(),
5707
+ level: level,
5708
+ category: category,
5709
+ message: message
5710
+ }, details ? {
5711
+ details: details
5712
+ } : {}));
5713
+ if (this.debugLogEntries.length > DEBUG_HISTORY_LIMIT) {
5714
+ this.debugLogEntries = this.debugLogEntries.slice(-DEBUG_HISTORY_LIMIT);
5715
+ }
5716
+ }
5717
+ },
5718
+ {
5719
+ key: "getRecentScteMarkers",
5720
+ value: function getRecentScteMarkers() {
5721
+ return this.scteMarkerHistory.map(function(entry) {
5722
+ return _object_spread({
5723
+ timestampMs: entry.timestampMs,
5724
+ type: entry.marker.type
5725
+ }, entry.marker.ptsSeconds !== void 0 ? {
5726
+ ptsSeconds: entry.marker.ptsSeconds
5727
+ } : {}, entry.marker.durationSeconds !== void 0 ? {
5728
+ durationSeconds: entry.marker.durationSeconds
5729
+ } : {}, entry.marker.raw !== void 0 ? {
5730
+ raw: entry.marker.raw
5731
+ } : {});
5732
+ });
5733
+ }
5734
+ },
5735
+ {
5736
+ key: "getDebugLogs",
5737
+ value: function getDebugLogs() {
5738
+ return this.debugLogEntries.slice();
5739
+ }
5740
+ },
5674
5741
  {
5675
5742
  key: "toggleMute",
5676
5743
  value: function toggleMute() {
@@ -5916,6 +5983,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5916
5983
  (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
5917
5984
  (_this_adLayer = this.adLayer) === null || _this_adLayer === void 0 ? void 0 : _this_adLayer.destroy();
5918
5985
  this.consecutiveFailures = 0;
5986
+ this.debugLogEntries = [];
5987
+ this.scteMarkerHistory = [];
5919
5988
  }
5920
5989
  }
5921
5990
  ]);