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,4 +1,4 @@
1
- import { a as StormcloudVideoPlayerConfig } from '../types-cTqIKw_D.cjs';
1
+ import { a as StormcloudVideoPlayerConfig } from '../types-52ASml2N.cjs';
2
2
 
3
3
  declare class StormcloudVideoPlayer {
4
4
  private readonly video;
@@ -1,4 +1,4 @@
1
- import { S as Scte35Marker } from '../types-cTqIKw_D.cjs';
1
+ import { S as Scte35Marker } from '../types-52ASml2N.cjs';
2
2
 
3
3
  type Scte35CueSource = "manifest" | "id3" | "ts";
4
4
  type Scte35CueReadiness = "early" | "playback";
@@ -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
  }
@@ -4262,6 +4218,9 @@ function applyVastMacros(baseUrl, ctx) {
4262
4218
  if (ctx.adTest) {
4263
4219
  params.set("adtest", "on");
4264
4220
  }
4221
+ if (ctx.programTitle) {
4222
+ params.set("ct_ti", ctx.programTitle);
4223
+ }
4265
4224
  var staleKeys = [];
4266
4225
  params.forEach(function(value, key) {
4267
4226
  if (isMacroPlaceholder2(value)) {
@@ -4288,7 +4247,7 @@ function applyVastMacros(baseUrl, ctx) {
4288
4247
  }
4289
4248
  }
4290
4249
  }
4291
- removeBrokenAppNameOrphans(params, ctx.appName);
4250
+ removeBrokenAppNameOrphans(params);
4292
4251
  return url.toString();
4293
4252
  }
4294
4253
  function replaceCorrelatorFallback(baseUrl, correlator) {
@@ -5819,13 +5778,25 @@ var AdConfigManager = /*#__PURE__*/ function() {
5819
5778
  };
5820
5779
  }
5821
5780
  },
5781
+ {
5782
+ key: "getPalDescriptionUrl",
5783
+ value: function getPalDescriptionUrl() {
5784
+ if (!this.apiVastTagUrl) return void 0;
5785
+ try {
5786
+ var params = new URL(this.apiVastTagUrl).searchParams;
5787
+ return params.get("description_url") || params.get("url") || void 0;
5788
+ } catch (unused) {
5789
+ return void 0;
5790
+ }
5791
+ }
5792
+ },
5822
5793
  {
5823
5794
  key: "generatePodVastUrl",
5824
5795
  value: function generatePodVastUrl(baseUrl, podParams, adPlayer, palNonce, inAdBreak) {
5825
5796
  var _podParams_maxDurationMs;
5826
5797
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
5827
5798
  var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
5828
- var urlWithMacros = applyVastMacros(baseUrl, {
5799
+ var urlWithMacros = applyVastMacros(baseUrl, _object_spread_props(_object_spread({
5829
5800
  correlator: this.viewCorrelator,
5830
5801
  streamCorrelator: this.streamCorrelator,
5831
5802
  pod: this.podCounter > 0 ? this.podCounter : void 0,
@@ -5833,20 +5804,20 @@ var AdConfigManager = /*#__PURE__*/ function() {
5833
5804
  podMinDurationMs: podParams.minDurationMs,
5834
5805
  podMaxDurationMs: podParams.maxDurationMs,
5835
5806
  isCtv: envSignals.isCtv,
5836
- contentUrl: envSignals.contentUrl,
5837
5807
  pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
5838
5808
  adWillPlayMuted: adWillPlayMuted,
5839
5809
  adWillAutoPlay: !!this.config.autoplay,
5840
- appId: envSignals.appId,
5841
- appName: envSignals.appName,
5842
5810
  sessionId: envSignals.sessionId,
5843
5811
  deviceId: envSignals.deviceId,
5844
5812
  deviceIdType: envSignals.deviceIdType,
5845
5813
  limitAdTracking: envSignals.limitAdTracking,
5846
5814
  deviceTypeHint: envSignals.deviceTypeHint,
5847
- adTest: this.config.adTest,
5815
+ adTest: this.config.adTest
5816
+ }, this.config.programTitle ? {
5817
+ programTitle: this.config.programTitle
5818
+ } : {}), {
5848
5819
  consent: this.consentSignals
5849
- });
5820
+ }));
5850
5821
  var finalUrl = palNonce.injectNonce(urlWithMacros);
5851
5822
  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);
5852
5823
  return finalUrl;
@@ -8952,7 +8923,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8952
8923
  // ───────────────────────────────────────────────────────────────
8953
8924
  function load() {
8954
8925
  return _async_to_generator(function() {
8955
- var _this, _this_config_lowLatencyMode, error, continueLiveStreamDuringAds;
8926
+ var _this, _this_config_lowLatencyMode, error, palDescriptionUrl, continueLiveStreamDuringAds;
8956
8927
  return _ts_generator(this, function(_state) {
8957
8928
  switch(_state.label){
8958
8929
  case 0:
@@ -8988,14 +8959,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8988
8959
  4
8989
8960
  ];
8990
8961
  case 4:
8991
- this.palNonce.generateNonce({
8962
+ palDescriptionUrl = this.adConfig.getPalDescriptionUrl();
8963
+ this.palNonce.generateNonce(_object_spread({
8992
8964
  videoWidth: this.video.offsetWidth || this.video.clientWidth || 640,
8993
8965
  videoHeight: this.video.offsetHeight || this.video.clientHeight || 480,
8994
8966
  adWillAutoPlay: !!this.config.autoplay,
8995
8967
  adWillPlayMuted: true,
8996
8968
  playerVolume: 0,
8997
8969
  continuousPlayback: (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
8998
- }).catch(function() {});
8970
+ }, palDescriptionUrl ? {
8971
+ descriptionUrl: palDescriptionUrl
8972
+ } : {})).catch(function() {});
8999
8973
  fetchConsentSignals().then(function(signals) {
9000
8974
  _this.adConfig.consentSignals = signals;
9001
8975
  }).catch(function() {});