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 { b as AdBreak, a as StormcloudVideoPlayerConfig, A as AdController } from '../types-cTqIKw_D.cjs';
1
+ import { b as AdBreak, a as StormcloudVideoPlayerConfig, A as AdController } from '../types-52ASml2N.cjs';
2
2
  import { PalNonceManager } from '../sdk/pal.cjs';
3
3
  import { VastConsentSignals } from '../utils/vastMacros.cjs';
4
4
 
@@ -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;
@@ -1,4 +1,4 @@
1
- import { a as StormcloudVideoPlayerConfig, S as Scte35Marker, A as AdController } from '../types-cTqIKw_D.cjs';
1
+ import { a as StormcloudVideoPlayerConfig, S as Scte35Marker, A as AdController } from '../types-52ASml2N.cjs';
2
2
 
3
3
  interface AdTimingCallbacks {
4
4
  onAdStopTimerFired(): void;
@@ -1,5 +1,5 @@
1
1
  import Hls from 'hls.js';
2
- import { a as StormcloudVideoPlayerConfig, S as Scte35Marker } from '../types-cTqIKw_D.cjs';
2
+ import { a as StormcloudVideoPlayerConfig, S as Scte35Marker } from '../types-52ASml2N.cjs';
3
3
  import { Scte35CueContext } from './playerTypes.cjs';
4
4
  import { Scte35CueManager } from './Scte35CueManager.cjs';
5
5
  import { AdTimingService } from './AdTimingService.cjs';
@@ -1,4 +1,4 @@
1
- import { A as AdController } from '../types-cTqIKw_D.cjs';
1
+ import { A as AdController } from '../types-52ASml2N.cjs';
2
2
 
3
3
  declare function getAdAudioVolume(adPlayer: AdController): number;
4
4
  declare function toggleMute(video: HTMLVideoElement, adPlayer: AdController, debug: boolean): void;
@@ -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
  import { Scte35CueSource, Scte35CueReadiness, Scte35CueContext } from './playerTypes.cjs';
3
3
 
4
4
  interface Scte35CueManagerCallbacks {
@@ -1,4 +1,4 @@
1
- import { S as Scte35Marker, I as Id3TagInfo } from '../types-cTqIKw_D.cjs';
1
+ import { S as Scte35Marker, I as Id3TagInfo } from '../types-52ASml2N.cjs';
2
2
 
3
3
  declare function parseCueOutDuration(value: string): number | undefined;
4
4
  declare function parseCueOutCont(value: string): {
@@ -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
  }
@@ -4215,6 +4171,9 @@ function applyVastMacros(baseUrl, ctx) {
4215
4171
  if (ctx.adTest) {
4216
4172
  params.set("adtest", "on");
4217
4173
  }
4174
+ if (ctx.programTitle) {
4175
+ params.set("ct_ti", ctx.programTitle);
4176
+ }
4218
4177
  var staleKeys = [];
4219
4178
  params.forEach(function(value, key) {
4220
4179
  if (isMacroPlaceholder2(value)) {
@@ -4241,7 +4200,7 @@ function applyVastMacros(baseUrl, ctx) {
4241
4200
  }
4242
4201
  }
4243
4202
  }
4244
- removeBrokenAppNameOrphans(params, ctx.appName);
4203
+ removeBrokenAppNameOrphans(params);
4245
4204
  return url.toString();
4246
4205
  }
4247
4206
  function replaceCorrelatorFallback(baseUrl, correlator) {
@@ -5772,13 +5731,25 @@ var AdConfigManager = /*#__PURE__*/ function() {
5772
5731
  };
5773
5732
  }
5774
5733
  },
5734
+ {
5735
+ key: "getPalDescriptionUrl",
5736
+ value: function getPalDescriptionUrl() {
5737
+ if (!this.apiVastTagUrl) return void 0;
5738
+ try {
5739
+ var params = new URL(this.apiVastTagUrl).searchParams;
5740
+ return params.get("description_url") || params.get("url") || void 0;
5741
+ } catch (unused) {
5742
+ return void 0;
5743
+ }
5744
+ }
5745
+ },
5775
5746
  {
5776
5747
  key: "generatePodVastUrl",
5777
5748
  value: function generatePodVastUrl(baseUrl, podParams, adPlayer, palNonce, inAdBreak) {
5778
5749
  var _podParams_maxDurationMs;
5779
5750
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
5780
5751
  var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
5781
- var urlWithMacros = applyVastMacros(baseUrl, {
5752
+ var urlWithMacros = applyVastMacros(baseUrl, _object_spread_props(_object_spread({
5782
5753
  correlator: this.viewCorrelator,
5783
5754
  streamCorrelator: this.streamCorrelator,
5784
5755
  pod: this.podCounter > 0 ? this.podCounter : void 0,
@@ -5786,20 +5757,20 @@ var AdConfigManager = /*#__PURE__*/ function() {
5786
5757
  podMinDurationMs: podParams.minDurationMs,
5787
5758
  podMaxDurationMs: podParams.maxDurationMs,
5788
5759
  isCtv: envSignals.isCtv,
5789
- contentUrl: envSignals.contentUrl,
5790
5760
  pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
5791
5761
  adWillPlayMuted: adWillPlayMuted,
5792
5762
  adWillAutoPlay: !!this.config.autoplay,
5793
- appId: envSignals.appId,
5794
- appName: envSignals.appName,
5795
5763
  sessionId: envSignals.sessionId,
5796
5764
  deviceId: envSignals.deviceId,
5797
5765
  deviceIdType: envSignals.deviceIdType,
5798
5766
  limitAdTracking: envSignals.limitAdTracking,
5799
5767
  deviceTypeHint: envSignals.deviceTypeHint,
5800
- adTest: this.config.adTest,
5768
+ adTest: this.config.adTest
5769
+ }, this.config.programTitle ? {
5770
+ programTitle: this.config.programTitle
5771
+ } : {}), {
5801
5772
  consent: this.consentSignals
5802
- });
5773
+ }));
5803
5774
  var finalUrl = palNonce.injectNonce(urlWithMacros);
5804
5775
  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);
5805
5776
  return finalUrl;
@@ -8905,7 +8876,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8905
8876
  // ───────────────────────────────────────────────────────────────
8906
8877
  function load() {
8907
8878
  return _async_to_generator(function() {
8908
- var _this, _this_config_lowLatencyMode, error, continueLiveStreamDuringAds;
8879
+ var _this, _this_config_lowLatencyMode, error, palDescriptionUrl, continueLiveStreamDuringAds;
8909
8880
  return _ts_generator(this, function(_state) {
8910
8881
  switch(_state.label){
8911
8882
  case 0:
@@ -8941,14 +8912,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
8941
8912
  4
8942
8913
  ];
8943
8914
  case 4:
8944
- this.palNonce.generateNonce({
8915
+ palDescriptionUrl = this.adConfig.getPalDescriptionUrl();
8916
+ this.palNonce.generateNonce(_object_spread({
8945
8917
  videoWidth: this.video.offsetWidth || this.video.clientWidth || 640,
8946
8918
  videoHeight: this.video.offsetHeight || this.video.clientHeight || 480,
8947
8919
  adWillAutoPlay: !!this.config.autoplay,
8948
8920
  adWillPlayMuted: true,
8949
8921
  playerVolume: 0,
8950
8922
  continuousPlayback: (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
8951
- }).catch(function() {});
8923
+ }, palDescriptionUrl ? {
8924
+ descriptionUrl: palDescriptionUrl
8925
+ } : {})).catch(function() {});
8952
8926
  fetchConsentSignals().then(function(signals) {
8953
8927
  _this.adConfig.consentSignals = signals;
8954
8928
  }).catch(function() {});