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 StormcloudVideoPlayerConfig } from '../types-DNiBmPKK.cjs';
1
+ import { a as StormcloudVideoPlayerConfig } from '../types-Bz4aRmzc.cjs';
2
2
 
3
3
  declare class StormcloudVideoPlayer {
4
4
  private readonly video;
@@ -1,4 +1,4 @@
1
- import { S as Scte35Marker } from '../types-DNiBmPKK.cjs';
1
+ import { S as Scte35Marker } from '../types-Bz4aRmzc.cjs';
2
2
 
3
3
  type Scte35CueSource = "manifest" | "id3" | "ts";
4
4
  type Scte35CueReadiness = "early" | "playback";
@@ -1996,6 +1996,16 @@ function normalizeBoolean(value) {
1996
1996
  }
1997
1997
  // src/utils/tracking.ts
1998
1998
  var cachedBrowserId = null;
1999
+ function buildAnalyticsContext(config) {
2000
+ var context = {};
2001
+ if (config.debugAdTiming) {
2002
+ context.debugAdTiming = true;
2003
+ }
2004
+ if (config.isLiveStream !== void 0) {
2005
+ context.inputStreamType = config.isLiveStream ? "live" : "vod";
2006
+ }
2007
+ return context;
2008
+ }
1999
2009
  function getClientInfo() {
2000
2010
  var _screen, _screen1, _screen2, _screen3, _screen_orientation, _screen4, _screen5, _window, _window1, _window_screen_orientation, _window_screen, _navigator_languages;
2001
2011
  var ua = navigator.userAgent;
@@ -2254,19 +2264,26 @@ function canPublish(licenseKey) {
2254
2264
  }
2255
2265
  function buildPlayerMetricEvent() {
2256
2266
  return _async_to_generator(function() {
2257
- var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, playerId, captureAt;
2267
+ var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, debugAdTiming, playerId, captureAt;
2258
2268
  var _arguments = arguments;
2259
2269
  return _ts_generator(this, function(_state) {
2260
2270
  switch(_state.label){
2261
2271
  case 0:
2262
2272
  context = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, flags = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
2263
2273
  clientInfo = getClientInfo();
2274
+ debugAdTiming = !!context.debugAdTiming;
2275
+ if (debugAdTiming) {
2276
+ console.log("[StormcloudVideoPlayer] clientInfo: ", JSON.stringify(clientInfo, null, 2));
2277
+ }
2264
2278
  return [
2265
2279
  4,
2266
2280
  getBrowserID(clientInfo)
2267
2281
  ];
2268
2282
  case 1:
2269
2283
  playerId = _state.sent();
2284
+ if (debugAdTiming) {
2285
+ console.log("[StormcloudVideoPlayer] playerId: ", playerId);
2286
+ }
2270
2287
  captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
2271
2288
  return [
2272
2289
  2,
@@ -4910,7 +4927,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
4910
4927
  key: "initializeTracking",
4911
4928
  value: function initializeTracking() {
4912
4929
  var _this = this;
4913
- sendInitialTracking(this.config.licenseKey).then(function() {
4930
+ sendInitialTracking(this.config.licenseKey, buildAnalyticsContext(this.config)).then(function() {
4914
4931
  _this.heartbeatInterval = window.setInterval(function() {
4915
4932
  _this.sendHeartbeatIfNeeded();
4916
4933
  }, 5e3);
@@ -4931,7 +4948,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
4931
4948
  var now = Date.now();
4932
4949
  if (!this.lastHeartbeatTime || now - this.lastHeartbeatTime > 3e4) {
4933
4950
  this.lastHeartbeatTime = now;
4934
- sendHeartbeat(this.config.licenseKey).catch(function(error) {
4951
+ sendHeartbeat(this.config.licenseKey, buildAnalyticsContext(this.config)).catch(function(error) {
4935
4952
  if (_this.debug) {
4936
4953
  console.warn("[StormcloudVideoPlayer] Failed to send heartbeat:", error);
4937
4954
  }
@@ -6711,6 +6728,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
6711
6728
  return !!this.host.config.debugAdTiming;
6712
6729
  }
6713
6730
  },
6731
+ {
6732
+ key: "analyticsContext",
6733
+ get: function get() {
6734
+ return buildAnalyticsContext(this.host.config);
6735
+ }
6736
+ },
6714
6737
  {
6715
6738
  // ───────────────────────────────────────────────────────────────
6716
6739
  // IMA event listeners
@@ -6724,7 +6747,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
6724
6747
  source: "hls",
6725
6748
  adIndex: _this.timing.currentAdIndex,
6726
6749
  timestamp: /* @__PURE__ */ new Date().toISOString()
6727
- }).catch(function() {});
6750
+ }, _this.analyticsContext).catch(function() {});
6728
6751
  _this.timing.recordPlayedAdDuration(_this.host.getAdPlayer());
6729
6752
  var remaining = _this.timing.getRemainingAdMs();
6730
6753
  _this.timing.consecutiveFailures = 0;
@@ -6786,7 +6809,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
6786
6809
  source: "hls",
6787
6810
  adIndex: _this.timing.currentAdIndex,
6788
6811
  timestamp: /* @__PURE__ */ new Date().toISOString()
6789
- }).catch(function() {});
6812
+ }, _this.analyticsContext).catch(function() {});
6790
6813
  if (!_this.host.video.muted) {
6791
6814
  _this.host.video.muted = true;
6792
6815
  if (_this.debug) {
@@ -6933,7 +6956,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
6933
6956
  source: "hls",
6934
6957
  vastUrl: firstAdUrl,
6935
6958
  timestamp: /* @__PURE__ */ new Date().toISOString()
6936
- }).catch(function() {});
6959
+ }, this.analyticsContext).catch(function() {});
6937
6960
  if (this.debug) {
6938
6961
  console.log("[CONTINUOUS-FETCH] Using preloaded ad from pool (preloaded in advance, ready immediately!)");
6939
6962
  }
@@ -7047,7 +7070,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7047
7070
  source: "hls",
7048
7071
  vastUrl: firstAdUrl,
7049
7072
  timestamp: /* @__PURE__ */ new Date().toISOString()
7050
- }).catch(function() {});
7073
+ }, this.analyticsContext).catch(function() {});
7051
7074
  if (this.debug) {
7052
7075
  console.log("[CONTINUOUS-FETCH] First ad request successful, starting playback");
7053
7076
  }
@@ -7511,7 +7534,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7511
7534
  source: "hls",
7512
7535
  vastUrl: preloaded.vastUrl,
7513
7536
  timestamp: /* @__PURE__ */ new Date().toISOString()
7514
- }).catch(function() {});
7537
+ }, this.analyticsContext).catch(function() {});
7515
7538
  _state.label = 1;
7516
7539
  case 1:
7517
7540
  _state.trys.push([
@@ -7744,7 +7767,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7744
7767
  source: "hls",
7745
7768
  vastUrl: vastTagUrl,
7746
7769
  timestamp: /* @__PURE__ */ new Date().toISOString()
7747
- }).catch(function() {});
7770
+ }, this.analyticsContext).catch(function() {});
7748
7771
  this.timing.clearAdRequestWatchdog();
7749
7772
  if (this.timing.activeAdRequestToken !== requestToken) return [
7750
7773
  2
@@ -8536,7 +8559,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8536
8559
  sendAdDetectTracking(this.config.licenseKey, _object_spread({
8537
8560
  source: "scte35",
8538
8561
  timestamp: /* @__PURE__ */ new Date().toISOString()
8539
- }, detectPayload)).catch(function() {});
8562
+ }, detectPayload), buildAnalyticsContext(this.config)).catch(function() {});
8540
8563
  }
8541
8564
  var hasPrefetchedAds = this.adBreak.pendingAdBreak && this.adBreak.pendingAdBreak.vastUrls.length > 0;
8542
8565
  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;
@@ -8709,7 +8732,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8709
8732
  sendAdDetectTracking(this.config.licenseKey, _object_spread({
8710
8733
  source: "scte35",
8711
8734
  timestamp: /* @__PURE__ */ new Date().toISOString()
8712
- }, detectPayload)).catch(function() {});
8735
+ }, detectPayload), buildAnalyticsContext(this.config)).catch(function() {});
8713
8736
  if (this.debug) {
8714
8737
  console.log("[PREFETCH] Starting ad prefetch for upcoming ad break");
8715
8738
  console.log("[PREFETCH] Pre-generated ".concat(generatedUrls.length, " VAST URLs"));