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.
@@ -2544,34 +2544,8 @@ function ingestPlayerTracking(licenseKey, channel, body) {
2544
2544
  })();
2545
2545
  }
2546
2546
  // src/utils/vastEnvironmentSignals.ts
2547
- var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
2548
- var AIRY_WEBOS_APP_ID = "com.freeairytv.webos";
2549
- var AIRY_TIZEN_APP_ID = "com.freeairytv.samsung";
2550
- var AIRY_ROKU_APP_ID = "com.freeairytv.roku";
2551
- var AIRY_APP_NAME = "AiryTV Movies & TV";
2552
- var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
2553
2547
  var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
2554
2548
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
2555
- var LG_TEST_APP_ID = "com.hulu.plus";
2556
- var LG_TEST_APP_NAME = "Hulu";
2557
- var LG_TEST_CONTENT_URL = "https://www.hulu.com/live-tv";
2558
- var _lgTestDeviceId;
2559
- function getLgTestDeviceId() {
2560
- if (!_lgTestDeviceId) _lgTestDeviceId = createUuid();
2561
- return _lgTestDeviceId;
2562
- }
2563
- function isLgWebOS() {
2564
- if (typeof navigator === "undefined") return false;
2565
- return /Web0S|webOS|LG Browser|LGSTB|LGE/i.test(navigator.userAgent);
2566
- }
2567
- function getDefaultAppId() {
2568
- if (typeof navigator === "undefined") return AIRY_ANDROID_APP_ID;
2569
- var ua = navigator.userAgent;
2570
- if (/Web0S|webOS|LG Browser|LGSTB|LGE/i.test(ua)) return AIRY_WEBOS_APP_ID;
2571
- if (/Tizen|Samsung/i.test(ua)) return AIRY_TIZEN_APP_ID;
2572
- if (/Roku/i.test(ua)) return AIRY_ROKU_APP_ID;
2573
- return AIRY_ANDROID_APP_ID;
2574
- }
2575
2549
  var DEVICE_ID_STORAGE_KEYS = [
2576
2550
  "rdid",
2577
2551
  "ifa",
@@ -2592,23 +2566,29 @@ function resolveVastEnvironmentSignals(isCtv) {
2592
2566
  var _ref;
2593
2567
  var bridgeSignals = readNativeBridgeSignals();
2594
2568
  var platformDevice = readPlatformNativeDeviceId();
2595
- var lg = isCtv && isLgWebOS();
2596
- var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId || (lg && platformDevice.limitAdTracking !== true ? getLgTestDeviceId() : void 0);
2597
- var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType() || (lg ? "lgudid" : void 0);
2569
+ var realDeviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId;
2570
+ var deviceId = realDeviceId;
2571
+ var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
2598
2572
  var platformLat = bridgeSignals.deviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
2599
2573
  var limitAdTracking = deviceId != null ? (_ref = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
2574
+ if (!deviceId && isCtv) {
2575
+ var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
2576
+ if (dpid) {
2577
+ var _ref1;
2578
+ deviceId = dpid;
2579
+ deviceIdType = "dpid";
2580
+ limitAdTracking = (_ref1 = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref1 !== void 0 ? _ref1 : false;
2581
+ }
2582
+ }
2600
2583
  if (isCtv) {
2601
2584
  return _object_spread_props(_object_spread({
2602
2585
  isCtv: true,
2603
- contentUrl: bridgeSignals.contentUrl || readStoredString("contentUrl") || (lg ? LG_TEST_CONTENT_URL : AIRY_DEFAULT_CONTENT_URL),
2604
- appId: bridgeSignals.appId || readStoredString("appId") || readStoredString("msid") || (lg ? LG_TEST_APP_ID : getDefaultAppId()),
2605
- appName: bridgeSignals.appName || readStoredString("appName") || readStoredString("an") || (lg ? LG_TEST_APP_NAME : AIRY_APP_NAME),
2606
2586
  sessionId: getOrCreateCtvSessionId()
2607
2587
  }, deviceId ? {
2608
2588
  deviceId: deviceId
2609
- } : {}, deviceIdType ? {
2589
+ } : {}, deviceId && deviceIdType ? {
2610
2590
  deviceIdType: deviceIdType
2611
- } : {}, limitAdTracking != null ? {
2591
+ } : {}, deviceId && limitAdTracking != null ? {
2612
2592
  limitAdTracking: limitAdTracking
2613
2593
  } : {}), {
2614
2594
  deviceTypeHint: 5
@@ -2618,9 +2598,9 @@ function resolveVastEnvironmentSignals(isCtv) {
2618
2598
  isCtv: false
2619
2599
  }, deviceId ? {
2620
2600
  deviceId: deviceId
2621
- } : {}, deviceIdType ? {
2601
+ } : {}, deviceId && deviceIdType ? {
2622
2602
  deviceIdType: deviceIdType
2623
- } : {}, limitAdTracking != null ? {
2603
+ } : {}, deviceId && limitAdTracking != null ? {
2624
2604
  limitAdTracking: limitAdTracking
2625
2605
  } : {});
2626
2606
  }
@@ -3880,7 +3860,6 @@ var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
3880
3860
  var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
3881
3861
  var EXAMPLE_COM_URL = /example\.com/i;
3882
3862
  var CTV_UNSUPPORTED_PARAMS = [
3883
- "description_url",
3884
3863
  "tfcd",
3885
3864
  "npa",
3886
3865
  "min_ad_duration",
@@ -3971,18 +3950,6 @@ var INLINE_DEVICE_MACRO_REPLACEMENTS = [
3971
3950
  return ctx.limitAdTracking != null ? ctx.limitAdTracking ? "1" : "0" : void 0;
3972
3951
  }
3973
3952
  },
3974
- {
3975
- pattern: /%%MSID%%/gi,
3976
- getValue: function getValue(ctx) {
3977
- return ctx.appId;
3978
- }
3979
- },
3980
- {
3981
- pattern: /%%APP_NAME%%/gi,
3982
- getValue: function getValue(ctx) {
3983
- return ctx.appName;
3984
- }
3985
- },
3986
3953
  {
3987
3954
  pattern: /%%SESSION_ID%%/gi,
3988
3955
  getValue: function getValue(ctx) {
@@ -4173,7 +4140,7 @@ function applyVastMacros(baseUrl, ctx) {
4173
4140
  return replaceCorrelatorFallback(expandedUrl, ctx.correlator);
4174
4141
  }
4175
4142
  var params = url.searchParams;
4176
- removeBrokenAppNameOrphans(params, ctx.appName);
4143
+ removeBrokenAppNameOrphans(params);
4177
4144
  params.set("correlator", ctx.correlator);
4178
4145
  params.set("scor", ctx.streamCorrelator);
4179
4146
  if (ctx.isCtv) {
@@ -4212,18 +4179,14 @@ function applyVastMacros(baseUrl, ctx) {
4212
4179
  if (ctx.podMaxAds != null) {
4213
4180
  params.set("pmad", String(Math.max(1, Math.round(ctx.podMaxAds))));
4214
4181
  }
4215
- var requestUrl = ctx.contentUrl || ctx.pageUrl;
4216
- if (requestUrl) {
4217
- params.set("url", requestUrl);
4218
- if (!ctx.isCtv) {
4219
- params.set("description_url", requestUrl);
4220
- }
4221
- } else {
4222
- var existingUrl = params.get("url") || "";
4223
- if (EXAMPLE_COM_URL.test(existingUrl)) {
4224
- params.delete("url");
4225
- params.delete("description_url");
4226
- }
4182
+ if (!ctx.isCtv && ctx.pageUrl) {
4183
+ params.set("url", ctx.pageUrl);
4184
+ params.set("description_url", ctx.pageUrl);
4185
+ }
4186
+ var existingUrl = params.get("url") || "";
4187
+ if (EXAMPLE_COM_URL.test(existingUrl)) {
4188
+ params.delete("url");
4189
+ params.delete("description_url");
4227
4190
  }
4228
4191
  if (ctx.adWillPlayMuted != null) {
4229
4192
  params.set("vpmute", ctx.adWillPlayMuted ? "1" : "0");
@@ -4231,13 +4194,6 @@ function applyVastMacros(baseUrl, ctx) {
4231
4194
  if (ctx.adWillAutoPlay != null) {
4232
4195
  params.set("vpa", ctx.adWillAutoPlay ? "auto" : "click");
4233
4196
  }
4234
- if (ctx.appId) {
4235
- params.set("msid", ctx.appId);
4236
- }
4237
- if (ctx.appName) {
4238
- removeBrokenAppNameOrphans(params, ctx.appName);
4239
- params.set("an", ctx.appName);
4240
- }
4241
4197
  if (ctx.sessionId) {
4242
4198
  params.set("sid", ctx.sessionId);
4243
4199
  }
@@ -4288,7 +4244,7 @@ function applyVastMacros(baseUrl, ctx) {
4288
4244
  }
4289
4245
  }
4290
4246
  }
4291
- removeBrokenAppNameOrphans(params, ctx.appName);
4247
+ removeBrokenAppNameOrphans(params);
4292
4248
  return url.toString();
4293
4249
  }
4294
4250
  function replaceCorrelatorFallback(baseUrl, correlator) {
@@ -5819,6 +5775,18 @@ var AdConfigManager = /*#__PURE__*/ function() {
5819
5775
  };
5820
5776
  }
5821
5777
  },
5778
+ {
5779
+ key: "getPalDescriptionUrl",
5780
+ value: function getPalDescriptionUrl() {
5781
+ if (!this.apiVastTagUrl) return void 0;
5782
+ try {
5783
+ var params = new URL(this.apiVastTagUrl).searchParams;
5784
+ return params.get("description_url") || params.get("url") || void 0;
5785
+ } catch (unused) {
5786
+ return void 0;
5787
+ }
5788
+ }
5789
+ },
5822
5790
  {
5823
5791
  key: "generatePodVastUrl",
5824
5792
  value: function generatePodVastUrl(baseUrl, podParams, adPlayer, palNonce, inAdBreak) {
@@ -5833,12 +5801,9 @@ var AdConfigManager = /*#__PURE__*/ function() {
5833
5801
  podMinDurationMs: podParams.minDurationMs,
5834
5802
  podMaxDurationMs: podParams.maxDurationMs,
5835
5803
  isCtv: envSignals.isCtv,
5836
- contentUrl: envSignals.contentUrl,
5837
5804
  pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
5838
5805
  adWillPlayMuted: adWillPlayMuted,
5839
5806
  adWillAutoPlay: !!this.config.autoplay,
5840
- appId: envSignals.appId,
5841
- appName: envSignals.appName,
5842
5807
  sessionId: envSignals.sessionId,
5843
5808
  deviceId: envSignals.deviceId,
5844
5809
  deviceIdType: envSignals.deviceIdType,
@@ -8952,7 +8917,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8952
8917
  // ───────────────────────────────────────────────────────────────
8953
8918
  function load() {
8954
8919
  return _async_to_generator(function() {
8955
- var _this, _this_config_lowLatencyMode, error, continueLiveStreamDuringAds;
8920
+ var _this, _this_config_lowLatencyMode, error, palDescriptionUrl, continueLiveStreamDuringAds;
8956
8921
  return _ts_generator(this, function(_state) {
8957
8922
  switch(_state.label){
8958
8923
  case 0:
@@ -8988,14 +8953,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8988
8953
  4
8989
8954
  ];
8990
8955
  case 4:
8991
- this.palNonce.generateNonce({
8956
+ palDescriptionUrl = this.adConfig.getPalDescriptionUrl();
8957
+ this.palNonce.generateNonce(_object_spread({
8992
8958
  videoWidth: this.video.offsetWidth || this.video.clientWidth || 640,
8993
8959
  videoHeight: this.video.offsetHeight || this.video.clientHeight || 480,
8994
8960
  adWillAutoPlay: !!this.config.autoplay,
8995
8961
  adWillPlayMuted: true,
8996
8962
  playerVolume: 0,
8997
8963
  continuousPlayback: (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
8998
- }).catch(function() {});
8964
+ }, palDescriptionUrl ? {
8965
+ descriptionUrl: palDescriptionUrl
8966
+ } : {})).catch(function() {});
8999
8967
  fetchConsentSignals().then(function(signals) {
9000
8968
  _this.adConfig.consentSignals = signals;
9001
8969
  }).catch(function() {});