stormcloud-video-player 0.8.80 → 0.8.82

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 (64) hide show
  1. package/dist/stormcloud-vp.min.js +2 -2
  2. package/lib/Player.d.cts +1 -0
  3. package/lib/StormcloudPlayer.cjs +527 -142
  4. package/lib/StormcloudPlayer.cjs.map +1 -1
  5. package/lib/StormcloudPlayer.d.cts +1 -0
  6. package/lib/index.cjs +553 -143
  7. package/lib/index.cjs.map +1 -1
  8. package/lib/index.d.cts +1 -0
  9. package/lib/index.d.ts +33 -5
  10. package/lib/index.js +553 -143
  11. package/lib/index.js.map +1 -1
  12. package/lib/player/AdBreakOrchestrator.cjs +100 -12
  13. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  14. package/lib/player/AdBreakOrchestrator.d.cts +2 -0
  15. package/lib/player/AdConfigManager.cjs +413 -123
  16. package/lib/player/AdConfigManager.cjs.map +1 -1
  17. package/lib/player/AdConfigManager.d.cts +2 -0
  18. package/lib/player/AdTimingService.d.cts +1 -0
  19. package/lib/player/EdgePodRequest.d.cts +1 -0
  20. package/lib/player/FloorLadder.d.cts +1 -0
  21. package/lib/player/HlsEngine.d.cts +1 -0
  22. package/lib/player/OptimizedPodRequest.cjs +17 -5
  23. package/lib/player/OptimizedPodRequest.cjs.map +1 -1
  24. package/lib/player/PlayerControls.d.cts +1 -0
  25. package/lib/player/Scte35CueManager.d.cts +1 -0
  26. package/lib/player/Scte35Parser.d.cts +1 -0
  27. package/lib/player/StormcloudVideoPlayer.cjs +527 -142
  28. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  29. package/lib/player/StormcloudVideoPlayer.d.cts +5 -4
  30. package/lib/player/playerTypes.d.cts +1 -0
  31. package/lib/players/HlsPlayer.cjs +527 -142
  32. package/lib/players/HlsPlayer.cjs.map +1 -1
  33. package/lib/players/HlsPlayer.d.cts +1 -0
  34. package/lib/players/index.cjs +527 -142
  35. package/lib/players/index.cjs.map +1 -1
  36. package/lib/props.d.cts +1 -0
  37. package/lib/sdk/hlsAdPlayer.cjs +13 -0
  38. package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
  39. package/lib/sdk/hlsAdPlayer.d.cts +1 -0
  40. package/lib/types.d.cts +8 -1
  41. package/lib/ui/StormcloudVideoPlayer.cjs +553 -143
  42. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  43. package/lib/ui/StormcloudVideoPlayer.d.cts +1 -0
  44. package/lib/utils/__tests__/adSignals.test.cjs +174 -15
  45. package/lib/utils/__tests__/adSignals.test.cjs.map +1 -1
  46. package/lib/utils/browserCompat.cjs +33 -0
  47. package/lib/utils/browserCompat.cjs.map +1 -1
  48. package/lib/utils/browserCompat.d.cts +3 -1
  49. package/lib/utils/contentMetadata.cjs +132 -5
  50. package/lib/utils/contentMetadata.cjs.map +1 -1
  51. package/lib/utils/contentMetadata.d.cts +39 -1
  52. package/lib/utils/deviceInfo.cjs +24 -4
  53. package/lib/utils/deviceInfo.cjs.map +1 -1
  54. package/lib/utils/deviceInfo.d.cts +3 -0
  55. package/lib/utils/partnerSignals.cjs +296 -0
  56. package/lib/utils/partnerSignals.cjs.map +1 -0
  57. package/lib/utils/partnerSignals.d.cts +12 -0
  58. package/lib/utils/tracking.cjs +24 -4
  59. package/lib/utils/tracking.cjs.map +1 -1
  60. package/lib/utils/tracking.d.cts +1 -0
  61. package/lib/utils/vastMacros.cjs +51 -1
  62. package/lib/utils/vastMacros.cjs.map +1 -1
  63. package/lib/utils/vastMacros.d.cts +20 -0
  64. package/package.json +1 -1
@@ -5,6 +5,7 @@ import { AdConfigManager } from './AdConfigManager.cjs';
5
5
  import { Scte35CueManager } from './Scte35CueManager.cjs';
6
6
  import { PlaceholderLayer } from './PlaceholderLayer.cjs';
7
7
  import './OptimizedPodRequest.cjs';
8
+ import '../utils/contentMetadata.cjs';
8
9
  import '../sdk/pal.cjs';
9
10
  import '../utils/vastMacros.cjs';
10
11
  import './playerTypes.cjs';
@@ -39,6 +40,7 @@ declare class AdBreakOrchestrator {
39
40
  private breakSource;
40
41
  private followUpBaseVastUrl;
41
42
  private unusableResponsesInBreak;
43
+ private playedAdIdsInBreak;
42
44
  private nextAdTimerId;
43
45
  private controllerGeneration;
44
46
  private readonly requestDiagnostics;
@@ -1102,6 +1102,298 @@ function normalizeBoolean(value) {
1102
1102
  }
1103
1103
  return void 0;
1104
1104
  }
1105
+ // src/utils/contentMetadata.ts
1106
+ var MAX_CONTENT_VALUE_LENGTH = 128;
1107
+ var BRIDGE_KEYS = {
1108
+ channelName: [
1109
+ "channelName",
1110
+ "ct_ch"
1111
+ ],
1112
+ programTitle: [
1113
+ "programTitle",
1114
+ "ct_ti"
1115
+ ],
1116
+ contentNetwork: [
1117
+ "contentNetwork",
1118
+ "ct_ne"
1119
+ ],
1120
+ contentType: [
1121
+ "contentType",
1122
+ "ctt"
1123
+ ],
1124
+ contentCategory: [
1125
+ "contentCategory",
1126
+ "ctc"
1127
+ ],
1128
+ contentGenre: [
1129
+ "contentGenre",
1130
+ "ctgr"
1131
+ ],
1132
+ contentLanguage: [
1133
+ "contentLanguage",
1134
+ "ctlg"
1135
+ ],
1136
+ contentDuration: [
1137
+ "contentDuration",
1138
+ "ctd"
1139
+ ],
1140
+ contentSeason: [
1141
+ "contentSeason",
1142
+ "cts"
1143
+ ],
1144
+ contentEpisode: [
1145
+ "contentEpisode",
1146
+ "cte"
1147
+ ],
1148
+ contentRating: [
1149
+ "contentRating",
1150
+ "ctr",
1151
+ "programRating",
1152
+ "rating"
1153
+ ],
1154
+ contentId: [
1155
+ "contentId",
1156
+ "ctid"
1157
+ ]
1158
+ };
1159
+ function sanitizeContentValue(value) {
1160
+ if (typeof value !== "string") return void 0;
1161
+ var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
1162
+ if (!cleaned) return void 0;
1163
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
1164
+ if (/^(unknown|null|undefined|none|n\/a|-|tbd|tba|to be (announced|determined))$/i.test(cleaned)) {
1165
+ return void 0;
1166
+ }
1167
+ return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
1168
+ }
1169
+ function sanitizeContentScalar(value) {
1170
+ if (typeof value === "number") {
1171
+ return Number.isFinite(value) ? String(value) : void 0;
1172
+ }
1173
+ return sanitizeContentValue(value);
1174
+ }
1175
+ function normalizeContentLanguage(value) {
1176
+ var cleaned = sanitizeContentValue(value);
1177
+ if (!cleaned) return void 0;
1178
+ var match = cleaned.match(/^([A-Za-z]{2})(?:[-_][A-Za-z0-9]{1,8})*$/);
1179
+ return match && match[1] ? match[1].toLowerCase() : void 0;
1180
+ }
1181
+ function normalizeContentDuration(value) {
1182
+ var raw = sanitizeContentScalar(value);
1183
+ if (raw == null || !/^-?\d+(\.\d+)?$/.test(raw)) return void 0;
1184
+ var seconds = Number(raw);
1185
+ if (seconds === -1) return -1;
1186
+ return seconds > 0 ? Math.round(seconds) : void 0;
1187
+ }
1188
+ function bridgeSources() {
1189
+ if (typeof window === "undefined") return [];
1190
+ var w = window;
1191
+ return [
1192
+ w.__STORMCLOUD_CTV__,
1193
+ w.__STORMCLOUD_CTV_AD_INFO__,
1194
+ w.stormcloudCtv
1195
+ ].filter(Boolean);
1196
+ }
1197
+ function readBridgeValue2(keys, sanitize) {
1198
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1199
+ try {
1200
+ for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1201
+ var source = _step.value;
1202
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1203
+ try {
1204
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
1205
+ var key = _step1.value;
1206
+ var value = void 0;
1207
+ try {
1208
+ value = source === null || source === void 0 ? void 0 : source[key];
1209
+ if (typeof value === "function") value = value.call(source);
1210
+ } catch (unused) {
1211
+ value = void 0;
1212
+ }
1213
+ var sanitized = sanitize(value);
1214
+ if (sanitized != null) return sanitized;
1215
+ }
1216
+ } catch (err) {
1217
+ _didIteratorError1 = true;
1218
+ _iteratorError1 = err;
1219
+ } finally{
1220
+ try {
1221
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
1222
+ _iterator1.return();
1223
+ }
1224
+ } finally{
1225
+ if (_didIteratorError1) {
1226
+ throw _iteratorError1;
1227
+ }
1228
+ }
1229
+ }
1230
+ }
1231
+ } catch (err) {
1232
+ _didIteratorError = true;
1233
+ _iteratorError = err;
1234
+ } finally{
1235
+ try {
1236
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1237
+ _iterator.return();
1238
+ }
1239
+ } finally{
1240
+ if (_didIteratorError) {
1241
+ throw _iteratorError;
1242
+ }
1243
+ }
1244
+ }
1245
+ return void 0;
1246
+ }
1247
+ function readBridgeContentValue(keys) {
1248
+ return readBridgeValue2(keys, sanitizeContentValue);
1249
+ }
1250
+ function resolveContentMetadata(config) {
1251
+ var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2, _config_contentDetails, _sanitizeContentValue3, _sanitizeContentValue4, _sanitizeContentValue5, _normalizeContentLanguage, _normalizeContentDuration, _sanitizeContentScalar, _sanitizeContentScalar1, _sanitizeContentValue6, _sanitizeContentValue7;
1252
+ var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
1253
+ var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
1254
+ var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
1255
+ var details = (_config_contentDetails = config.contentDetails) !== null && _config_contentDetails !== void 0 ? _config_contentDetails : {};
1256
+ var contentType = (_sanitizeContentValue3 = sanitizeContentValue(details.contentType)) !== null && _sanitizeContentValue3 !== void 0 ? _sanitizeContentValue3 : readBridgeContentValue(BRIDGE_KEYS.contentType);
1257
+ var contentCategory = (_sanitizeContentValue4 = sanitizeContentValue(details.category)) !== null && _sanitizeContentValue4 !== void 0 ? _sanitizeContentValue4 : readBridgeContentValue(BRIDGE_KEYS.contentCategory);
1258
+ var contentGenre = (_sanitizeContentValue5 = sanitizeContentValue(details.genre)) !== null && _sanitizeContentValue5 !== void 0 ? _sanitizeContentValue5 : readBridgeContentValue(BRIDGE_KEYS.contentGenre);
1259
+ var contentLanguage = (_normalizeContentLanguage = normalizeContentLanguage(details.language)) !== null && _normalizeContentLanguage !== void 0 ? _normalizeContentLanguage : readBridgeValue2(BRIDGE_KEYS.contentLanguage, normalizeContentLanguage);
1260
+ var contentDurationSeconds = (_normalizeContentDuration = normalizeContentDuration(details.durationSeconds)) !== null && _normalizeContentDuration !== void 0 ? _normalizeContentDuration : readBridgeValue2(BRIDGE_KEYS.contentDuration, normalizeContentDuration);
1261
+ var contentSeason = (_sanitizeContentScalar = sanitizeContentScalar(details.season)) !== null && _sanitizeContentScalar !== void 0 ? _sanitizeContentScalar : readBridgeValue2(BRIDGE_KEYS.contentSeason, sanitizeContentScalar);
1262
+ var contentEpisode = (_sanitizeContentScalar1 = sanitizeContentScalar(details.episode)) !== null && _sanitizeContentScalar1 !== void 0 ? _sanitizeContentScalar1 : readBridgeValue2(BRIDGE_KEYS.contentEpisode, sanitizeContentScalar);
1263
+ var contentRating = (_sanitizeContentValue6 = sanitizeContentValue(details.rating)) !== null && _sanitizeContentValue6 !== void 0 ? _sanitizeContentValue6 : readBridgeContentValue(BRIDGE_KEYS.contentRating);
1264
+ var contentId = (_sanitizeContentValue7 = sanitizeContentValue(details.contentId)) !== null && _sanitizeContentValue7 !== void 0 ? _sanitizeContentValue7 : readBridgeContentValue(BRIDGE_KEYS.contentId);
1265
+ return _object_spread({}, channelName ? {
1266
+ channelName: channelName
1267
+ } : {}, programTitle ? {
1268
+ programTitle: programTitle
1269
+ } : {}, contentNetwork ? {
1270
+ contentNetwork: contentNetwork
1271
+ } : {}, contentType ? {
1272
+ contentType: contentType
1273
+ } : {}, contentCategory ? {
1274
+ contentCategory: contentCategory
1275
+ } : {}, contentGenre ? {
1276
+ contentGenre: contentGenre
1277
+ } : {}, contentLanguage ? {
1278
+ contentLanguage: contentLanguage
1279
+ } : {}, contentDurationSeconds != null ? {
1280
+ contentDurationSeconds: contentDurationSeconds
1281
+ } : {}, contentSeason ? {
1282
+ contentSeason: contentSeason
1283
+ } : {}, contentEpisode ? {
1284
+ contentEpisode: contentEpisode
1285
+ } : {}, contentRating ? {
1286
+ contentRating: contentRating
1287
+ } : {}, contentId ? {
1288
+ contentId: contentId
1289
+ } : {});
1290
+ }
1291
+ function appendMissingContentParams(url, meta) {
1292
+ if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
1293
+ try {
1294
+ var parsed = new URL(url);
1295
+ var add = function add(key, value) {
1296
+ if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
1297
+ };
1298
+ add("ct_ch", meta.channelName);
1299
+ add("ct_ti", meta.programTitle);
1300
+ add("ct_ne", meta.contentNetwork);
1301
+ return parsed.toString();
1302
+ } catch (unused) {
1303
+ return url;
1304
+ }
1305
+ }
1306
+ // src/utils/partnerSignals.ts
1307
+ var PLATFORM_IFA_TYPES = /* @__PURE__ */ new Set([
1308
+ "aaid",
1309
+ "adid",
1310
+ "afai",
1311
+ "idfa",
1312
+ "lgudid",
1313
+ "msai",
1314
+ "rida",
1315
+ "tifa",
1316
+ "tvos",
1317
+ "vaid",
1318
+ "vida"
1319
+ ]);
1320
+ function toIabIfaType(deviceIdType, source) {
1321
+ if (!deviceIdType) return void 0;
1322
+ var type = deviceIdType.trim().toLowerCase();
1323
+ if (source === "generated") return "sessionid";
1324
+ if (PLATFORM_IFA_TYPES.has(type)) return type;
1325
+ if (source === "platform") return "dpid";
1326
+ return "ppid";
1327
+ }
1328
+ function playbackMethodCode(autoPlay, muted) {
1329
+ if (autoPlay === false) return 3;
1330
+ if (autoPlay !== true || muted == null) return void 0;
1331
+ return muted ? 2 : 1;
1332
+ }
1333
+ function resolvePlayerSize(video) {
1334
+ var width = video ? video.clientWidth : 0;
1335
+ var height = video ? video.clientHeight : 0;
1336
+ if (!(width > 0 && height > 0) && typeof window !== "undefined") {
1337
+ width = window.innerWidth;
1338
+ height = window.innerHeight;
1339
+ }
1340
+ if (!(width > 0 && height > 0)) return {};
1341
+ return {
1342
+ width: Math.round(width),
1343
+ height: Math.round(height)
1344
+ };
1345
+ }
1346
+ function sanitizeUserId(value) {
1347
+ var cleaned = sanitizeContentValue(value);
1348
+ if (!cleaned || /\s/.test(cleaned)) return void 0;
1349
+ return cleaned;
1350
+ }
1351
+ function isPublicIpv4(ip) {
1352
+ var parts = ip.split(".");
1353
+ if (parts.length !== 4) return false;
1354
+ var nums = parts.map(function(p) {
1355
+ return /^\d{1,3}$/.test(p) ? Number(p) : NaN;
1356
+ });
1357
+ if (nums.some(function(n) {
1358
+ return !(n >= 0 && n <= 255);
1359
+ })) return false;
1360
+ var _nums = _sliced_to_array(nums, 2), a = _nums[0], b = _nums[1];
1361
+ if (a === 0 || a === 10 || a === 127 || a >= 224) return false;
1362
+ if (a === 100 && b >= 64 && b <= 127) return false;
1363
+ if (a === 169 && b === 254) return false;
1364
+ if (a === 172 && b >= 16 && b <= 31) return false;
1365
+ if (a === 192 && b === 168) return false;
1366
+ return true;
1367
+ }
1368
+ function isPublicIpv6(ip) {
1369
+ var lower = ip.toLowerCase();
1370
+ if (!/^[0-9a-f:]+$/.test(lower) || lower.split(":").length < 3) return false;
1371
+ if (lower === "::" || lower === "::1") return false;
1372
+ if (/^fe[89ab]/.test(lower)) return false;
1373
+ if (/^f[cd]/.test(lower)) return false;
1374
+ return true;
1375
+ }
1376
+ function sanitizePublicIp(value) {
1377
+ var cleaned = sanitizeContentValue(value);
1378
+ if (!cleaned) return void 0;
1379
+ if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
1380
+ return isPublicIpv6(cleaned) ? cleaned : void 0;
1381
+ }
1382
+ function resolveUserId(configValue) {
1383
+ var _sanitizeUserId;
1384
+ return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
1385
+ "userId",
1386
+ "uid"
1387
+ ], sanitizeUserId);
1388
+ }
1389
+ function resolveClientIp(configValue) {
1390
+ var _sanitizePublicIp;
1391
+ return (_sanitizePublicIp = sanitizePublicIp(configValue)) !== null && _sanitizePublicIp !== void 0 ? _sanitizePublicIp : readBridgeValue2([
1392
+ "ipAddress",
1393
+ "clientIp",
1394
+ "ip"
1395
+ ], sanitizePublicIp);
1396
+ }
1105
1397
  // src/utils/vastMacros.ts
1106
1398
  var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
1107
1399
  var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
@@ -1419,7 +1711,8 @@ var NESTED_QUERY_PARAM_KEYS = /* @__PURE__ */ new Set([
1419
1711
  var SCVP_POD_MACROS = /* @__PURE__ */ new Set([
1420
1712
  "PMND",
1421
1713
  "PMXD",
1422
- "PMAD"
1714
+ "PMAD",
1715
+ "MABD"
1423
1716
  ]);
1424
1717
  function hasScvpMacros(url) {
1425
1718
  return !!url && SCVP_MACRO_DETECT.test(url);
@@ -1464,6 +1757,8 @@ function resolveScvpMacroValues(ctx) {
1464
1757
  set("RDID", deviceId);
1465
1758
  set("IDTYPE", deviceIdType);
1466
1759
  set("IS-LAT", (_toFlag = toFlag(ctx.limitAdTracking)) !== null && _toFlag !== void 0 ? _toFlag : "0");
1760
+ set("IFA", deviceId);
1761
+ set("IFA-TYPE", toIabIfaType(deviceIdType, ctx.deviceIdSource));
1467
1762
  }
1468
1763
  set("SID", ctx.sessionId);
1469
1764
  set("DTH", ctx.deviceTypeHint);
@@ -1481,6 +1776,26 @@ function resolveScvpMacroValues(ctx) {
1481
1776
  set("GDPR", (_ctx_consent = ctx.consent) === null || _ctx_consent === void 0 ? void 0 : _ctx_consent.gdpr);
1482
1777
  set("GDPR-CONSENT", (_ctx_consent1 = ctx.consent) === null || _ctx_consent1 === void 0 ? void 0 : _ctx_consent1.gdprConsent);
1483
1778
  set("US-PRIVACY", (_ctx_consent2 = ctx.consent) === null || _ctx_consent2 === void 0 ? void 0 : _ctx_consent2.usPrivacy);
1779
+ set("PLAYER-WIDTH", ctx.playerWidth);
1780
+ set("PLAYER-HEIGHT", ctx.playerHeight);
1781
+ set("TIMESTAMP", ctx.timestamp);
1782
+ set("LIVE", toFlag(ctx.isLive));
1783
+ set("VPMT", playbackMethodCode(ctx.isCtv ? true : ctx.adWillAutoPlay, ctx.adWillPlayMuted));
1784
+ set("DEVICE-MAKE", ctx.deviceMake);
1785
+ set("DEVICE-MODEL", ctx.deviceModel);
1786
+ set("DEVICE-HWV", ctx.deviceHardwareVersion);
1787
+ set("UA", ctx.userAgent);
1788
+ set("IP", ctx.ipAddress);
1789
+ set("UID", ctx.userId);
1790
+ set("CT-TYPE", ctx.contentType);
1791
+ set("CT-CATEGORY", ctx.contentCategory);
1792
+ set("CT-GENRE", ctx.contentGenre);
1793
+ set("CT-LANGUAGE", ctx.contentLanguage);
1794
+ set("CT-DURATION", ctx.contentDurationSeconds != null ? ctx.contentDurationSeconds : ctx.isLive ? -1 : void 0);
1795
+ set("CT-SEASON", ctx.contentSeason);
1796
+ set("CT-EPISODE", ctx.contentEpisode);
1797
+ set("CT-RATING", ctx.contentRating);
1798
+ set("CT-ID", ctx.contentId);
1484
1799
  return values;
1485
1800
  }
1486
1801
  var keepNone = function keepNone() {
@@ -1751,117 +2066,6 @@ function resolveAdPodConfig(config) {
1751
2066
  exactDuration: config.podExactDuration === true
1752
2067
  };
1753
2068
  }
1754
- // src/utils/contentMetadata.ts
1755
- var MAX_CONTENT_VALUE_LENGTH = 128;
1756
- var BRIDGE_KEYS = {
1757
- channelName: [
1758
- "channelName",
1759
- "ct_ch"
1760
- ],
1761
- programTitle: [
1762
- "programTitle",
1763
- "ct_ti"
1764
- ],
1765
- contentNetwork: [
1766
- "contentNetwork",
1767
- "ct_ne"
1768
- ]
1769
- };
1770
- function sanitizeContentValue(value) {
1771
- if (typeof value !== "string") return void 0;
1772
- var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
1773
- if (!cleaned) return void 0;
1774
- if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
1775
- if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
1776
- return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
1777
- }
1778
- function bridgeSources() {
1779
- if (typeof window === "undefined") return [];
1780
- var w = window;
1781
- return [
1782
- w.__STORMCLOUD_CTV__,
1783
- w.__STORMCLOUD_CTV_AD_INFO__,
1784
- w.stormcloudCtv
1785
- ].filter(Boolean);
1786
- }
1787
- function readBridgeContentValue(keys) {
1788
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1789
- try {
1790
- for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1791
- var source = _step.value;
1792
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1793
- try {
1794
- for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
1795
- var key = _step1.value;
1796
- var value = void 0;
1797
- try {
1798
- value = source === null || source === void 0 ? void 0 : source[key];
1799
- if (typeof value === "function") value = value.call(source);
1800
- } catch (unused) {
1801
- value = void 0;
1802
- }
1803
- var sanitized = sanitizeContentValue(value);
1804
- if (sanitized) return sanitized;
1805
- }
1806
- } catch (err) {
1807
- _didIteratorError1 = true;
1808
- _iteratorError1 = err;
1809
- } finally{
1810
- try {
1811
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
1812
- _iterator1.return();
1813
- }
1814
- } finally{
1815
- if (_didIteratorError1) {
1816
- throw _iteratorError1;
1817
- }
1818
- }
1819
- }
1820
- }
1821
- } catch (err) {
1822
- _didIteratorError = true;
1823
- _iteratorError = err;
1824
- } finally{
1825
- try {
1826
- if (!_iteratorNormalCompletion && _iterator.return != null) {
1827
- _iterator.return();
1828
- }
1829
- } finally{
1830
- if (_didIteratorError) {
1831
- throw _iteratorError;
1832
- }
1833
- }
1834
- }
1835
- return void 0;
1836
- }
1837
- function resolveContentMetadata(config) {
1838
- var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2;
1839
- var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
1840
- var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
1841
- var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
1842
- return _object_spread({}, channelName ? {
1843
- channelName: channelName
1844
- } : {}, programTitle ? {
1845
- programTitle: programTitle
1846
- } : {}, contentNetwork ? {
1847
- contentNetwork: contentNetwork
1848
- } : {});
1849
- }
1850
- function appendMissingContentParams(url, meta) {
1851
- if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
1852
- try {
1853
- var parsed = new URL(url);
1854
- var add = function add(key, value) {
1855
- if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
1856
- };
1857
- add("ct_ch", meta.channelName);
1858
- add("ct_ti", meta.programTitle);
1859
- add("ct_ne", meta.contentNetwork);
1860
- return parsed.toString();
1861
- } catch (unused) {
1862
- return url;
1863
- }
1864
- }
1865
2069
  // src/utils/deviceInfo.ts
1866
2070
  var CATEGORY_CODES = {
1867
2071
  "LG TV": "lg_tv",
@@ -1956,6 +2160,11 @@ function readBridge(keys) {
1956
2160
  }
1957
2161
  return void 0;
1958
2162
  }
2163
+ function makeForCategory(category) {
2164
+ if (category === "LG TV" || category === "LG Set-Top Box") return "LG";
2165
+ if (category === "Samsung TV") return "Samsung";
2166
+ return void 0;
2167
+ }
1959
2168
  function normalizeCategory(value) {
1960
2169
  var v = cleanString(value);
1961
2170
  if (!v) return void 0;
@@ -2054,7 +2263,7 @@ function categorize(platform, model) {
2054
2263
  return "Other";
2055
2264
  }
2056
2265
  function getDeviceInfo() {
2057
- var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
2266
+ var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory, _ref3, _cleanString4, _cleanString5;
2058
2267
  var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
2059
2268
  if (primePromise && !platformCache) {} else {
2060
2269
  platformCache = platform;
@@ -2077,7 +2286,14 @@ function getDeviceInfo() {
2077
2286
  ]),
2078
2287
  category: normalizeCategory(readBridge([
2079
2288
  "deviceCategory"
2080
- ]))
2289
+ ])),
2290
+ make: readBridge([
2291
+ "deviceMake"
2292
+ ]),
2293
+ hardwareVersion: readBridge([
2294
+ "deviceHardwareVersion",
2295
+ "hardwareVersion"
2296
+ ])
2081
2297
  };
2082
2298
  var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
2083
2299
  var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
@@ -2090,7 +2306,9 @@ function getDeviceInfo() {
2090
2306
  bridge.internalDeviceId,
2091
2307
  bridge.model,
2092
2308
  bridge.firmware,
2093
- bridge.category
2309
+ bridge.category,
2310
+ bridge.make,
2311
+ bridge.hardwareVersion
2094
2312
  ];
2095
2313
  if (bridgeValues.some(function(v) {
2096
2314
  return v !== void 0;
@@ -2098,12 +2316,18 @@ function getDeviceInfo() {
2098
2316
  if (hostDeviceInfo) sources.unshift("host");
2099
2317
  var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
2100
2318
  var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
2319
+ var make = (_ref3 = (_cleanString4 = cleanString(host.make, 40)) !== null && _cleanString4 !== void 0 ? _cleanString4 : bridge.make) !== null && _ref3 !== void 0 ? _ref3 : makeForCategory(category);
2320
+ var hardwareVersion = (_cleanString5 = cleanString(host.hardwareVersion, 40)) !== null && _cleanString5 !== void 0 ? _cleanString5 : bridge.hardwareVersion;
2101
2321
  var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
2102
2322
  return _object_spread_props(_object_spread({
2103
2323
  category: category,
2104
2324
  categoryCode: CATEGORY_CODES[category]
2105
- }, model ? {
2325
+ }, make ? {
2326
+ make: make
2327
+ } : {}, model ? {
2106
2328
  model: model
2329
+ } : {}, hardwareVersion ? {
2330
+ hardwareVersion: hardwareVersion
2107
2331
  } : {}, sonifiModel ? {
2108
2332
  sonifiModel: sonifiModel
2109
2333
  } : {}, firmware ? {
@@ -2739,6 +2963,13 @@ function sendHeartbeat(_0) {
2739
2963
  }).apply(this, arguments);
2740
2964
  }
2741
2965
  // src/player/AdConfigManager.ts
2966
+ function isGamAdUrl(rawUrl) {
2967
+ try {
2968
+ return GAM_AD_HOSTS.has(new URL(rawUrl).hostname);
2969
+ } catch (unused) {
2970
+ return false;
2971
+ }
2972
+ }
2742
2973
  function withDeferredPodParams(rawUrl, deferNonce) {
2743
2974
  try {
2744
2975
  var url = new URL(rawUrl);
@@ -2756,11 +2987,15 @@ function withDeferredPodParams(rawUrl, deferNonce) {
2756
2987
  }
2757
2988
  var AdConfigManager = /*#__PURE__*/ function() {
2758
2989
  function AdConfigManager(config, video) {
2990
+ var _this = this;
2759
2991
  _class_call_check(this, AdConfigManager);
2760
2992
  this.vmapBreaks = [];
2761
2993
  this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
2762
2994
  this.streamCorrelator = generateCorrelator();
2763
2995
  this.consentSignals = {};
2996
+ this.isLiveStream = function() {
2997
+ return !!_this.config.isLiveStream;
2998
+ };
2764
2999
  this.podCounter = 0;
2765
3000
  this.podAssignedByPrefetch = false;
2766
3001
  this.lastHeartbeatTime = 0;
@@ -3211,13 +3446,22 @@ var AdConfigManager = /*#__PURE__*/ function() {
3211
3446
  {
3212
3447
  key: "generatePodVastUrl",
3213
3448
  value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
3449
+ var _content_contentDurationSeconds;
3214
3450
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
3215
3451
  var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
3216
3452
  fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
3217
3453
  sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
3218
3454
  });
3219
3455
  var content = resolveContentMetadata(this.config);
3220
- var macroContext = _object_spread_props(_object_spread({
3456
+ var isLive = this.isLiveStream();
3457
+ var device = getDeviceInfo();
3458
+ var playerSize = resolvePlayerSize(this.video);
3459
+ var videoDuration = this.video.duration;
3460
+ var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
3461
+ var userId = resolveUserId(this.config.adUserId);
3462
+ var ipAddress = resolveClientIp(this.config.clientIpAddress);
3463
+ var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
3464
+ var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
3221
3465
  correlator: this.viewCorrelator,
3222
3466
  streamCorrelator: this.streamCorrelator,
3223
3467
  pod: this.podCounter > 0 ? this.podCounter : void 0,
@@ -3239,8 +3483,46 @@ var AdConfigManager = /*#__PURE__*/ function() {
3239
3483
  contentNetwork: content.contentNetwork
3240
3484
  } : {}), {
3241
3485
  consent: this.consentSignals,
3242
- palNonce: palNonce.getCurrentNonce() || void 0
3243
- });
3486
+ palNonce: palNonce.getCurrentNonce() || void 0,
3487
+ deviceIdSource: envSignals.deviceIdSource,
3488
+ isLive: isLive
3489
+ }), playerSize.width ? {
3490
+ playerWidth: playerSize.width
3491
+ } : {}, playerSize.height ? {
3492
+ playerHeight: playerSize.height
3493
+ } : {}), {
3494
+ timestamp: String(Date.now())
3495
+ }), device.make ? {
3496
+ deviceMake: device.make
3497
+ } : {}, device.model ? {
3498
+ deviceModel: device.model
3499
+ } : {}, device.hardwareVersion ? {
3500
+ deviceHardwareVersion: device.hardwareVersion
3501
+ } : {}, userAgent2 ? {
3502
+ userAgent: userAgent2
3503
+ } : {}, ipAddress ? {
3504
+ ipAddress: ipAddress
3505
+ } : {}, userId ? {
3506
+ userId: userId
3507
+ } : {}, content.contentType ? {
3508
+ contentType: content.contentType
3509
+ } : {}, content.contentCategory ? {
3510
+ contentCategory: content.contentCategory
3511
+ } : {}, content.contentGenre ? {
3512
+ contentGenre: content.contentGenre
3513
+ } : {}, content.contentLanguage ? {
3514
+ contentLanguage: content.contentLanguage
3515
+ } : {}, contentDurationSeconds != null ? {
3516
+ contentDurationSeconds: contentDurationSeconds
3517
+ } : {}, content.contentSeason ? {
3518
+ contentSeason: content.contentSeason
3519
+ } : {}, content.contentEpisode ? {
3520
+ contentEpisode: content.contentEpisode
3521
+ } : {}, content.contentRating ? {
3522
+ contentRating: content.contentRating
3523
+ } : {}, content.contentId ? {
3524
+ contentId: content.contentId
3525
+ } : {});
3244
3526
  var nonceReady = !!macroContext.palNonce;
3245
3527
  var finalUrl;
3246
3528
  if (hasScvpMacros(baseUrl)) {
@@ -3254,9 +3536,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
3254
3536
  } else {
3255
3537
  finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
3256
3538
  }
3257
- finalUrl = appendMissingContentParams(finalUrl, content);
3258
- if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
3259
- finalUrl = applyDeviceKeyValues(finalUrl, getDeviceInfo());
3539
+ if (isGamAdUrl(finalUrl)) {
3540
+ finalUrl = appendMissingContentParams(finalUrl, content);
3541
+ if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
3542
+ finalUrl = applyDeviceKeyValues(finalUrl, device);
3543
+ }
3260
3544
  }
3261
3545
  if (this.debug) {
3262
3546
  var id = envSignals.deviceId;
@@ -3269,7 +3553,13 @@ var AdConfigManager = /*#__PURE__*/ function() {
3269
3553
  sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
3270
3554
  ct_ch: content.channelName,
3271
3555
  ct_ti: content.programTitle,
3272
- ct_ne: content.contentNetwork
3556
+ ct_ne: content.contentNetwork,
3557
+ rating: content.contentRating,
3558
+ ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
3559
+ live: isLive,
3560
+ player: playerSize,
3561
+ make: device.make,
3562
+ model: device.model
3273
3563
  });
3274
3564
  }
3275
3565
  console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);