stormcloud-video-player 0.7.4 → 0.7.5

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,5 @@
1
1
  import { Component } from 'react';
2
- import { S as StormcloudVideoPlayerConfig } from '../types-vCa10HuQ.cjs';
2
+ import { S as StormcloudVideoPlayerConfig } from '../types-ClqQZM3U.cjs';
3
3
 
4
4
  interface HlsPlayerProps extends StormcloudVideoPlayerConfig {
5
5
  onMount?: (player: any) => void;
@@ -579,8 +579,8 @@ var UNSUPPORTED_VIDEO_EXTENSIONS = [
579
579
  var REQUEST_TIMEOUT_MS = 5e3;
580
580
  var REQUEST_MAX_RETRIES = 3;
581
581
  var REQUEST_RETRY_BACKOFF_MS = 1500;
582
- var AD_LAYER_Z_INDEX = "2147483646";
583
- var COUNTDOWN_Z_INDEX = "2147483647";
582
+ var AD_LAYER_Z_INDEX = "30";
583
+ var COUNTDOWN_Z_INDEX = "31";
584
584
  var STALL_TIMEOUT_MS = 8e3;
585
585
  function getFileExtension(url) {
586
586
  try {
@@ -1284,7 +1284,7 @@ function createAdStormPlayer(contentVideo, options) {
1284
1284
  container.style.isolation = "isolate";
1285
1285
  var countdown = document.createElement("div");
1286
1286
  countdown.style.position = "absolute";
1287
- countdown.style.right = "12px";
1287
+ countdown.style.left = "12px";
1288
1288
  countdown.style.top = "12px";
1289
1289
  countdown.style.padding = "4px 8px";
1290
1290
  countdown.style.borderRadius = "4px";
@@ -1735,7 +1735,7 @@ function createAdStormPlayer(contentVideo, options) {
1735
1735
  container.style.isolation = "isolate";
1736
1736
  var countdown = document.createElement("div");
1737
1737
  countdown.style.position = "absolute";
1738
- countdown.style.right = "12px";
1738
+ countdown.style.left = "12px";
1739
1739
  countdown.style.top = "12px";
1740
1740
  countdown.style.padding = "4px 8px";
1741
1741
  countdown.style.borderRadius = "4px";
@@ -2831,6 +2831,7 @@ function getBrowserConfigOverrides() {
2831
2831
  return overrides;
2832
2832
  }
2833
2833
  // src/player/StormcloudVideoPlayer.ts
2834
+ var DEBUG_HISTORY_LIMIT = 120;
2834
2835
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2835
2836
  function StormcloudVideoPlayer(config) {
2836
2837
  _class_call_check(this, StormcloudVideoPlayer);
@@ -2873,6 +2874,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2873
2874
  this.adRequestMaxRetries = 3;
2874
2875
  this.adRequestRetryBackoffMs = 1500;
2875
2876
  this.preloadedTokens = [];
2877
+ this.debugLogEntries = [];
2878
+ this.scteMarkerHistory = [];
2876
2879
  initializePolyfills();
2877
2880
  var browserOverrides = getBrowserConfigOverrides();
2878
2881
  this.config = _object_spread({}, browserOverrides, config);
@@ -3379,6 +3382,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3379
3382
  errorMessage += ". Caused by: ".concat(causeMessage);
3380
3383
  }
3381
3384
  }
3385
+ _this.pushDebugLog("error", "ad", errorMessage, _object_spread({}, errorPayload ? {
3386
+ payload: errorPayload
3387
+ } : {}));
3382
3388
  console.error("[AD-ERROR]", errorMessage, errorPayload || "");
3383
3389
  _this.adLayer.stop().catch(function() {});
3384
3390
  _this.handleAdFailure();
@@ -3820,6 +3826,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3820
3826
  value: function onScte35Marker(marker) {
3821
3827
  var _this = this;
3822
3828
  if (this.config.disableAds) return;
3829
+ this.pushScteMarker(marker);
3830
+ this.pushDebugLog("info", "scte35", "SCTE-35 marker detected", {
3831
+ type: marker.type,
3832
+ ptsSeconds: marker.ptsSeconds,
3833
+ durationSeconds: marker.durationSeconds,
3834
+ currentTime: this.video.currentTime
3835
+ });
3823
3836
  if (this.config.debugAdTiming) {
3824
3837
  console.log("[StormcloudVideoPlayer] SCTE-35 marker detected:", {
3825
3838
  type: marker.type,
@@ -5688,6 +5701,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5688
5701
  if (!this.config.debugAdTiming) {
5689
5702
  return;
5690
5703
  }
5704
+ this.pushDebugLog("info", "ad-state", event, extra);
5691
5705
  console.log("[StormcloudVideoPlayer][AdState]", _object_spread({
5692
5706
  event: event,
5693
5707
  timestamp: /* @__PURE__ */ new Date().toISOString(),
@@ -5707,6 +5721,59 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5707
5721
  return Math.max(0, this.expectedAdBreakDurationMs - elapsed);
5708
5722
  }
5709
5723
  },
5724
+ {
5725
+ key: "pushScteMarker",
5726
+ value: function pushScteMarker(marker) {
5727
+ if (!this.config.debugAdTiming) return;
5728
+ this.scteMarkerHistory.push({
5729
+ timestampMs: Date.now(),
5730
+ marker: marker
5731
+ });
5732
+ if (this.scteMarkerHistory.length > DEBUG_HISTORY_LIMIT) {
5733
+ this.scteMarkerHistory = this.scteMarkerHistory.slice(-DEBUG_HISTORY_LIMIT);
5734
+ }
5735
+ }
5736
+ },
5737
+ {
5738
+ key: "pushDebugLog",
5739
+ value: function pushDebugLog(level, category, message, details) {
5740
+ if (!this.config.debugAdTiming) return;
5741
+ this.debugLogEntries.push(_object_spread({
5742
+ timestampMs: Date.now(),
5743
+ level: level,
5744
+ category: category,
5745
+ message: message
5746
+ }, details ? {
5747
+ details: details
5748
+ } : {}));
5749
+ if (this.debugLogEntries.length > DEBUG_HISTORY_LIMIT) {
5750
+ this.debugLogEntries = this.debugLogEntries.slice(-DEBUG_HISTORY_LIMIT);
5751
+ }
5752
+ }
5753
+ },
5754
+ {
5755
+ key: "getRecentScteMarkers",
5756
+ value: function getRecentScteMarkers() {
5757
+ return this.scteMarkerHistory.map(function(entry) {
5758
+ return _object_spread({
5759
+ timestampMs: entry.timestampMs,
5760
+ type: entry.marker.type
5761
+ }, entry.marker.ptsSeconds !== void 0 ? {
5762
+ ptsSeconds: entry.marker.ptsSeconds
5763
+ } : {}, entry.marker.durationSeconds !== void 0 ? {
5764
+ durationSeconds: entry.marker.durationSeconds
5765
+ } : {}, entry.marker.raw !== void 0 ? {
5766
+ raw: entry.marker.raw
5767
+ } : {});
5768
+ });
5769
+ }
5770
+ },
5771
+ {
5772
+ key: "getDebugLogs",
5773
+ value: function getDebugLogs() {
5774
+ return this.debugLogEntries.slice();
5775
+ }
5776
+ },
5710
5777
  {
5711
5778
  key: "toggleMute",
5712
5779
  value: function toggleMute() {
@@ -5952,6 +6019,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5952
6019
  (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
5953
6020
  (_this_adLayer = this.adLayer) === null || _this_adLayer === void 0 ? void 0 : _this_adLayer.destroy();
5954
6021
  this.consecutiveFailures = 0;
6022
+ this.debugLogEntries = [];
6023
+ this.scteMarkerHistory = [];
5955
6024
  }
5956
6025
  }
5957
6026
  ]);