stormcloud-video-player 0.8.24 → 0.8.25

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.
Files changed (37) hide show
  1. package/dist/stormcloud-vp.min.js +1 -1
  2. package/lib/index.cjs +38 -11
  3. package/lib/index.cjs.map +1 -1
  4. package/lib/index.d.cts +3 -1
  5. package/lib/index.d.ts +3 -1
  6. package/lib/index.js +35 -12
  7. package/lib/index.js.map +1 -1
  8. package/lib/player/AdBreakOrchestrator.cjs +30 -7
  9. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  10. package/lib/player/AdBreakOrchestrator.d.cts +2 -1
  11. package/lib/player/AdConfigManager.cjs +20 -3
  12. package/lib/player/AdConfigManager.cjs.map +1 -1
  13. package/lib/player/AdConfigManager.d.cts +1 -1
  14. package/lib/player/AdPreloadPool.d.cts +1 -1
  15. package/lib/player/AdTimingService.d.cts +1 -1
  16. package/lib/player/HlsEngine.d.cts +1 -1
  17. package/lib/player/PlayerControls.d.cts +1 -1
  18. package/lib/player/Scte35CueManager.d.cts +1 -1
  19. package/lib/player/Scte35Parser.d.cts +1 -1
  20. package/lib/player/StormcloudVideoPlayer.cjs +34 -11
  21. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  22. package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
  23. package/lib/player/playerTypes.d.cts +1 -1
  24. package/lib/players/HlsPlayer.cjs +34 -11
  25. package/lib/players/HlsPlayer.cjs.map +1 -1
  26. package/lib/players/HlsPlayer.d.cts +1 -1
  27. package/lib/players/index.cjs +34 -11
  28. package/lib/players/index.cjs.map +1 -1
  29. package/lib/sdk/hlsAdPlayer.d.cts +1 -1
  30. package/lib/{types-DNiBmPKK.d.cts → types-Bz4aRmzc.d.cts} +1 -0
  31. package/lib/ui/StormcloudVideoPlayer.cjs +34 -11
  32. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  33. package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
  34. package/lib/utils/tracking.cjs +22 -1
  35. package/lib/utils/tracking.cjs.map +1 -1
  36. package/lib/utils/tracking.d.cts +3 -2
  37. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { A as AdController } from '../types-DNiBmPKK.cjs';
1
+ import { A as AdController } from '../types-Bz4aRmzc.cjs';
2
2
  import Hls from 'hls.js';
3
3
 
4
4
  declare function createHlsAdPlayer(contentVideo: HTMLVideoElement, options?: {
@@ -101,6 +101,7 @@ interface ClientInfo {
101
101
  }
102
102
  interface PlayerAnalyticsContext {
103
103
  inputStreamType?: string;
104
+ debugAdTiming?: boolean;
104
105
  }
105
106
  interface AdDetectInfo {
106
107
  source: "scte35";
@@ -1982,6 +1982,16 @@ function normalizeBoolean(value) {
1982
1982
  }
1983
1983
  // src/utils/tracking.ts
1984
1984
  var cachedBrowserId = null;
1985
+ function buildAnalyticsContext(config) {
1986
+ var context = {};
1987
+ if (config.debugAdTiming) {
1988
+ context.debugAdTiming = true;
1989
+ }
1990
+ if (config.isLiveStream !== void 0) {
1991
+ context.inputStreamType = config.isLiveStream ? "live" : "vod";
1992
+ }
1993
+ return context;
1994
+ }
1985
1995
  function getClientInfo() {
1986
1996
  var _screen, _screen1, _screen2, _screen3, _screen_orientation, _screen4, _screen5, _window, _window1, _window_screen_orientation, _window_screen, _navigator_languages;
1987
1997
  var ua = navigator.userAgent;
@@ -2240,19 +2250,26 @@ function canPublish(licenseKey) {
2240
2250
  }
2241
2251
  function buildPlayerMetricEvent() {
2242
2252
  return _async_to_generator(function() {
2243
- var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, playerId, captureAt;
2253
+ var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, debugAdTiming, playerId, captureAt;
2244
2254
  var _arguments = arguments;
2245
2255
  return _ts_generator(this, function(_state) {
2246
2256
  switch(_state.label){
2247
2257
  case 0:
2248
2258
  context = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, flags = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
2249
2259
  clientInfo = getClientInfo();
2260
+ debugAdTiming = !!context.debugAdTiming;
2261
+ if (debugAdTiming) {
2262
+ console.log("[StormcloudVideoPlayer] clientInfo: ", JSON.stringify(clientInfo, null, 2));
2263
+ }
2250
2264
  return [
2251
2265
  4,
2252
2266
  getBrowserID(clientInfo)
2253
2267
  ];
2254
2268
  case 1:
2255
2269
  playerId = _state.sent();
2270
+ if (debugAdTiming) {
2271
+ console.log("[StormcloudVideoPlayer] playerId: ", playerId);
2272
+ }
2256
2273
  captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
2257
2274
  return [
2258
2275
  2,
@@ -4896,7 +4913,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
4896
4913
  key: "initializeTracking",
4897
4914
  value: function initializeTracking() {
4898
4915
  var _this = this;
4899
- sendInitialTracking(this.config.licenseKey).then(function() {
4916
+ sendInitialTracking(this.config.licenseKey, buildAnalyticsContext(this.config)).then(function() {
4900
4917
  _this.heartbeatInterval = window.setInterval(function() {
4901
4918
  _this.sendHeartbeatIfNeeded();
4902
4919
  }, 5e3);
@@ -4917,7 +4934,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
4917
4934
  var now = Date.now();
4918
4935
  if (!this.lastHeartbeatTime || now - this.lastHeartbeatTime > 3e4) {
4919
4936
  this.lastHeartbeatTime = now;
4920
- sendHeartbeat(this.config.licenseKey).catch(function(error) {
4937
+ sendHeartbeat(this.config.licenseKey, buildAnalyticsContext(this.config)).catch(function(error) {
4921
4938
  if (_this.debug) {
4922
4939
  console.warn("[StormcloudVideoPlayer] Failed to send heartbeat:", error);
4923
4940
  }
@@ -6697,6 +6714,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
6697
6714
  return !!this.host.config.debugAdTiming;
6698
6715
  }
6699
6716
  },
6717
+ {
6718
+ key: "analyticsContext",
6719
+ get: function get() {
6720
+ return buildAnalyticsContext(this.host.config);
6721
+ }
6722
+ },
6700
6723
  {
6701
6724
  // ───────────────────────────────────────────────────────────────
6702
6725
  // IMA event listeners
@@ -6710,7 +6733,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
6710
6733
  source: "hls",
6711
6734
  adIndex: _this.timing.currentAdIndex,
6712
6735
  timestamp: /* @__PURE__ */ new Date().toISOString()
6713
- }).catch(function() {});
6736
+ }, _this.analyticsContext).catch(function() {});
6714
6737
  _this.timing.recordPlayedAdDuration(_this.host.getAdPlayer());
6715
6738
  var remaining = _this.timing.getRemainingAdMs();
6716
6739
  _this.timing.consecutiveFailures = 0;
@@ -6772,7 +6795,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
6772
6795
  source: "hls",
6773
6796
  adIndex: _this.timing.currentAdIndex,
6774
6797
  timestamp: /* @__PURE__ */ new Date().toISOString()
6775
- }).catch(function() {});
6798
+ }, _this.analyticsContext).catch(function() {});
6776
6799
  if (!_this.host.video.muted) {
6777
6800
  _this.host.video.muted = true;
6778
6801
  if (_this.debug) {
@@ -6919,7 +6942,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
6919
6942
  source: "hls",
6920
6943
  vastUrl: firstAdUrl,
6921
6944
  timestamp: /* @__PURE__ */ new Date().toISOString()
6922
- }).catch(function() {});
6945
+ }, this.analyticsContext).catch(function() {});
6923
6946
  if (this.debug) {
6924
6947
  console.log("[CONTINUOUS-FETCH] Using preloaded ad from pool (preloaded in advance, ready immediately!)");
6925
6948
  }
@@ -7033,7 +7056,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7033
7056
  source: "hls",
7034
7057
  vastUrl: firstAdUrl,
7035
7058
  timestamp: /* @__PURE__ */ new Date().toISOString()
7036
- }).catch(function() {});
7059
+ }, this.analyticsContext).catch(function() {});
7037
7060
  if (this.debug) {
7038
7061
  console.log("[CONTINUOUS-FETCH] First ad request successful, starting playback");
7039
7062
  }
@@ -7497,7 +7520,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7497
7520
  source: "hls",
7498
7521
  vastUrl: preloaded.vastUrl,
7499
7522
  timestamp: /* @__PURE__ */ new Date().toISOString()
7500
- }).catch(function() {});
7523
+ }, this.analyticsContext).catch(function() {});
7501
7524
  _state.label = 1;
7502
7525
  case 1:
7503
7526
  _state.trys.push([
@@ -7730,7 +7753,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7730
7753
  source: "hls",
7731
7754
  vastUrl: vastTagUrl,
7732
7755
  timestamp: /* @__PURE__ */ new Date().toISOString()
7733
- }).catch(function() {});
7756
+ }, this.analyticsContext).catch(function() {});
7734
7757
  this.timing.clearAdRequestWatchdog();
7735
7758
  if (this.timing.activeAdRequestToken !== requestToken) return [
7736
7759
  2
@@ -8522,7 +8545,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8522
8545
  sendAdDetectTracking(this.config.licenseKey, _object_spread({
8523
8546
  source: "scte35",
8524
8547
  timestamp: /* @__PURE__ */ new Date().toISOString()
8525
- }, detectPayload)).catch(function() {});
8548
+ }, detectPayload), buildAnalyticsContext(this.config)).catch(function() {});
8526
8549
  }
8527
8550
  var hasPrefetchedAds = this.adBreak.pendingAdBreak && this.adBreak.pendingAdBreak.vastUrls.length > 0;
8528
8551
  var durationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : ((_this_adBreak_pendingAdBreak = this.adBreak.pendingAdBreak) === null || _this_adBreak_pendingAdBreak === void 0 ? void 0 : _this_adBreak_pendingAdBreak.marker.durationSeconds) != null ? this.adBreak.pendingAdBreak.marker.durationSeconds * 1e3 : void 0;
@@ -8695,7 +8718,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8695
8718
  sendAdDetectTracking(this.config.licenseKey, _object_spread({
8696
8719
  source: "scte35",
8697
8720
  timestamp: /* @__PURE__ */ new Date().toISOString()
8698
- }, detectPayload)).catch(function() {});
8721
+ }, detectPayload), buildAnalyticsContext(this.config)).catch(function() {});
8699
8722
  if (this.debug) {
8700
8723
  console.log("[PREFETCH] Starting ad prefetch for upcoming ad break");
8701
8724
  console.log("[PREFETCH] Pre-generated ".concat(generatedUrls.length, " VAST URLs"));