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.
@@ -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
  }
@@ -4324,7 +4280,7 @@ function applyVastMacros(baseUrl, ctx) {
4324
4280
  }
4325
4281
  }
4326
4282
  }
4327
- removeBrokenAppNameOrphans(params, ctx.appName);
4283
+ removeBrokenAppNameOrphans(params);
4328
4284
  return url.toString();
4329
4285
  }
4330
4286
  function replaceCorrelatorFallback(baseUrl, correlator) {
@@ -5855,6 +5811,18 @@ var AdConfigManager = /*#__PURE__*/ function() {
5855
5811
  };
5856
5812
  }
5857
5813
  },
5814
+ {
5815
+ key: "getPalDescriptionUrl",
5816
+ value: function getPalDescriptionUrl() {
5817
+ if (!this.apiVastTagUrl) return void 0;
5818
+ try {
5819
+ var params = new URL(this.apiVastTagUrl).searchParams;
5820
+ return params.get("description_url") || params.get("url") || void 0;
5821
+ } catch (unused) {
5822
+ return void 0;
5823
+ }
5824
+ }
5825
+ },
5858
5826
  {
5859
5827
  key: "generatePodVastUrl",
5860
5828
  value: function generatePodVastUrl(baseUrl, podParams, adPlayer, palNonce, inAdBreak) {
@@ -5869,12 +5837,9 @@ var AdConfigManager = /*#__PURE__*/ function() {
5869
5837
  podMinDurationMs: podParams.minDurationMs,
5870
5838
  podMaxDurationMs: podParams.maxDurationMs,
5871
5839
  isCtv: envSignals.isCtv,
5872
- contentUrl: envSignals.contentUrl,
5873
5840
  pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
5874
5841
  adWillPlayMuted: adWillPlayMuted,
5875
5842
  adWillAutoPlay: !!this.config.autoplay,
5876
- appId: envSignals.appId,
5877
- appName: envSignals.appName,
5878
5843
  sessionId: envSignals.sessionId,
5879
5844
  deviceId: envSignals.deviceId,
5880
5845
  deviceIdType: envSignals.deviceIdType,
@@ -8988,7 +8953,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8988
8953
  // ───────────────────────────────────────────────────────────────
8989
8954
  function load() {
8990
8955
  return _async_to_generator(function() {
8991
- var _this, _this_config_lowLatencyMode, error, continueLiveStreamDuringAds;
8956
+ var _this, _this_config_lowLatencyMode, error, palDescriptionUrl, continueLiveStreamDuringAds;
8992
8957
  return _ts_generator(this, function(_state) {
8993
8958
  switch(_state.label){
8994
8959
  case 0:
@@ -9024,14 +8989,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
9024
8989
  4
9025
8990
  ];
9026
8991
  case 4:
9027
- this.palNonce.generateNonce({
8992
+ palDescriptionUrl = this.adConfig.getPalDescriptionUrl();
8993
+ this.palNonce.generateNonce(_object_spread({
9028
8994
  videoWidth: this.video.offsetWidth || this.video.clientWidth || 640,
9029
8995
  videoHeight: this.video.offsetHeight || this.video.clientHeight || 480,
9030
8996
  adWillAutoPlay: !!this.config.autoplay,
9031
8997
  adWillPlayMuted: true,
9032
8998
  playerVolume: 0,
9033
8999
  continuousPlayback: (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
9034
- }).catch(function() {});
9000
+ }, palDescriptionUrl ? {
9001
+ descriptionUrl: palDescriptionUrl
9002
+ } : {})).catch(function() {});
9035
9003
  fetchConsentSignals().then(function(signals) {
9036
9004
  _this.adConfig.consentSignals = signals;
9037
9005
  }).catch(function() {});