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.
@@ -36,6 +36,7 @@ declare class AdConfigManager {
36
36
  minDurationMs: number;
37
37
  maxDurationMs: number;
38
38
  };
39
+ getPalDescriptionUrl(): string | undefined;
39
40
  generatePodVastUrl(baseUrl: string, podParams: {
40
41
  maxAds: number;
41
42
  minDurationMs: number;
@@ -2497,34 +2497,8 @@ function ingestPlayerTracking(licenseKey, channel, body) {
2497
2497
  })();
2498
2498
  }
2499
2499
  // src/utils/vastEnvironmentSignals.ts
2500
- var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
2501
- var AIRY_WEBOS_APP_ID = "com.freeairytv.webos";
2502
- var AIRY_TIZEN_APP_ID = "com.freeairytv.samsung";
2503
- var AIRY_ROKU_APP_ID = "com.freeairytv.roku";
2504
- var AIRY_APP_NAME = "AiryTV Movies & TV";
2505
- var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
2506
2500
  var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
2507
2501
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
2508
- var LG_TEST_APP_ID = "com.hulu.plus";
2509
- var LG_TEST_APP_NAME = "Hulu";
2510
- var LG_TEST_CONTENT_URL = "https://www.hulu.com/live-tv";
2511
- var _lgTestDeviceId;
2512
- function getLgTestDeviceId() {
2513
- if (!_lgTestDeviceId) _lgTestDeviceId = createUuid();
2514
- return _lgTestDeviceId;
2515
- }
2516
- function isLgWebOS() {
2517
- if (typeof navigator === "undefined") return false;
2518
- return /Web0S|webOS|LG Browser|LGSTB|LGE/i.test(navigator.userAgent);
2519
- }
2520
- function getDefaultAppId() {
2521
- if (typeof navigator === "undefined") return AIRY_ANDROID_APP_ID;
2522
- var ua = navigator.userAgent;
2523
- if (/Web0S|webOS|LG Browser|LGSTB|LGE/i.test(ua)) return AIRY_WEBOS_APP_ID;
2524
- if (/Tizen|Samsung/i.test(ua)) return AIRY_TIZEN_APP_ID;
2525
- if (/Roku/i.test(ua)) return AIRY_ROKU_APP_ID;
2526
- return AIRY_ANDROID_APP_ID;
2527
- }
2528
2502
  var DEVICE_ID_STORAGE_KEYS = [
2529
2503
  "rdid",
2530
2504
  "ifa",
@@ -2545,23 +2519,29 @@ function resolveVastEnvironmentSignals(isCtv) {
2545
2519
  var _ref;
2546
2520
  var bridgeSignals = readNativeBridgeSignals();
2547
2521
  var platformDevice = readPlatformNativeDeviceId();
2548
- var lg = isCtv && isLgWebOS();
2549
- var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId || (lg && platformDevice.limitAdTracking !== true ? getLgTestDeviceId() : void 0);
2550
- var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType() || (lg ? "lgudid" : void 0);
2522
+ var realDeviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId;
2523
+ var deviceId = realDeviceId;
2524
+ var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
2551
2525
  var platformLat = bridgeSignals.deviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
2552
2526
  var limitAdTracking = deviceId != null ? (_ref = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
2527
+ if (!deviceId && isCtv) {
2528
+ var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
2529
+ if (dpid) {
2530
+ var _ref1;
2531
+ deviceId = dpid;
2532
+ deviceIdType = "dpid";
2533
+ limitAdTracking = (_ref1 = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref1 !== void 0 ? _ref1 : false;
2534
+ }
2535
+ }
2553
2536
  if (isCtv) {
2554
2537
  return _object_spread_props(_object_spread({
2555
2538
  isCtv: true,
2556
- contentUrl: bridgeSignals.contentUrl || readStoredString("contentUrl") || (lg ? LG_TEST_CONTENT_URL : AIRY_DEFAULT_CONTENT_URL),
2557
- appId: bridgeSignals.appId || readStoredString("appId") || readStoredString("msid") || (lg ? LG_TEST_APP_ID : getDefaultAppId()),
2558
- appName: bridgeSignals.appName || readStoredString("appName") || readStoredString("an") || (lg ? LG_TEST_APP_NAME : AIRY_APP_NAME),
2559
2539
  sessionId: getOrCreateCtvSessionId()
2560
2540
  }, deviceId ? {
2561
2541
  deviceId: deviceId
2562
- } : {}, deviceIdType ? {
2542
+ } : {}, deviceId && deviceIdType ? {
2563
2543
  deviceIdType: deviceIdType
2564
- } : {}, limitAdTracking != null ? {
2544
+ } : {}, deviceId && limitAdTracking != null ? {
2565
2545
  limitAdTracking: limitAdTracking
2566
2546
  } : {}), {
2567
2547
  deviceTypeHint: 5
@@ -2571,9 +2551,9 @@ function resolveVastEnvironmentSignals(isCtv) {
2571
2551
  isCtv: false
2572
2552
  }, deviceId ? {
2573
2553
  deviceId: deviceId
2574
- } : {}, deviceIdType ? {
2554
+ } : {}, deviceId && deviceIdType ? {
2575
2555
  deviceIdType: deviceIdType
2576
- } : {}, limitAdTracking != null ? {
2556
+ } : {}, deviceId && limitAdTracking != null ? {
2577
2557
  limitAdTracking: limitAdTracking
2578
2558
  } : {});
2579
2559
  }
@@ -3833,7 +3813,6 @@ var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
3833
3813
  var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
3834
3814
  var EXAMPLE_COM_URL = /example\.com/i;
3835
3815
  var CTV_UNSUPPORTED_PARAMS = [
3836
- "description_url",
3837
3816
  "tfcd",
3838
3817
  "npa",
3839
3818
  "min_ad_duration",
@@ -3924,18 +3903,6 @@ var INLINE_DEVICE_MACRO_REPLACEMENTS = [
3924
3903
  return ctx.limitAdTracking != null ? ctx.limitAdTracking ? "1" : "0" : void 0;
3925
3904
  }
3926
3905
  },
3927
- {
3928
- pattern: /%%MSID%%/gi,
3929
- getValue: function getValue(ctx) {
3930
- return ctx.appId;
3931
- }
3932
- },
3933
- {
3934
- pattern: /%%APP_NAME%%/gi,
3935
- getValue: function getValue(ctx) {
3936
- return ctx.appName;
3937
- }
3938
- },
3939
3906
  {
3940
3907
  pattern: /%%SESSION_ID%%/gi,
3941
3908
  getValue: function getValue(ctx) {
@@ -4126,7 +4093,7 @@ function applyVastMacros(baseUrl, ctx) {
4126
4093
  return replaceCorrelatorFallback(expandedUrl, ctx.correlator);
4127
4094
  }
4128
4095
  var params = url.searchParams;
4129
- removeBrokenAppNameOrphans(params, ctx.appName);
4096
+ removeBrokenAppNameOrphans(params);
4130
4097
  params.set("correlator", ctx.correlator);
4131
4098
  params.set("scor", ctx.streamCorrelator);
4132
4099
  if (ctx.isCtv) {
@@ -4165,18 +4132,14 @@ function applyVastMacros(baseUrl, ctx) {
4165
4132
  if (ctx.podMaxAds != null) {
4166
4133
  params.set("pmad", String(Math.max(1, Math.round(ctx.podMaxAds))));
4167
4134
  }
4168
- var requestUrl = ctx.contentUrl || ctx.pageUrl;
4169
- if (requestUrl) {
4170
- params.set("url", requestUrl);
4171
- if (!ctx.isCtv) {
4172
- params.set("description_url", requestUrl);
4173
- }
4174
- } else {
4175
- var existingUrl = params.get("url") || "";
4176
- if (EXAMPLE_COM_URL.test(existingUrl)) {
4177
- params.delete("url");
4178
- params.delete("description_url");
4179
- }
4135
+ if (!ctx.isCtv && ctx.pageUrl) {
4136
+ params.set("url", ctx.pageUrl);
4137
+ params.set("description_url", ctx.pageUrl);
4138
+ }
4139
+ var existingUrl = params.get("url") || "";
4140
+ if (EXAMPLE_COM_URL.test(existingUrl)) {
4141
+ params.delete("url");
4142
+ params.delete("description_url");
4180
4143
  }
4181
4144
  if (ctx.adWillPlayMuted != null) {
4182
4145
  params.set("vpmute", ctx.adWillPlayMuted ? "1" : "0");
@@ -4184,13 +4147,6 @@ function applyVastMacros(baseUrl, ctx) {
4184
4147
  if (ctx.adWillAutoPlay != null) {
4185
4148
  params.set("vpa", ctx.adWillAutoPlay ? "auto" : "click");
4186
4149
  }
4187
- if (ctx.appId) {
4188
- params.set("msid", ctx.appId);
4189
- }
4190
- if (ctx.appName) {
4191
- removeBrokenAppNameOrphans(params, ctx.appName);
4192
- params.set("an", ctx.appName);
4193
- }
4194
4150
  if (ctx.sessionId) {
4195
4151
  params.set("sid", ctx.sessionId);
4196
4152
  }
@@ -4241,7 +4197,7 @@ function applyVastMacros(baseUrl, ctx) {
4241
4197
  }
4242
4198
  }
4243
4199
  }
4244
- removeBrokenAppNameOrphans(params, ctx.appName);
4200
+ removeBrokenAppNameOrphans(params);
4245
4201
  return url.toString();
4246
4202
  }
4247
4203
  function replaceCorrelatorFallback(baseUrl, correlator) {
@@ -5772,6 +5728,18 @@ var AdConfigManager = /*#__PURE__*/ function() {
5772
5728
  };
5773
5729
  }
5774
5730
  },
5731
+ {
5732
+ key: "getPalDescriptionUrl",
5733
+ value: function getPalDescriptionUrl() {
5734
+ if (!this.apiVastTagUrl) return void 0;
5735
+ try {
5736
+ var params = new URL(this.apiVastTagUrl).searchParams;
5737
+ return params.get("description_url") || params.get("url") || void 0;
5738
+ } catch (unused) {
5739
+ return void 0;
5740
+ }
5741
+ }
5742
+ },
5775
5743
  {
5776
5744
  key: "generatePodVastUrl",
5777
5745
  value: function generatePodVastUrl(baseUrl, podParams, adPlayer, palNonce, inAdBreak) {
@@ -5786,12 +5754,9 @@ var AdConfigManager = /*#__PURE__*/ function() {
5786
5754
  podMinDurationMs: podParams.minDurationMs,
5787
5755
  podMaxDurationMs: podParams.maxDurationMs,
5788
5756
  isCtv: envSignals.isCtv,
5789
- contentUrl: envSignals.contentUrl,
5790
5757
  pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
5791
5758
  adWillPlayMuted: adWillPlayMuted,
5792
5759
  adWillAutoPlay: !!this.config.autoplay,
5793
- appId: envSignals.appId,
5794
- appName: envSignals.appName,
5795
5760
  sessionId: envSignals.sessionId,
5796
5761
  deviceId: envSignals.deviceId,
5797
5762
  deviceIdType: envSignals.deviceIdType,
@@ -8905,7 +8870,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8905
8870
  // ───────────────────────────────────────────────────────────────
8906
8871
  function load() {
8907
8872
  return _async_to_generator(function() {
8908
- var _this, _this_config_lowLatencyMode, error, continueLiveStreamDuringAds;
8873
+ var _this, _this_config_lowLatencyMode, error, palDescriptionUrl, continueLiveStreamDuringAds;
8909
8874
  return _ts_generator(this, function(_state) {
8910
8875
  switch(_state.label){
8911
8876
  case 0:
@@ -8941,14 +8906,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8941
8906
  4
8942
8907
  ];
8943
8908
  case 4:
8944
- this.palNonce.generateNonce({
8909
+ palDescriptionUrl = this.adConfig.getPalDescriptionUrl();
8910
+ this.palNonce.generateNonce(_object_spread({
8945
8911
  videoWidth: this.video.offsetWidth || this.video.clientWidth || 640,
8946
8912
  videoHeight: this.video.offsetHeight || this.video.clientHeight || 480,
8947
8913
  adWillAutoPlay: !!this.config.autoplay,
8948
8914
  adWillPlayMuted: true,
8949
8915
  playerVolume: 0,
8950
8916
  continuousPlayback: (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
8951
- }).catch(function() {});
8917
+ }, palDescriptionUrl ? {
8918
+ descriptionUrl: palDescriptionUrl
8919
+ } : {})).catch(function() {});
8952
8920
  fetchConsentSignals().then(function(signals) {
8953
8921
  _this.adConfig.consentSignals = signals;
8954
8922
  }).catch(function() {});