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
package/lib/index.cjs CHANGED
@@ -464,6 +464,9 @@ __export(index_exports, {
464
464
  applyMQTTConfig: function applyMQTTConfig1() {
465
465
  return applyMQTTConfig;
466
466
  },
467
+ buildAnalyticsContext: function buildAnalyticsContext1() {
468
+ return buildAnalyticsContext;
469
+ },
467
470
  buildMQTTBrokerUrl: function buildMQTTBrokerUrl1() {
468
471
  return buildMQTTBrokerUrl;
469
472
  },
@@ -2204,6 +2207,16 @@ function normalizeBoolean(value) {
2204
2207
  }
2205
2208
  // src/utils/tracking.ts
2206
2209
  var cachedBrowserId = null;
2210
+ function buildAnalyticsContext(config) {
2211
+ var context = {};
2212
+ if (config.debugAdTiming) {
2213
+ context.debugAdTiming = true;
2214
+ }
2215
+ if (config.isLiveStream !== void 0) {
2216
+ context.inputStreamType = config.isLiveStream ? "live" : "vod";
2217
+ }
2218
+ return context;
2219
+ }
2207
2220
  function getClientInfo() {
2208
2221
  var _screen, _screen1, _screen2, _screen3, _screen_orientation, _screen4, _screen5, _window, _window1, _window_screen_orientation, _window_screen, _navigator_languages;
2209
2222
  var ua = navigator.userAgent;
@@ -2462,19 +2475,26 @@ function canPublish(licenseKey) {
2462
2475
  }
2463
2476
  function buildPlayerMetricEvent() {
2464
2477
  return _async_to_generator(function() {
2465
- var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, playerId, captureAt;
2478
+ var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, debugAdTiming, playerId, captureAt;
2466
2479
  var _arguments = arguments;
2467
2480
  return _ts_generator(this, function(_state) {
2468
2481
  switch(_state.label){
2469
2482
  case 0:
2470
2483
  context = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, flags = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
2471
2484
  clientInfo = getClientInfo();
2485
+ debugAdTiming = !!context.debugAdTiming;
2486
+ if (debugAdTiming) {
2487
+ console.log("[StormcloudVideoPlayer] clientInfo: ", JSON.stringify(clientInfo, null, 2));
2488
+ }
2472
2489
  return [
2473
2490
  4,
2474
2491
  getBrowserID(clientInfo)
2475
2492
  ];
2476
2493
  case 1:
2477
2494
  playerId = _state.sent();
2495
+ if (debugAdTiming) {
2496
+ console.log("[StormcloudVideoPlayer] playerId: ", playerId);
2497
+ }
2478
2498
  captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
2479
2499
  return [
2480
2500
  2,
@@ -5141,7 +5161,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
5141
5161
  key: "initializeTracking",
5142
5162
  value: function initializeTracking() {
5143
5163
  var _this = this;
5144
- sendInitialTracking(this.config.licenseKey).then(function() {
5164
+ sendInitialTracking(this.config.licenseKey, buildAnalyticsContext(this.config)).then(function() {
5145
5165
  _this.heartbeatInterval = window.setInterval(function() {
5146
5166
  _this.sendHeartbeatIfNeeded();
5147
5167
  }, 5e3);
@@ -5162,7 +5182,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
5162
5182
  var now = Date.now();
5163
5183
  if (!this.lastHeartbeatTime || now - this.lastHeartbeatTime > 3e4) {
5164
5184
  this.lastHeartbeatTime = now;
5165
- sendHeartbeat(this.config.licenseKey).catch(function(error) {
5185
+ sendHeartbeat(this.config.licenseKey, buildAnalyticsContext(this.config)).catch(function(error) {
5166
5186
  if (_this.debug) {
5167
5187
  console.warn("[StormcloudVideoPlayer] Failed to send heartbeat:", error);
5168
5188
  }
@@ -6942,6 +6962,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
6942
6962
  return !!this.host.config.debugAdTiming;
6943
6963
  }
6944
6964
  },
6965
+ {
6966
+ key: "analyticsContext",
6967
+ get: function get() {
6968
+ return buildAnalyticsContext(this.host.config);
6969
+ }
6970
+ },
6945
6971
  {
6946
6972
  // ───────────────────────────────────────────────────────────────
6947
6973
  // IMA event listeners
@@ -6955,7 +6981,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
6955
6981
  source: "hls",
6956
6982
  adIndex: _this.timing.currentAdIndex,
6957
6983
  timestamp: /* @__PURE__ */ new Date().toISOString()
6958
- }).catch(function() {});
6984
+ }, _this.analyticsContext).catch(function() {});
6959
6985
  _this.timing.recordPlayedAdDuration(_this.host.getAdPlayer());
6960
6986
  var remaining = _this.timing.getRemainingAdMs();
6961
6987
  _this.timing.consecutiveFailures = 0;
@@ -7017,7 +7043,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7017
7043
  source: "hls",
7018
7044
  adIndex: _this.timing.currentAdIndex,
7019
7045
  timestamp: /* @__PURE__ */ new Date().toISOString()
7020
- }).catch(function() {});
7046
+ }, _this.analyticsContext).catch(function() {});
7021
7047
  if (!_this.host.video.muted) {
7022
7048
  _this.host.video.muted = true;
7023
7049
  if (_this.debug) {
@@ -7164,7 +7190,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7164
7190
  source: "hls",
7165
7191
  vastUrl: firstAdUrl,
7166
7192
  timestamp: /* @__PURE__ */ new Date().toISOString()
7167
- }).catch(function() {});
7193
+ }, this.analyticsContext).catch(function() {});
7168
7194
  if (this.debug) {
7169
7195
  console.log("[CONTINUOUS-FETCH] Using preloaded ad from pool (preloaded in advance, ready immediately!)");
7170
7196
  }
@@ -7278,7 +7304,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7278
7304
  source: "hls",
7279
7305
  vastUrl: firstAdUrl,
7280
7306
  timestamp: /* @__PURE__ */ new Date().toISOString()
7281
- }).catch(function() {});
7307
+ }, this.analyticsContext).catch(function() {});
7282
7308
  if (this.debug) {
7283
7309
  console.log("[CONTINUOUS-FETCH] First ad request successful, starting playback");
7284
7310
  }
@@ -7742,7 +7768,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7742
7768
  source: "hls",
7743
7769
  vastUrl: preloaded.vastUrl,
7744
7770
  timestamp: /* @__PURE__ */ new Date().toISOString()
7745
- }).catch(function() {});
7771
+ }, this.analyticsContext).catch(function() {});
7746
7772
  _state.label = 1;
7747
7773
  case 1:
7748
7774
  _state.trys.push([
@@ -7975,7 +8001,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7975
8001
  source: "hls",
7976
8002
  vastUrl: vastTagUrl,
7977
8003
  timestamp: /* @__PURE__ */ new Date().toISOString()
7978
- }).catch(function() {});
8004
+ }, this.analyticsContext).catch(function() {});
7979
8005
  this.timing.clearAdRequestWatchdog();
7980
8006
  if (this.timing.activeAdRequestToken !== requestToken) return [
7981
8007
  2
@@ -8767,7 +8793,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8767
8793
  sendAdDetectTracking(this.config.licenseKey, _object_spread({
8768
8794
  source: "scte35",
8769
8795
  timestamp: /* @__PURE__ */ new Date().toISOString()
8770
- }, detectPayload)).catch(function() {});
8796
+ }, detectPayload), buildAnalyticsContext(this.config)).catch(function() {});
8771
8797
  }
8772
8798
  var hasPrefetchedAds = this.adBreak.pendingAdBreak && this.adBreak.pendingAdBreak.vastUrls.length > 0;
8773
8799
  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;
@@ -8940,7 +8966,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8940
8966
  sendAdDetectTracking(this.config.licenseKey, _object_spread({
8941
8967
  source: "scte35",
8942
8968
  timestamp: /* @__PURE__ */ new Date().toISOString()
8943
- }, detectPayload)).catch(function() {});
8969
+ }, detectPayload), buildAnalyticsContext(this.config)).catch(function() {});
8944
8970
  if (this.debug) {
8945
8971
  console.log("[PREFETCH] Starting ad prefetch for upcoming ad break");
8946
8972
  console.log("[PREFETCH] Pre-generated ".concat(generatedUrls.length, " VAST URLs"));
@@ -11752,6 +11778,7 @@ var StormcloudPlayer_default = StormcloudPlayer;
11752
11778
  StormcloudVideoPlayer: StormcloudVideoPlayer,
11753
11779
  StormcloudVideoPlayerComponent: StormcloudVideoPlayerComponent,
11754
11780
  applyMQTTConfig: applyMQTTConfig,
11781
+ buildAnalyticsContext: buildAnalyticsContext,
11755
11782
  buildMQTTBrokerUrl: buildMQTTBrokerUrl,
11756
11783
  buildPlayerTopic: buildPlayerTopic,
11757
11784
  canPlay: canPlay,