stormcloud-video-player 0.8.57 → 0.8.58

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.
@@ -2534,34 +2534,8 @@ function ingestPlayerTracking(licenseKey, channel, body) {
2534
2534
  })();
2535
2535
  }
2536
2536
  // src/utils/vastEnvironmentSignals.ts
2537
- var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
2538
- var AIRY_WEBOS_APP_ID = "com.freeairytv.webos";
2539
- var AIRY_TIZEN_APP_ID = "com.freeairytv.samsung";
2540
- var AIRY_ROKU_APP_ID = "com.freeairytv.roku";
2541
- var AIRY_APP_NAME = "AiryTV Movies & TV";
2542
- var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
2543
2537
  var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
2544
2538
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
2545
- var LG_TEST_APP_ID = "com.hulu.plus";
2546
- var LG_TEST_APP_NAME = "Hulu";
2547
- var LG_TEST_CONTENT_URL = "https://www.hulu.com/live-tv";
2548
- var _lgTestDeviceId;
2549
- function getLgTestDeviceId() {
2550
- if (!_lgTestDeviceId) _lgTestDeviceId = createUuid();
2551
- return _lgTestDeviceId;
2552
- }
2553
- function isLgWebOS() {
2554
- if (typeof navigator === "undefined") return false;
2555
- return /Web0S|webOS|LG Browser|LGSTB|LGE/i.test(navigator.userAgent);
2556
- }
2557
- function getDefaultAppId() {
2558
- if (typeof navigator === "undefined") return AIRY_ANDROID_APP_ID;
2559
- var ua = navigator.userAgent;
2560
- if (/Web0S|webOS|LG Browser|LGSTB|LGE/i.test(ua)) return AIRY_WEBOS_APP_ID;
2561
- if (/Tizen|Samsung/i.test(ua)) return AIRY_TIZEN_APP_ID;
2562
- if (/Roku/i.test(ua)) return AIRY_ROKU_APP_ID;
2563
- return AIRY_ANDROID_APP_ID;
2564
- }
2565
2539
  var DEVICE_ID_STORAGE_KEYS = [
2566
2540
  "rdid",
2567
2541
  "ifa",
@@ -2582,23 +2556,29 @@ function resolveVastEnvironmentSignals(isCtv) {
2582
2556
  var _ref;
2583
2557
  var bridgeSignals = readNativeBridgeSignals();
2584
2558
  var platformDevice = readPlatformNativeDeviceId();
2585
- var lg = isCtv && isLgWebOS();
2586
- var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId || (lg && platformDevice.limitAdTracking !== true ? getLgTestDeviceId() : void 0);
2587
- var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType() || (lg ? "lgudid" : void 0);
2559
+ var realDeviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId;
2560
+ var deviceId = realDeviceId;
2561
+ var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
2588
2562
  var platformLat = bridgeSignals.deviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
2589
2563
  var limitAdTracking = deviceId != null ? (_ref = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
2564
+ if (!deviceId && isCtv) {
2565
+ var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
2566
+ if (dpid) {
2567
+ var _ref1;
2568
+ deviceId = dpid;
2569
+ deviceIdType = "dpid";
2570
+ limitAdTracking = (_ref1 = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref1 !== void 0 ? _ref1 : false;
2571
+ }
2572
+ }
2590
2573
  if (isCtv) {
2591
2574
  return _object_spread_props(_object_spread({
2592
2575
  isCtv: true,
2593
- contentUrl: bridgeSignals.contentUrl || readStoredString("contentUrl") || (lg ? LG_TEST_CONTENT_URL : AIRY_DEFAULT_CONTENT_URL),
2594
- appId: bridgeSignals.appId || readStoredString("appId") || readStoredString("msid") || (lg ? LG_TEST_APP_ID : getDefaultAppId()),
2595
- appName: bridgeSignals.appName || readStoredString("appName") || readStoredString("an") || (lg ? LG_TEST_APP_NAME : AIRY_APP_NAME),
2596
2576
  sessionId: getOrCreateCtvSessionId()
2597
2577
  }, deviceId ? {
2598
2578
  deviceId: deviceId
2599
- } : {}, deviceIdType ? {
2579
+ } : {}, deviceId && deviceIdType ? {
2600
2580
  deviceIdType: deviceIdType
2601
- } : {}, limitAdTracking != null ? {
2581
+ } : {}, deviceId && limitAdTracking != null ? {
2602
2582
  limitAdTracking: limitAdTracking
2603
2583
  } : {}), {
2604
2584
  deviceTypeHint: 5
@@ -2608,9 +2588,9 @@ function resolveVastEnvironmentSignals(isCtv) {
2608
2588
  isCtv: false
2609
2589
  }, deviceId ? {
2610
2590
  deviceId: deviceId
2611
- } : {}, deviceIdType ? {
2591
+ } : {}, deviceId && deviceIdType ? {
2612
2592
  deviceIdType: deviceIdType
2613
- } : {}, limitAdTracking != null ? {
2593
+ } : {}, deviceId && limitAdTracking != null ? {
2614
2594
  limitAdTracking: limitAdTracking
2615
2595
  } : {});
2616
2596
  }
@@ -3870,7 +3850,6 @@ var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
3870
3850
  var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
3871
3851
  var EXAMPLE_COM_URL = /example\.com/i;
3872
3852
  var CTV_UNSUPPORTED_PARAMS = [
3873
- "description_url",
3874
3853
  "tfcd",
3875
3854
  "npa",
3876
3855
  "min_ad_duration",
@@ -3961,18 +3940,6 @@ var INLINE_DEVICE_MACRO_REPLACEMENTS = [
3961
3940
  return ctx.limitAdTracking != null ? ctx.limitAdTracking ? "1" : "0" : void 0;
3962
3941
  }
3963
3942
  },
3964
- {
3965
- pattern: /%%MSID%%/gi,
3966
- getValue: function getValue(ctx) {
3967
- return ctx.appId;
3968
- }
3969
- },
3970
- {
3971
- pattern: /%%APP_NAME%%/gi,
3972
- getValue: function getValue(ctx) {
3973
- return ctx.appName;
3974
- }
3975
- },
3976
3943
  {
3977
3944
  pattern: /%%SESSION_ID%%/gi,
3978
3945
  getValue: function getValue(ctx) {
@@ -4163,7 +4130,7 @@ function applyVastMacros(baseUrl, ctx) {
4163
4130
  return replaceCorrelatorFallback(expandedUrl, ctx.correlator);
4164
4131
  }
4165
4132
  var params = url.searchParams;
4166
- removeBrokenAppNameOrphans(params, ctx.appName);
4133
+ removeBrokenAppNameOrphans(params);
4167
4134
  params.set("correlator", ctx.correlator);
4168
4135
  params.set("scor", ctx.streamCorrelator);
4169
4136
  if (ctx.isCtv) {
@@ -4202,18 +4169,14 @@ function applyVastMacros(baseUrl, ctx) {
4202
4169
  if (ctx.podMaxAds != null) {
4203
4170
  params.set("pmad", String(Math.max(1, Math.round(ctx.podMaxAds))));
4204
4171
  }
4205
- var requestUrl = ctx.contentUrl || ctx.pageUrl;
4206
- if (requestUrl) {
4207
- params.set("url", requestUrl);
4208
- if (!ctx.isCtv) {
4209
- params.set("description_url", requestUrl);
4210
- }
4211
- } else {
4212
- var existingUrl = params.get("url") || "";
4213
- if (EXAMPLE_COM_URL.test(existingUrl)) {
4214
- params.delete("url");
4215
- params.delete("description_url");
4216
- }
4172
+ if (!ctx.isCtv && ctx.pageUrl) {
4173
+ params.set("url", ctx.pageUrl);
4174
+ params.set("description_url", ctx.pageUrl);
4175
+ }
4176
+ var existingUrl = params.get("url") || "";
4177
+ if (EXAMPLE_COM_URL.test(existingUrl)) {
4178
+ params.delete("url");
4179
+ params.delete("description_url");
4217
4180
  }
4218
4181
  if (ctx.adWillPlayMuted != null) {
4219
4182
  params.set("vpmute", ctx.adWillPlayMuted ? "1" : "0");
@@ -4221,13 +4184,6 @@ function applyVastMacros(baseUrl, ctx) {
4221
4184
  if (ctx.adWillAutoPlay != null) {
4222
4185
  params.set("vpa", ctx.adWillAutoPlay ? "auto" : "click");
4223
4186
  }
4224
- if (ctx.appId) {
4225
- params.set("msid", ctx.appId);
4226
- }
4227
- if (ctx.appName) {
4228
- removeBrokenAppNameOrphans(params, ctx.appName);
4229
- params.set("an", ctx.appName);
4230
- }
4231
4187
  if (ctx.sessionId) {
4232
4188
  params.set("sid", ctx.sessionId);
4233
4189
  }
@@ -4278,7 +4234,7 @@ function applyVastMacros(baseUrl, ctx) {
4278
4234
  }
4279
4235
  }
4280
4236
  }
4281
- removeBrokenAppNameOrphans(params, ctx.appName);
4237
+ removeBrokenAppNameOrphans(params);
4282
4238
  return url.toString();
4283
4239
  }
4284
4240
  function replaceCorrelatorFallback(baseUrl, correlator) {
@@ -5809,6 +5765,18 @@ var AdConfigManager = /*#__PURE__*/ function() {
5809
5765
  };
5810
5766
  }
5811
5767
  },
5768
+ {
5769
+ key: "getPalDescriptionUrl",
5770
+ value: function getPalDescriptionUrl() {
5771
+ if (!this.apiVastTagUrl) return void 0;
5772
+ try {
5773
+ var params = new URL(this.apiVastTagUrl).searchParams;
5774
+ return params.get("description_url") || params.get("url") || void 0;
5775
+ } catch (unused) {
5776
+ return void 0;
5777
+ }
5778
+ }
5779
+ },
5812
5780
  {
5813
5781
  key: "generatePodVastUrl",
5814
5782
  value: function generatePodVastUrl(baseUrl, podParams, adPlayer, palNonce, inAdBreak) {
@@ -5823,12 +5791,9 @@ var AdConfigManager = /*#__PURE__*/ function() {
5823
5791
  podMinDurationMs: podParams.minDurationMs,
5824
5792
  podMaxDurationMs: podParams.maxDurationMs,
5825
5793
  isCtv: envSignals.isCtv,
5826
- contentUrl: envSignals.contentUrl,
5827
5794
  pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
5828
5795
  adWillPlayMuted: adWillPlayMuted,
5829
5796
  adWillAutoPlay: !!this.config.autoplay,
5830
- appId: envSignals.appId,
5831
- appName: envSignals.appName,
5832
5797
  sessionId: envSignals.sessionId,
5833
5798
  deviceId: envSignals.deviceId,
5834
5799
  deviceIdType: envSignals.deviceIdType,
@@ -8942,7 +8907,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8942
8907
  // ───────────────────────────────────────────────────────────────
8943
8908
  function load() {
8944
8909
  return _async_to_generator(function() {
8945
- var _this, _this_config_lowLatencyMode, error, continueLiveStreamDuringAds;
8910
+ var _this, _this_config_lowLatencyMode, error, palDescriptionUrl, continueLiveStreamDuringAds;
8946
8911
  return _ts_generator(this, function(_state) {
8947
8912
  switch(_state.label){
8948
8913
  case 0:
@@ -8978,14 +8943,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8978
8943
  4
8979
8944
  ];
8980
8945
  case 4:
8981
- this.palNonce.generateNonce({
8946
+ palDescriptionUrl = this.adConfig.getPalDescriptionUrl();
8947
+ this.palNonce.generateNonce(_object_spread({
8982
8948
  videoWidth: this.video.offsetWidth || this.video.clientWidth || 640,
8983
8949
  videoHeight: this.video.offsetHeight || this.video.clientHeight || 480,
8984
8950
  adWillAutoPlay: !!this.config.autoplay,
8985
8951
  adWillPlayMuted: true,
8986
8952
  playerVolume: 0,
8987
8953
  continuousPlayback: (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
8988
- }).catch(function() {});
8954
+ }, palDescriptionUrl ? {
8955
+ descriptionUrl: palDescriptionUrl
8956
+ } : {})).catch(function() {});
8989
8957
  fetchConsentSignals().then(function(signals) {
8990
8958
  _this.adConfig.consentSignals = signals;
8991
8959
  }).catch(function() {});