stormcloud-video-player 0.8.57 → 0.8.59

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 (42) hide show
  1. package/dist/stormcloud-vp.min.js +1 -1
  2. package/lib/index.cjs +57 -81
  3. package/lib/index.cjs.map +1 -1
  4. package/lib/index.d.cts +1 -0
  5. package/lib/index.d.ts +1 -0
  6. package/lib/index.js +57 -81
  7. package/lib/index.js.map +1 -1
  8. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  9. package/lib/player/AdBreakOrchestrator.d.cts +1 -1
  10. package/lib/player/AdConfigManager.cjs +47 -76
  11. package/lib/player/AdConfigManager.cjs.map +1 -1
  12. package/lib/player/AdConfigManager.d.cts +2 -1
  13. package/lib/player/AdTimingService.d.cts +1 -1
  14. package/lib/player/HlsEngine.d.cts +1 -1
  15. package/lib/player/PlayerControls.d.cts +1 -1
  16. package/lib/player/Scte35CueManager.d.cts +1 -1
  17. package/lib/player/Scte35Parser.d.cts +1 -1
  18. package/lib/player/StormcloudVideoPlayer.cjs +53 -79
  19. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  20. package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
  21. package/lib/player/playerTypes.d.cts +1 -1
  22. package/lib/players/HlsPlayer.cjs +53 -79
  23. package/lib/players/HlsPlayer.cjs.map +1 -1
  24. package/lib/players/HlsPlayer.d.cts +1 -1
  25. package/lib/players/index.cjs +53 -79
  26. package/lib/players/index.cjs.map +1 -1
  27. package/lib/sdk/hlsAdPlayer.d.cts +1 -1
  28. package/lib/{types-cTqIKw_D.d.cts → types-52ASml2N.d.cts} +1 -0
  29. package/lib/ui/StormcloudVideoPlayer.cjs +57 -81
  30. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  31. package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
  32. package/lib/utils/ctvVastSignals.cjs +30 -36
  33. package/lib/utils/ctvVastSignals.cjs.map +1 -1
  34. package/lib/utils/tracking.cjs.map +1 -1
  35. package/lib/utils/tracking.d.cts +1 -1
  36. package/lib/utils/vastEnvironmentSignals.cjs +16 -36
  37. package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
  38. package/lib/utils/vastEnvironmentSignals.d.cts +0 -3
  39. package/lib/utils/vastMacros.cjs +13 -34
  40. package/lib/utils/vastMacros.cjs.map +1 -1
  41. package/lib/utils/vastMacros.d.cts +1 -3
  42. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { Component } from 'react';
2
- import { a as StormcloudVideoPlayerConfig } from '../types-cTqIKw_D.cjs';
2
+ import { a as StormcloudVideoPlayerConfig } from '../types-52ASml2N.cjs';
3
3
 
4
4
  interface HlsPlayerProps extends StormcloudVideoPlayerConfig {
5
5
  onMount?: (player: any) => void;
@@ -2580,34 +2580,8 @@ function ingestPlayerTracking(licenseKey, channel, body) {
2580
2580
  })();
2581
2581
  }
2582
2582
  // src/utils/vastEnvironmentSignals.ts
2583
- var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
2584
- var AIRY_WEBOS_APP_ID = "com.freeairytv.webos";
2585
- var AIRY_TIZEN_APP_ID = "com.freeairytv.samsung";
2586
- var AIRY_ROKU_APP_ID = "com.freeairytv.roku";
2587
- var AIRY_APP_NAME = "AiryTV Movies & TV";
2588
- var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
2589
2583
  var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
2590
2584
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
2591
- var LG_TEST_APP_ID = "com.hulu.plus";
2592
- var LG_TEST_APP_NAME = "Hulu";
2593
- var LG_TEST_CONTENT_URL = "https://www.hulu.com/live-tv";
2594
- var _lgTestDeviceId;
2595
- function getLgTestDeviceId() {
2596
- if (!_lgTestDeviceId) _lgTestDeviceId = createUuid();
2597
- return _lgTestDeviceId;
2598
- }
2599
- function isLgWebOS() {
2600
- if (typeof navigator === "undefined") return false;
2601
- return /Web0S|webOS|LG Browser|LGSTB|LGE/i.test(navigator.userAgent);
2602
- }
2603
- function getDefaultAppId() {
2604
- if (typeof navigator === "undefined") return AIRY_ANDROID_APP_ID;
2605
- var ua = navigator.userAgent;
2606
- if (/Web0S|webOS|LG Browser|LGSTB|LGE/i.test(ua)) return AIRY_WEBOS_APP_ID;
2607
- if (/Tizen|Samsung/i.test(ua)) return AIRY_TIZEN_APP_ID;
2608
- if (/Roku/i.test(ua)) return AIRY_ROKU_APP_ID;
2609
- return AIRY_ANDROID_APP_ID;
2610
- }
2611
2585
  var DEVICE_ID_STORAGE_KEYS = [
2612
2586
  "rdid",
2613
2587
  "ifa",
@@ -2628,23 +2602,29 @@ function resolveVastEnvironmentSignals(isCtv) {
2628
2602
  var _ref;
2629
2603
  var bridgeSignals = readNativeBridgeSignals();
2630
2604
  var platformDevice = readPlatformNativeDeviceId();
2631
- var lg = isCtv && isLgWebOS();
2632
- var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId || (lg && platformDevice.limitAdTracking !== true ? getLgTestDeviceId() : void 0);
2633
- var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType() || (lg ? "lgudid" : void 0);
2605
+ var realDeviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId;
2606
+ var deviceId = realDeviceId;
2607
+ var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
2634
2608
  var platformLat = bridgeSignals.deviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
2635
2609
  var limitAdTracking = deviceId != null ? (_ref = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
2610
+ if (!deviceId && isCtv) {
2611
+ var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
2612
+ if (dpid) {
2613
+ var _ref1;
2614
+ deviceId = dpid;
2615
+ deviceIdType = "dpid";
2616
+ limitAdTracking = (_ref1 = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref1 !== void 0 ? _ref1 : false;
2617
+ }
2618
+ }
2636
2619
  if (isCtv) {
2637
2620
  return _object_spread_props(_object_spread({
2638
2621
  isCtv: true,
2639
- contentUrl: bridgeSignals.contentUrl || readStoredString("contentUrl") || (lg ? LG_TEST_CONTENT_URL : AIRY_DEFAULT_CONTENT_URL),
2640
- appId: bridgeSignals.appId || readStoredString("appId") || readStoredString("msid") || (lg ? LG_TEST_APP_ID : getDefaultAppId()),
2641
- appName: bridgeSignals.appName || readStoredString("appName") || readStoredString("an") || (lg ? LG_TEST_APP_NAME : AIRY_APP_NAME),
2642
2622
  sessionId: getOrCreateCtvSessionId()
2643
2623
  }, deviceId ? {
2644
2624
  deviceId: deviceId
2645
- } : {}, deviceIdType ? {
2625
+ } : {}, deviceId && deviceIdType ? {
2646
2626
  deviceIdType: deviceIdType
2647
- } : {}, limitAdTracking != null ? {
2627
+ } : {}, deviceId && limitAdTracking != null ? {
2648
2628
  limitAdTracking: limitAdTracking
2649
2629
  } : {}), {
2650
2630
  deviceTypeHint: 5
@@ -2654,9 +2634,9 @@ function resolveVastEnvironmentSignals(isCtv) {
2654
2634
  isCtv: false
2655
2635
  }, deviceId ? {
2656
2636
  deviceId: deviceId
2657
- } : {}, deviceIdType ? {
2637
+ } : {}, deviceId && deviceIdType ? {
2658
2638
  deviceIdType: deviceIdType
2659
- } : {}, limitAdTracking != null ? {
2639
+ } : {}, deviceId && limitAdTracking != null ? {
2660
2640
  limitAdTracking: limitAdTracking
2661
2641
  } : {});
2662
2642
  }
@@ -3916,7 +3896,6 @@ var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
3916
3896
  var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
3917
3897
  var EXAMPLE_COM_URL = /example\.com/i;
3918
3898
  var CTV_UNSUPPORTED_PARAMS = [
3919
- "description_url",
3920
3899
  "tfcd",
3921
3900
  "npa",
3922
3901
  "min_ad_duration",
@@ -4007,18 +3986,6 @@ var INLINE_DEVICE_MACRO_REPLACEMENTS = [
4007
3986
  return ctx.limitAdTracking != null ? ctx.limitAdTracking ? "1" : "0" : void 0;
4008
3987
  }
4009
3988
  },
4010
- {
4011
- pattern: /%%MSID%%/gi,
4012
- getValue: function getValue(ctx) {
4013
- return ctx.appId;
4014
- }
4015
- },
4016
- {
4017
- pattern: /%%APP_NAME%%/gi,
4018
- getValue: function getValue(ctx) {
4019
- return ctx.appName;
4020
- }
4021
- },
4022
3989
  {
4023
3990
  pattern: /%%SESSION_ID%%/gi,
4024
3991
  getValue: function getValue(ctx) {
@@ -4209,7 +4176,7 @@ function applyVastMacros(baseUrl, ctx) {
4209
4176
  return replaceCorrelatorFallback(expandedUrl, ctx.correlator);
4210
4177
  }
4211
4178
  var params = url.searchParams;
4212
- removeBrokenAppNameOrphans(params, ctx.appName);
4179
+ removeBrokenAppNameOrphans(params);
4213
4180
  params.set("correlator", ctx.correlator);
4214
4181
  params.set("scor", ctx.streamCorrelator);
4215
4182
  if (ctx.isCtv) {
@@ -4248,18 +4215,14 @@ function applyVastMacros(baseUrl, ctx) {
4248
4215
  if (ctx.podMaxAds != null) {
4249
4216
  params.set("pmad", String(Math.max(1, Math.round(ctx.podMaxAds))));
4250
4217
  }
4251
- var requestUrl = ctx.contentUrl || ctx.pageUrl;
4252
- if (requestUrl) {
4253
- params.set("url", requestUrl);
4254
- if (!ctx.isCtv) {
4255
- params.set("description_url", requestUrl);
4256
- }
4257
- } else {
4258
- var existingUrl = params.get("url") || "";
4259
- if (EXAMPLE_COM_URL.test(existingUrl)) {
4260
- params.delete("url");
4261
- params.delete("description_url");
4262
- }
4218
+ if (!ctx.isCtv && ctx.pageUrl) {
4219
+ params.set("url", ctx.pageUrl);
4220
+ params.set("description_url", ctx.pageUrl);
4221
+ }
4222
+ var existingUrl = params.get("url") || "";
4223
+ if (EXAMPLE_COM_URL.test(existingUrl)) {
4224
+ params.delete("url");
4225
+ params.delete("description_url");
4263
4226
  }
4264
4227
  if (ctx.adWillPlayMuted != null) {
4265
4228
  params.set("vpmute", ctx.adWillPlayMuted ? "1" : "0");
@@ -4267,13 +4230,6 @@ function applyVastMacros(baseUrl, ctx) {
4267
4230
  if (ctx.adWillAutoPlay != null) {
4268
4231
  params.set("vpa", ctx.adWillAutoPlay ? "auto" : "click");
4269
4232
  }
4270
- if (ctx.appId) {
4271
- params.set("msid", ctx.appId);
4272
- }
4273
- if (ctx.appName) {
4274
- removeBrokenAppNameOrphans(params, ctx.appName);
4275
- params.set("an", ctx.appName);
4276
- }
4277
4233
  if (ctx.sessionId) {
4278
4234
  params.set("sid", ctx.sessionId);
4279
4235
  }
@@ -4298,6 +4254,9 @@ function applyVastMacros(baseUrl, ctx) {
4298
4254
  if (ctx.adTest) {
4299
4255
  params.set("adtest", "on");
4300
4256
  }
4257
+ if (ctx.programTitle) {
4258
+ params.set("ct_ti", ctx.programTitle);
4259
+ }
4301
4260
  var staleKeys = [];
4302
4261
  params.forEach(function(value, key) {
4303
4262
  if (isMacroPlaceholder2(value)) {
@@ -4324,7 +4283,7 @@ function applyVastMacros(baseUrl, ctx) {
4324
4283
  }
4325
4284
  }
4326
4285
  }
4327
- removeBrokenAppNameOrphans(params, ctx.appName);
4286
+ removeBrokenAppNameOrphans(params);
4328
4287
  return url.toString();
4329
4288
  }
4330
4289
  function replaceCorrelatorFallback(baseUrl, correlator) {
@@ -5855,13 +5814,25 @@ var AdConfigManager = /*#__PURE__*/ function() {
5855
5814
  };
5856
5815
  }
5857
5816
  },
5817
+ {
5818
+ key: "getPalDescriptionUrl",
5819
+ value: function getPalDescriptionUrl() {
5820
+ if (!this.apiVastTagUrl) return void 0;
5821
+ try {
5822
+ var params = new URL(this.apiVastTagUrl).searchParams;
5823
+ return params.get("description_url") || params.get("url") || void 0;
5824
+ } catch (unused) {
5825
+ return void 0;
5826
+ }
5827
+ }
5828
+ },
5858
5829
  {
5859
5830
  key: "generatePodVastUrl",
5860
5831
  value: function generatePodVastUrl(baseUrl, podParams, adPlayer, palNonce, inAdBreak) {
5861
5832
  var _podParams_maxDurationMs;
5862
5833
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
5863
5834
  var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
5864
- var urlWithMacros = applyVastMacros(baseUrl, {
5835
+ var urlWithMacros = applyVastMacros(baseUrl, _object_spread_props(_object_spread({
5865
5836
  correlator: this.viewCorrelator,
5866
5837
  streamCorrelator: this.streamCorrelator,
5867
5838
  pod: this.podCounter > 0 ? this.podCounter : void 0,
@@ -5869,20 +5840,20 @@ var AdConfigManager = /*#__PURE__*/ function() {
5869
5840
  podMinDurationMs: podParams.minDurationMs,
5870
5841
  podMaxDurationMs: podParams.maxDurationMs,
5871
5842
  isCtv: envSignals.isCtv,
5872
- contentUrl: envSignals.contentUrl,
5873
5843
  pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
5874
5844
  adWillPlayMuted: adWillPlayMuted,
5875
5845
  adWillAutoPlay: !!this.config.autoplay,
5876
- appId: envSignals.appId,
5877
- appName: envSignals.appName,
5878
5846
  sessionId: envSignals.sessionId,
5879
5847
  deviceId: envSignals.deviceId,
5880
5848
  deviceIdType: envSignals.deviceIdType,
5881
5849
  limitAdTracking: envSignals.limitAdTracking,
5882
5850
  deviceTypeHint: envSignals.deviceTypeHint,
5883
- adTest: this.config.adTest,
5851
+ adTest: this.config.adTest
5852
+ }, this.config.programTitle ? {
5853
+ programTitle: this.config.programTitle
5854
+ } : {}), {
5884
5855
  consent: this.consentSignals
5885
- });
5856
+ }));
5886
5857
  var finalUrl = palNonce.injectNonce(urlWithMacros);
5887
5858
  console.log("[StormcloudVideoPlayer] Resolved optimized-pod request URL (pod=".concat(this.podCounter, ", pmad=").concat(podParams.maxAds, ", pmnd=").concat(podParams.minDurationMs, ", pmxd=").concat((_podParams_maxDurationMs = podParams.maxDurationMs) !== null && _podParams_maxDurationMs !== void 0 ? _podParams_maxDurationMs : "?", "):"), finalUrl);
5888
5859
  return finalUrl;
@@ -8988,7 +8959,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8988
8959
  // ───────────────────────────────────────────────────────────────
8989
8960
  function load() {
8990
8961
  return _async_to_generator(function() {
8991
- var _this, _this_config_lowLatencyMode, error, continueLiveStreamDuringAds;
8962
+ var _this, _this_config_lowLatencyMode, error, palDescriptionUrl, continueLiveStreamDuringAds;
8992
8963
  return _ts_generator(this, function(_state) {
8993
8964
  switch(_state.label){
8994
8965
  case 0:
@@ -9024,14 +8995,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
9024
8995
  4
9025
8996
  ];
9026
8997
  case 4:
9027
- this.palNonce.generateNonce({
8998
+ palDescriptionUrl = this.adConfig.getPalDescriptionUrl();
8999
+ this.palNonce.generateNonce(_object_spread({
9028
9000
  videoWidth: this.video.offsetWidth || this.video.clientWidth || 640,
9029
9001
  videoHeight: this.video.offsetHeight || this.video.clientHeight || 480,
9030
9002
  adWillAutoPlay: !!this.config.autoplay,
9031
9003
  adWillPlayMuted: true,
9032
9004
  playerVolume: 0,
9033
9005
  continuousPlayback: (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
9034
- }).catch(function() {});
9006
+ }, palDescriptionUrl ? {
9007
+ descriptionUrl: palDescriptionUrl
9008
+ } : {})).catch(function() {});
9035
9009
  fetchConsentSignals().then(function(signals) {
9036
9010
  _this.adConfig.consentSignals = signals;
9037
9011
  }).catch(function() {});