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.
- package/dist/stormcloud-vp.min.js +2 -2
- package/lib/Player.d.cts +1 -0
- package/lib/StormcloudPlayer.cjs +527 -142
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/StormcloudPlayer.d.cts +1 -0
- package/lib/index.cjs +553 -143
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -0
- package/lib/index.d.ts +33 -5
- package/lib/index.js +553 -143
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +100 -12
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +2 -0
- package/lib/player/AdConfigManager.cjs +413 -123
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdConfigManager.d.cts +2 -0
- package/lib/player/AdTimingService.d.cts +1 -0
- package/lib/player/EdgePodRequest.d.cts +1 -0
- package/lib/player/FloorLadder.d.cts +1 -0
- package/lib/player/HlsEngine.d.cts +1 -0
- package/lib/player/OptimizedPodRequest.cjs +17 -5
- package/lib/player/OptimizedPodRequest.cjs.map +1 -1
- package/lib/player/PlayerControls.d.cts +1 -0
- package/lib/player/Scte35CueManager.d.cts +1 -0
- package/lib/player/Scte35Parser.d.cts +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +527 -142
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +5 -4
- package/lib/player/playerTypes.d.cts +1 -0
- package/lib/players/HlsPlayer.cjs +527 -142
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -0
- package/lib/players/index.cjs +527 -142
- package/lib/players/index.cjs.map +1 -1
- package/lib/props.d.cts +1 -0
- package/lib/sdk/hlsAdPlayer.cjs +13 -0
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -0
- package/lib/types.d.cts +8 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +553 -143
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -0
- package/lib/utils/__tests__/adSignals.test.cjs +174 -15
- package/lib/utils/__tests__/adSignals.test.cjs.map +1 -1
- package/lib/utils/browserCompat.cjs +33 -0
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/browserCompat.d.cts +3 -1
- package/lib/utils/contentMetadata.cjs +132 -5
- package/lib/utils/contentMetadata.cjs.map +1 -1
- package/lib/utils/contentMetadata.d.cts +39 -1
- package/lib/utils/deviceInfo.cjs +24 -4
- package/lib/utils/deviceInfo.cjs.map +1 -1
- package/lib/utils/deviceInfo.d.cts +3 -0
- package/lib/utils/partnerSignals.cjs +296 -0
- package/lib/utils/partnerSignals.cjs.map +1 -0
- package/lib/utils/partnerSignals.d.cts +12 -0
- package/lib/utils/tracking.cjs +24 -4
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +1 -0
- package/lib/utils/vastMacros.cjs +51 -1
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +20 -0
- package/package.json +1 -1
|
@@ -1293,6 +1293,319 @@ function normalizeBoolean(value) {
|
|
|
1293
1293
|
}
|
|
1294
1294
|
return void 0;
|
|
1295
1295
|
}
|
|
1296
|
+
// src/utils/contentMetadata.ts
|
|
1297
|
+
var MAX_CONTENT_VALUE_LENGTH = 128;
|
|
1298
|
+
var BRIDGE_KEYS = {
|
|
1299
|
+
channelName: [
|
|
1300
|
+
"channelName",
|
|
1301
|
+
"ct_ch"
|
|
1302
|
+
],
|
|
1303
|
+
programTitle: [
|
|
1304
|
+
"programTitle",
|
|
1305
|
+
"ct_ti"
|
|
1306
|
+
],
|
|
1307
|
+
contentNetwork: [
|
|
1308
|
+
"contentNetwork",
|
|
1309
|
+
"ct_ne"
|
|
1310
|
+
],
|
|
1311
|
+
contentType: [
|
|
1312
|
+
"contentType",
|
|
1313
|
+
"ctt"
|
|
1314
|
+
],
|
|
1315
|
+
contentCategory: [
|
|
1316
|
+
"contentCategory",
|
|
1317
|
+
"ctc"
|
|
1318
|
+
],
|
|
1319
|
+
contentGenre: [
|
|
1320
|
+
"contentGenre",
|
|
1321
|
+
"ctgr"
|
|
1322
|
+
],
|
|
1323
|
+
contentLanguage: [
|
|
1324
|
+
"contentLanguage",
|
|
1325
|
+
"ctlg"
|
|
1326
|
+
],
|
|
1327
|
+
contentDuration: [
|
|
1328
|
+
"contentDuration",
|
|
1329
|
+
"ctd"
|
|
1330
|
+
],
|
|
1331
|
+
contentSeason: [
|
|
1332
|
+
"contentSeason",
|
|
1333
|
+
"cts"
|
|
1334
|
+
],
|
|
1335
|
+
contentEpisode: [
|
|
1336
|
+
"contentEpisode",
|
|
1337
|
+
"cte"
|
|
1338
|
+
],
|
|
1339
|
+
contentRating: [
|
|
1340
|
+
"contentRating",
|
|
1341
|
+
"ctr",
|
|
1342
|
+
"programRating",
|
|
1343
|
+
"rating"
|
|
1344
|
+
],
|
|
1345
|
+
contentId: [
|
|
1346
|
+
"contentId",
|
|
1347
|
+
"ctid"
|
|
1348
|
+
]
|
|
1349
|
+
};
|
|
1350
|
+
function sanitizeContentValue(value) {
|
|
1351
|
+
if (typeof value !== "string") return void 0;
|
|
1352
|
+
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
1353
|
+
if (!cleaned) return void 0;
|
|
1354
|
+
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
1355
|
+
if (/^(unknown|null|undefined|none|n\/a|-|tbd|tba|to be (announced|determined))$/i.test(cleaned)) {
|
|
1356
|
+
return void 0;
|
|
1357
|
+
}
|
|
1358
|
+
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
1359
|
+
}
|
|
1360
|
+
function sanitizeContentScalar(value) {
|
|
1361
|
+
if (typeof value === "number") {
|
|
1362
|
+
return Number.isFinite(value) ? String(value) : void 0;
|
|
1363
|
+
}
|
|
1364
|
+
return sanitizeContentValue(value);
|
|
1365
|
+
}
|
|
1366
|
+
function normalizeContentLanguage(value) {
|
|
1367
|
+
var cleaned = sanitizeContentValue(value);
|
|
1368
|
+
if (!cleaned) return void 0;
|
|
1369
|
+
var match = cleaned.match(/^([A-Za-z]{2})(?:[-_][A-Za-z0-9]{1,8})*$/);
|
|
1370
|
+
return match && match[1] ? match[1].toLowerCase() : void 0;
|
|
1371
|
+
}
|
|
1372
|
+
function normalizeContentDuration(value) {
|
|
1373
|
+
var raw = sanitizeContentScalar(value);
|
|
1374
|
+
if (raw == null || !/^-?\d+(\.\d+)?$/.test(raw)) return void 0;
|
|
1375
|
+
var seconds = Number(raw);
|
|
1376
|
+
if (seconds === -1) return -1;
|
|
1377
|
+
return seconds > 0 ? Math.round(seconds) : void 0;
|
|
1378
|
+
}
|
|
1379
|
+
function bridgeSources() {
|
|
1380
|
+
if (typeof window === "undefined") return [];
|
|
1381
|
+
var w = window;
|
|
1382
|
+
return [
|
|
1383
|
+
w.__STORMCLOUD_CTV__,
|
|
1384
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
1385
|
+
w.stormcloudCtv
|
|
1386
|
+
].filter(Boolean);
|
|
1387
|
+
}
|
|
1388
|
+
function readBridgeValue2(keys, sanitize) {
|
|
1389
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1390
|
+
try {
|
|
1391
|
+
for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1392
|
+
var source = _step.value;
|
|
1393
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
1394
|
+
try {
|
|
1395
|
+
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
1396
|
+
var key = _step1.value;
|
|
1397
|
+
var value = void 0;
|
|
1398
|
+
try {
|
|
1399
|
+
value = source === null || source === void 0 ? void 0 : source[key];
|
|
1400
|
+
if (typeof value === "function") value = value.call(source);
|
|
1401
|
+
} catch (unused) {
|
|
1402
|
+
value = void 0;
|
|
1403
|
+
}
|
|
1404
|
+
var sanitized = sanitize(value);
|
|
1405
|
+
if (sanitized != null) return sanitized;
|
|
1406
|
+
}
|
|
1407
|
+
} catch (err) {
|
|
1408
|
+
_didIteratorError1 = true;
|
|
1409
|
+
_iteratorError1 = err;
|
|
1410
|
+
} finally{
|
|
1411
|
+
try {
|
|
1412
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
1413
|
+
_iterator1.return();
|
|
1414
|
+
}
|
|
1415
|
+
} finally{
|
|
1416
|
+
if (_didIteratorError1) {
|
|
1417
|
+
throw _iteratorError1;
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
} catch (err) {
|
|
1423
|
+
_didIteratorError = true;
|
|
1424
|
+
_iteratorError = err;
|
|
1425
|
+
} finally{
|
|
1426
|
+
try {
|
|
1427
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1428
|
+
_iterator.return();
|
|
1429
|
+
}
|
|
1430
|
+
} finally{
|
|
1431
|
+
if (_didIteratorError) {
|
|
1432
|
+
throw _iteratorError;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
return void 0;
|
|
1437
|
+
}
|
|
1438
|
+
function readBridgeContentValue(keys) {
|
|
1439
|
+
return readBridgeValue2(keys, sanitizeContentValue);
|
|
1440
|
+
}
|
|
1441
|
+
function resolveContentMetadata(config) {
|
|
1442
|
+
var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2, _config_contentDetails, _sanitizeContentValue3, _sanitizeContentValue4, _sanitizeContentValue5, _normalizeContentLanguage, _normalizeContentDuration, _sanitizeContentScalar, _sanitizeContentScalar1, _sanitizeContentValue6, _sanitizeContentValue7;
|
|
1443
|
+
var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
|
|
1444
|
+
var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
|
|
1445
|
+
var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
|
|
1446
|
+
var details = (_config_contentDetails = config.contentDetails) !== null && _config_contentDetails !== void 0 ? _config_contentDetails : {};
|
|
1447
|
+
var contentType = (_sanitizeContentValue3 = sanitizeContentValue(details.contentType)) !== null && _sanitizeContentValue3 !== void 0 ? _sanitizeContentValue3 : readBridgeContentValue(BRIDGE_KEYS.contentType);
|
|
1448
|
+
var contentCategory = (_sanitizeContentValue4 = sanitizeContentValue(details.category)) !== null && _sanitizeContentValue4 !== void 0 ? _sanitizeContentValue4 : readBridgeContentValue(BRIDGE_KEYS.contentCategory);
|
|
1449
|
+
var contentGenre = (_sanitizeContentValue5 = sanitizeContentValue(details.genre)) !== null && _sanitizeContentValue5 !== void 0 ? _sanitizeContentValue5 : readBridgeContentValue(BRIDGE_KEYS.contentGenre);
|
|
1450
|
+
var contentLanguage = (_normalizeContentLanguage = normalizeContentLanguage(details.language)) !== null && _normalizeContentLanguage !== void 0 ? _normalizeContentLanguage : readBridgeValue2(BRIDGE_KEYS.contentLanguage, normalizeContentLanguage);
|
|
1451
|
+
var contentDurationSeconds = (_normalizeContentDuration = normalizeContentDuration(details.durationSeconds)) !== null && _normalizeContentDuration !== void 0 ? _normalizeContentDuration : readBridgeValue2(BRIDGE_KEYS.contentDuration, normalizeContentDuration);
|
|
1452
|
+
var contentSeason = (_sanitizeContentScalar = sanitizeContentScalar(details.season)) !== null && _sanitizeContentScalar !== void 0 ? _sanitizeContentScalar : readBridgeValue2(BRIDGE_KEYS.contentSeason, sanitizeContentScalar);
|
|
1453
|
+
var contentEpisode = (_sanitizeContentScalar1 = sanitizeContentScalar(details.episode)) !== null && _sanitizeContentScalar1 !== void 0 ? _sanitizeContentScalar1 : readBridgeValue2(BRIDGE_KEYS.contentEpisode, sanitizeContentScalar);
|
|
1454
|
+
var contentRating = (_sanitizeContentValue6 = sanitizeContentValue(details.rating)) !== null && _sanitizeContentValue6 !== void 0 ? _sanitizeContentValue6 : readBridgeContentValue(BRIDGE_KEYS.contentRating);
|
|
1455
|
+
var contentId = (_sanitizeContentValue7 = sanitizeContentValue(details.contentId)) !== null && _sanitizeContentValue7 !== void 0 ? _sanitizeContentValue7 : readBridgeContentValue(BRIDGE_KEYS.contentId);
|
|
1456
|
+
return _object_spread({}, channelName ? {
|
|
1457
|
+
channelName: channelName
|
|
1458
|
+
} : {}, programTitle ? {
|
|
1459
|
+
programTitle: programTitle
|
|
1460
|
+
} : {}, contentNetwork ? {
|
|
1461
|
+
contentNetwork: contentNetwork
|
|
1462
|
+
} : {}, contentType ? {
|
|
1463
|
+
contentType: contentType
|
|
1464
|
+
} : {}, contentCategory ? {
|
|
1465
|
+
contentCategory: contentCategory
|
|
1466
|
+
} : {}, contentGenre ? {
|
|
1467
|
+
contentGenre: contentGenre
|
|
1468
|
+
} : {}, contentLanguage ? {
|
|
1469
|
+
contentLanguage: contentLanguage
|
|
1470
|
+
} : {}, contentDurationSeconds != null ? {
|
|
1471
|
+
contentDurationSeconds: contentDurationSeconds
|
|
1472
|
+
} : {}, contentSeason ? {
|
|
1473
|
+
contentSeason: contentSeason
|
|
1474
|
+
} : {}, contentEpisode ? {
|
|
1475
|
+
contentEpisode: contentEpisode
|
|
1476
|
+
} : {}, contentRating ? {
|
|
1477
|
+
contentRating: contentRating
|
|
1478
|
+
} : {}, contentId ? {
|
|
1479
|
+
contentId: contentId
|
|
1480
|
+
} : {});
|
|
1481
|
+
}
|
|
1482
|
+
function applyContentMetadataUpdate(target, meta) {
|
|
1483
|
+
var _target_contentDetails;
|
|
1484
|
+
var apply = function apply(key, value) {
|
|
1485
|
+
if (value === void 0) return;
|
|
1486
|
+
var clean = value === null ? void 0 : sanitizeContentValue(value);
|
|
1487
|
+
if (clean) target[key] = clean;
|
|
1488
|
+
else delete target[key];
|
|
1489
|
+
};
|
|
1490
|
+
apply("channelName", meta.channelName);
|
|
1491
|
+
apply("programTitle", meta.programTitle);
|
|
1492
|
+
apply("contentNetwork", meta.contentNetwork);
|
|
1493
|
+
if (meta.details === null) delete target.contentDetails;
|
|
1494
|
+
else if (meta.details !== void 0) target.contentDetails = _object_spread({}, meta.details);
|
|
1495
|
+
var rating = meta.programRating !== void 0 ? meta.programRating : meta.contentRating;
|
|
1496
|
+
if (rating === void 0) return;
|
|
1497
|
+
var cleanRating = rating === null ? void 0 : sanitizeContentValue(rating);
|
|
1498
|
+
var details = _object_spread({}, (_target_contentDetails = target.contentDetails) !== null && _target_contentDetails !== void 0 ? _target_contentDetails : {});
|
|
1499
|
+
if (cleanRating) details.rating = cleanRating;
|
|
1500
|
+
else delete details.rating;
|
|
1501
|
+
target.contentDetails = details;
|
|
1502
|
+
}
|
|
1503
|
+
function appendMissingContentParams(url, meta) {
|
|
1504
|
+
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
1505
|
+
try {
|
|
1506
|
+
var parsed = new URL(url);
|
|
1507
|
+
var add = function add(key, value) {
|
|
1508
|
+
if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
|
|
1509
|
+
};
|
|
1510
|
+
add("ct_ch", meta.channelName);
|
|
1511
|
+
add("ct_ti", meta.programTitle);
|
|
1512
|
+
add("ct_ne", meta.contentNetwork);
|
|
1513
|
+
return parsed.toString();
|
|
1514
|
+
} catch (unused) {
|
|
1515
|
+
return url;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
// src/utils/partnerSignals.ts
|
|
1519
|
+
var PLATFORM_IFA_TYPES = /* @__PURE__ */ new Set([
|
|
1520
|
+
"aaid",
|
|
1521
|
+
"adid",
|
|
1522
|
+
"afai",
|
|
1523
|
+
"idfa",
|
|
1524
|
+
"lgudid",
|
|
1525
|
+
"msai",
|
|
1526
|
+
"rida",
|
|
1527
|
+
"tifa",
|
|
1528
|
+
"tvos",
|
|
1529
|
+
"vaid",
|
|
1530
|
+
"vida"
|
|
1531
|
+
]);
|
|
1532
|
+
function toIabIfaType(deviceIdType, source) {
|
|
1533
|
+
if (!deviceIdType) return void 0;
|
|
1534
|
+
var type = deviceIdType.trim().toLowerCase();
|
|
1535
|
+
if (source === "generated") return "sessionid";
|
|
1536
|
+
if (PLATFORM_IFA_TYPES.has(type)) return type;
|
|
1537
|
+
if (source === "platform") return "dpid";
|
|
1538
|
+
return "ppid";
|
|
1539
|
+
}
|
|
1540
|
+
function playbackMethodCode(autoPlay, muted) {
|
|
1541
|
+
if (autoPlay === false) return 3;
|
|
1542
|
+
if (autoPlay !== true || muted == null) return void 0;
|
|
1543
|
+
return muted ? 2 : 1;
|
|
1544
|
+
}
|
|
1545
|
+
function resolvePlayerSize(video) {
|
|
1546
|
+
var width = video ? video.clientWidth : 0;
|
|
1547
|
+
var height = video ? video.clientHeight : 0;
|
|
1548
|
+
if (!(width > 0 && height > 0) && typeof window !== "undefined") {
|
|
1549
|
+
width = window.innerWidth;
|
|
1550
|
+
height = window.innerHeight;
|
|
1551
|
+
}
|
|
1552
|
+
if (!(width > 0 && height > 0)) return {};
|
|
1553
|
+
return {
|
|
1554
|
+
width: Math.round(width),
|
|
1555
|
+
height: Math.round(height)
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
function sanitizeUserId(value) {
|
|
1559
|
+
var cleaned = sanitizeContentValue(value);
|
|
1560
|
+
if (!cleaned || /\s/.test(cleaned)) return void 0;
|
|
1561
|
+
return cleaned;
|
|
1562
|
+
}
|
|
1563
|
+
function isPublicIpv4(ip) {
|
|
1564
|
+
var parts = ip.split(".");
|
|
1565
|
+
if (parts.length !== 4) return false;
|
|
1566
|
+
var nums = parts.map(function(p) {
|
|
1567
|
+
return /^\d{1,3}$/.test(p) ? Number(p) : NaN;
|
|
1568
|
+
});
|
|
1569
|
+
if (nums.some(function(n) {
|
|
1570
|
+
return !(n >= 0 && n <= 255);
|
|
1571
|
+
})) return false;
|
|
1572
|
+
var _nums = _sliced_to_array(nums, 2), a = _nums[0], b = _nums[1];
|
|
1573
|
+
if (a === 0 || a === 10 || a === 127 || a >= 224) return false;
|
|
1574
|
+
if (a === 100 && b >= 64 && b <= 127) return false;
|
|
1575
|
+
if (a === 169 && b === 254) return false;
|
|
1576
|
+
if (a === 172 && b >= 16 && b <= 31) return false;
|
|
1577
|
+
if (a === 192 && b === 168) return false;
|
|
1578
|
+
return true;
|
|
1579
|
+
}
|
|
1580
|
+
function isPublicIpv6(ip) {
|
|
1581
|
+
var lower = ip.toLowerCase();
|
|
1582
|
+
if (!/^[0-9a-f:]+$/.test(lower) || lower.split(":").length < 3) return false;
|
|
1583
|
+
if (lower === "::" || lower === "::1") return false;
|
|
1584
|
+
if (/^fe[89ab]/.test(lower)) return false;
|
|
1585
|
+
if (/^f[cd]/.test(lower)) return false;
|
|
1586
|
+
return true;
|
|
1587
|
+
}
|
|
1588
|
+
function sanitizePublicIp(value) {
|
|
1589
|
+
var cleaned = sanitizeContentValue(value);
|
|
1590
|
+
if (!cleaned) return void 0;
|
|
1591
|
+
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1592
|
+
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1593
|
+
}
|
|
1594
|
+
function resolveUserId(configValue) {
|
|
1595
|
+
var _sanitizeUserId;
|
|
1596
|
+
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
1597
|
+
"userId",
|
|
1598
|
+
"uid"
|
|
1599
|
+
], sanitizeUserId);
|
|
1600
|
+
}
|
|
1601
|
+
function resolveClientIp(configValue) {
|
|
1602
|
+
var _sanitizePublicIp;
|
|
1603
|
+
return (_sanitizePublicIp = sanitizePublicIp(configValue)) !== null && _sanitizePublicIp !== void 0 ? _sanitizePublicIp : readBridgeValue2([
|
|
1604
|
+
"ipAddress",
|
|
1605
|
+
"clientIp",
|
|
1606
|
+
"ip"
|
|
1607
|
+
], sanitizePublicIp);
|
|
1608
|
+
}
|
|
1296
1609
|
// src/utils/vastMacros.ts
|
|
1297
1610
|
var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
|
|
1298
1611
|
var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
|
|
@@ -1610,7 +1923,8 @@ var NESTED_QUERY_PARAM_KEYS = /* @__PURE__ */ new Set([
|
|
|
1610
1923
|
var SCVP_POD_MACROS = /* @__PURE__ */ new Set([
|
|
1611
1924
|
"PMND",
|
|
1612
1925
|
"PMXD",
|
|
1613
|
-
"PMAD"
|
|
1926
|
+
"PMAD",
|
|
1927
|
+
"MABD"
|
|
1614
1928
|
]);
|
|
1615
1929
|
function hasScvpMacros(url) {
|
|
1616
1930
|
return !!url && SCVP_MACRO_DETECT.test(url);
|
|
@@ -1655,6 +1969,8 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1655
1969
|
set("RDID", deviceId);
|
|
1656
1970
|
set("IDTYPE", deviceIdType);
|
|
1657
1971
|
set("IS-LAT", (_toFlag = toFlag(ctx.limitAdTracking)) !== null && _toFlag !== void 0 ? _toFlag : "0");
|
|
1972
|
+
set("IFA", deviceId);
|
|
1973
|
+
set("IFA-TYPE", toIabIfaType(deviceIdType, ctx.deviceIdSource));
|
|
1658
1974
|
}
|
|
1659
1975
|
set("SID", ctx.sessionId);
|
|
1660
1976
|
set("DTH", ctx.deviceTypeHint);
|
|
@@ -1672,6 +1988,26 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1672
1988
|
set("GDPR", (_ctx_consent = ctx.consent) === null || _ctx_consent === void 0 ? void 0 : _ctx_consent.gdpr);
|
|
1673
1989
|
set("GDPR-CONSENT", (_ctx_consent1 = ctx.consent) === null || _ctx_consent1 === void 0 ? void 0 : _ctx_consent1.gdprConsent);
|
|
1674
1990
|
set("US-PRIVACY", (_ctx_consent2 = ctx.consent) === null || _ctx_consent2 === void 0 ? void 0 : _ctx_consent2.usPrivacy);
|
|
1991
|
+
set("PLAYER-WIDTH", ctx.playerWidth);
|
|
1992
|
+
set("PLAYER-HEIGHT", ctx.playerHeight);
|
|
1993
|
+
set("TIMESTAMP", ctx.timestamp);
|
|
1994
|
+
set("LIVE", toFlag(ctx.isLive));
|
|
1995
|
+
set("VPMT", playbackMethodCode(ctx.isCtv ? true : ctx.adWillAutoPlay, ctx.adWillPlayMuted));
|
|
1996
|
+
set("DEVICE-MAKE", ctx.deviceMake);
|
|
1997
|
+
set("DEVICE-MODEL", ctx.deviceModel);
|
|
1998
|
+
set("DEVICE-HWV", ctx.deviceHardwareVersion);
|
|
1999
|
+
set("UA", ctx.userAgent);
|
|
2000
|
+
set("IP", ctx.ipAddress);
|
|
2001
|
+
set("UID", ctx.userId);
|
|
2002
|
+
set("CT-TYPE", ctx.contentType);
|
|
2003
|
+
set("CT-CATEGORY", ctx.contentCategory);
|
|
2004
|
+
set("CT-GENRE", ctx.contentGenre);
|
|
2005
|
+
set("CT-LANGUAGE", ctx.contentLanguage);
|
|
2006
|
+
set("CT-DURATION", ctx.contentDurationSeconds != null ? ctx.contentDurationSeconds : ctx.isLive ? -1 : void 0);
|
|
2007
|
+
set("CT-SEASON", ctx.contentSeason);
|
|
2008
|
+
set("CT-EPISODE", ctx.contentEpisode);
|
|
2009
|
+
set("CT-RATING", ctx.contentRating);
|
|
2010
|
+
set("CT-ID", ctx.contentId);
|
|
1675
2011
|
return values;
|
|
1676
2012
|
}
|
|
1677
2013
|
var keepNone = function keepNone() {
|
|
@@ -2558,9 +2894,30 @@ function detectBrowser() {
|
|
|
2558
2894
|
};
|
|
2559
2895
|
}
|
|
2560
2896
|
var singleDecoderOverride;
|
|
2897
|
+
var LEARNED_SINGLE_DECODER_KEY = "stormcloud.singleDecoder.learned.v1";
|
|
2898
|
+
var learnedSingleDecoder;
|
|
2561
2899
|
function setSingleDecoderOverride(value) {
|
|
2562
2900
|
singleDecoderOverride = value;
|
|
2563
2901
|
}
|
|
2902
|
+
function readLearnedSingleDecoder() {
|
|
2903
|
+
if (learnedSingleDecoder !== void 0) return learnedSingleDecoder;
|
|
2904
|
+
try {
|
|
2905
|
+
var _window_localStorage;
|
|
2906
|
+
learnedSingleDecoder = typeof window !== "undefined" && ((_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(LEARNED_SINGLE_DECODER_KEY)) === "1";
|
|
2907
|
+
} catch (unused) {
|
|
2908
|
+
learnedSingleDecoder = false;
|
|
2909
|
+
}
|
|
2910
|
+
return learnedSingleDecoder;
|
|
2911
|
+
}
|
|
2912
|
+
function markSingleDecoderLearned() {
|
|
2913
|
+
if (readLearnedSingleDecoder()) return false;
|
|
2914
|
+
learnedSingleDecoder = true;
|
|
2915
|
+
try {
|
|
2916
|
+
var _window_localStorage;
|
|
2917
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(LEARNED_SINGLE_DECODER_KEY, "1");
|
|
2918
|
+
} catch (unused) {}
|
|
2919
|
+
return true;
|
|
2920
|
+
}
|
|
2564
2921
|
function requiresMediaPipelineResetAfterAds() {
|
|
2565
2922
|
var _browser_tizenVersion;
|
|
2566
2923
|
if (singleDecoderOverride != null) return singleDecoderOverride;
|
|
@@ -2568,6 +2925,7 @@ function requiresMediaPipelineResetAfterAds() {
|
|
|
2568
2925
|
var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
|
|
2569
2926
|
if (typeof globalOverride === "boolean") return globalOverride;
|
|
2570
2927
|
} catch (unused) {}
|
|
2928
|
+
if (readLearnedSingleDecoder()) return true;
|
|
2571
2929
|
var browser = detectBrowser();
|
|
2572
2930
|
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
2573
2931
|
}
|
|
@@ -2887,15 +3245,20 @@ function finalizeGamRequestUrl(rawUrl, ctx) {
|
|
|
2887
3245
|
values.set("PMND", String(pod.pmnd));
|
|
2888
3246
|
values.set("PMXD", String(pod.pmxd));
|
|
2889
3247
|
if (pod.pmad != null) values.set("PMAD", String(pod.pmad));
|
|
3248
|
+
values.set("MABD", String(Math.max(1, Math.floor(pod.pmxd / 1e3))));
|
|
2890
3249
|
}
|
|
2891
3250
|
var substituted = substituteScvpMacros(rawUrl, values);
|
|
2892
3251
|
var finalUrl;
|
|
2893
3252
|
try {
|
|
2894
3253
|
var url = new URL(normalizeVastTagUrl(substituted.url));
|
|
3254
|
+
var isGam = GAM_AD_HOSTS.has(url.hostname);
|
|
3255
|
+
var setPodParam = function setPodParam(key, value) {
|
|
3256
|
+
if (isGam || url.searchParams.has(key)) url.searchParams.set(key, String(value));
|
|
3257
|
+
};
|
|
2895
3258
|
if (pod) {
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
if (pod.pmad != null)
|
|
3259
|
+
setPodParam("pmnd", pod.pmnd);
|
|
3260
|
+
setPodParam("pmxd", pod.pmxd);
|
|
3261
|
+
if (pod.pmad != null) setPodParam("pmad", pod.pmad);
|
|
2899
3262
|
else url.searchParams.delete("pmad");
|
|
2900
3263
|
} else {
|
|
2901
3264
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -2961,7 +3324,9 @@ function validateGamRequestUrl(url, expect) {
|
|
|
2961
3324
|
if (leftover.length > 0) problems.push("unresolved SCVP macros: ".concat(leftover.join(", ")));
|
|
2962
3325
|
var params;
|
|
2963
3326
|
try {
|
|
2964
|
-
|
|
3327
|
+
var parsed = new URL(url);
|
|
3328
|
+
if (!GAM_AD_HOSTS.has(parsed.hostname)) return problems;
|
|
3329
|
+
params = parsed.searchParams;
|
|
2965
3330
|
} catch (unused) {
|
|
2966
3331
|
return problems.concat("URL could not be parsed");
|
|
2967
3332
|
}
|
|
@@ -6382,7 +6747,7 @@ function safeCall2(fn, thisArg) {
|
|
|
6382
6747
|
function userAgent() {
|
|
6383
6748
|
return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
|
|
6384
6749
|
}
|
|
6385
|
-
function
|
|
6750
|
+
function bridgeSources2() {
|
|
6386
6751
|
if (typeof window === "undefined") return [];
|
|
6387
6752
|
var w = window;
|
|
6388
6753
|
return [
|
|
@@ -6394,7 +6759,7 @@ function bridgeSources() {
|
|
|
6394
6759
|
function readBridge(keys) {
|
|
6395
6760
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6396
6761
|
try {
|
|
6397
|
-
for(var _iterator =
|
|
6762
|
+
for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6398
6763
|
var source = _step.value;
|
|
6399
6764
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
6400
6765
|
try {
|
|
@@ -6441,6 +6806,11 @@ function readBridge(keys) {
|
|
|
6441
6806
|
}
|
|
6442
6807
|
return void 0;
|
|
6443
6808
|
}
|
|
6809
|
+
function makeForCategory(category) {
|
|
6810
|
+
if (category === "LG TV" || category === "LG Set-Top Box") return "LG";
|
|
6811
|
+
if (category === "Samsung TV") return "Samsung";
|
|
6812
|
+
return void 0;
|
|
6813
|
+
}
|
|
6444
6814
|
function normalizeCategory(value) {
|
|
6445
6815
|
var v = cleanString(value);
|
|
6446
6816
|
if (!v) return void 0;
|
|
@@ -6588,7 +6958,7 @@ function primeDeviceInfo() {
|
|
|
6588
6958
|
return primePromise;
|
|
6589
6959
|
}
|
|
6590
6960
|
function getDeviceInfo() {
|
|
6591
|
-
var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
|
|
6961
|
+
var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory, _ref3, _cleanString4, _cleanString5;
|
|
6592
6962
|
var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
|
|
6593
6963
|
if (primePromise && !platformCache) {} else {
|
|
6594
6964
|
platformCache = platform;
|
|
@@ -6611,7 +6981,14 @@ function getDeviceInfo() {
|
|
|
6611
6981
|
]),
|
|
6612
6982
|
category: normalizeCategory(readBridge([
|
|
6613
6983
|
"deviceCategory"
|
|
6614
|
-
]))
|
|
6984
|
+
])),
|
|
6985
|
+
make: readBridge([
|
|
6986
|
+
"deviceMake"
|
|
6987
|
+
]),
|
|
6988
|
+
hardwareVersion: readBridge([
|
|
6989
|
+
"deviceHardwareVersion",
|
|
6990
|
+
"hardwareVersion"
|
|
6991
|
+
])
|
|
6615
6992
|
};
|
|
6616
6993
|
var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
|
|
6617
6994
|
var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
|
|
@@ -6624,7 +7001,9 @@ function getDeviceInfo() {
|
|
|
6624
7001
|
bridge.internalDeviceId,
|
|
6625
7002
|
bridge.model,
|
|
6626
7003
|
bridge.firmware,
|
|
6627
|
-
bridge.category
|
|
7004
|
+
bridge.category,
|
|
7005
|
+
bridge.make,
|
|
7006
|
+
bridge.hardwareVersion
|
|
6628
7007
|
];
|
|
6629
7008
|
if (bridgeValues.some(function(v) {
|
|
6630
7009
|
return v !== void 0;
|
|
@@ -6632,12 +7011,18 @@ function getDeviceInfo() {
|
|
|
6632
7011
|
if (hostDeviceInfo) sources.unshift("host");
|
|
6633
7012
|
var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
|
|
6634
7013
|
var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
|
|
7014
|
+
var make = (_ref3 = (_cleanString4 = cleanString(host.make, 40)) !== null && _cleanString4 !== void 0 ? _cleanString4 : bridge.make) !== null && _ref3 !== void 0 ? _ref3 : makeForCategory(category);
|
|
7015
|
+
var hardwareVersion = (_cleanString5 = cleanString(host.hardwareVersion, 40)) !== null && _cleanString5 !== void 0 ? _cleanString5 : bridge.hardwareVersion;
|
|
6635
7016
|
var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
|
|
6636
7017
|
return _object_spread_props(_object_spread({
|
|
6637
7018
|
category: category,
|
|
6638
7019
|
categoryCode: CATEGORY_CODES[category]
|
|
6639
|
-
},
|
|
7020
|
+
}, make ? {
|
|
7021
|
+
make: make
|
|
7022
|
+
} : {}, model ? {
|
|
6640
7023
|
model: model
|
|
7024
|
+
} : {}, hardwareVersion ? {
|
|
7025
|
+
hardwareVersion: hardwareVersion
|
|
6641
7026
|
} : {}, sonifiModel ? {
|
|
6642
7027
|
sonifiModel: sonifiModel
|
|
6643
7028
|
} : {}, firmware ? {
|
|
@@ -6728,117 +7113,6 @@ function deviceInfoAnalyticsFields(info) {
|
|
|
6728
7113
|
terminal_id: info.terminalId
|
|
6729
7114
|
} : {});
|
|
6730
7115
|
}
|
|
6731
|
-
// src/utils/contentMetadata.ts
|
|
6732
|
-
var MAX_CONTENT_VALUE_LENGTH = 128;
|
|
6733
|
-
var BRIDGE_KEYS = {
|
|
6734
|
-
channelName: [
|
|
6735
|
-
"channelName",
|
|
6736
|
-
"ct_ch"
|
|
6737
|
-
],
|
|
6738
|
-
programTitle: [
|
|
6739
|
-
"programTitle",
|
|
6740
|
-
"ct_ti"
|
|
6741
|
-
],
|
|
6742
|
-
contentNetwork: [
|
|
6743
|
-
"contentNetwork",
|
|
6744
|
-
"ct_ne"
|
|
6745
|
-
]
|
|
6746
|
-
};
|
|
6747
|
-
function sanitizeContentValue(value) {
|
|
6748
|
-
if (typeof value !== "string") return void 0;
|
|
6749
|
-
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
6750
|
-
if (!cleaned) return void 0;
|
|
6751
|
-
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
6752
|
-
if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
|
|
6753
|
-
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
6754
|
-
}
|
|
6755
|
-
function bridgeSources2() {
|
|
6756
|
-
if (typeof window === "undefined") return [];
|
|
6757
|
-
var w = window;
|
|
6758
|
-
return [
|
|
6759
|
-
w.__STORMCLOUD_CTV__,
|
|
6760
|
-
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
6761
|
-
w.stormcloudCtv
|
|
6762
|
-
].filter(Boolean);
|
|
6763
|
-
}
|
|
6764
|
-
function readBridgeContentValue(keys) {
|
|
6765
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6766
|
-
try {
|
|
6767
|
-
for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6768
|
-
var source = _step.value;
|
|
6769
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
6770
|
-
try {
|
|
6771
|
-
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
6772
|
-
var key = _step1.value;
|
|
6773
|
-
var value = void 0;
|
|
6774
|
-
try {
|
|
6775
|
-
value = source === null || source === void 0 ? void 0 : source[key];
|
|
6776
|
-
if (typeof value === "function") value = value.call(source);
|
|
6777
|
-
} catch (unused) {
|
|
6778
|
-
value = void 0;
|
|
6779
|
-
}
|
|
6780
|
-
var sanitized = sanitizeContentValue(value);
|
|
6781
|
-
if (sanitized) return sanitized;
|
|
6782
|
-
}
|
|
6783
|
-
} catch (err) {
|
|
6784
|
-
_didIteratorError1 = true;
|
|
6785
|
-
_iteratorError1 = err;
|
|
6786
|
-
} finally{
|
|
6787
|
-
try {
|
|
6788
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
6789
|
-
_iterator1.return();
|
|
6790
|
-
}
|
|
6791
|
-
} finally{
|
|
6792
|
-
if (_didIteratorError1) {
|
|
6793
|
-
throw _iteratorError1;
|
|
6794
|
-
}
|
|
6795
|
-
}
|
|
6796
|
-
}
|
|
6797
|
-
}
|
|
6798
|
-
} catch (err) {
|
|
6799
|
-
_didIteratorError = true;
|
|
6800
|
-
_iteratorError = err;
|
|
6801
|
-
} finally{
|
|
6802
|
-
try {
|
|
6803
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
6804
|
-
_iterator.return();
|
|
6805
|
-
}
|
|
6806
|
-
} finally{
|
|
6807
|
-
if (_didIteratorError) {
|
|
6808
|
-
throw _iteratorError;
|
|
6809
|
-
}
|
|
6810
|
-
}
|
|
6811
|
-
}
|
|
6812
|
-
return void 0;
|
|
6813
|
-
}
|
|
6814
|
-
function resolveContentMetadata(config) {
|
|
6815
|
-
var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2;
|
|
6816
|
-
var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
|
|
6817
|
-
var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
|
|
6818
|
-
var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
|
|
6819
|
-
return _object_spread({}, channelName ? {
|
|
6820
|
-
channelName: channelName
|
|
6821
|
-
} : {}, programTitle ? {
|
|
6822
|
-
programTitle: programTitle
|
|
6823
|
-
} : {}, contentNetwork ? {
|
|
6824
|
-
contentNetwork: contentNetwork
|
|
6825
|
-
} : {});
|
|
6826
|
-
}
|
|
6827
|
-
function appendMissingContentParams(url, meta) {
|
|
6828
|
-
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
6829
|
-
try {
|
|
6830
|
-
var parsed = new URL(url);
|
|
6831
|
-
var add = function add(key, value) {
|
|
6832
|
-
if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
|
|
6833
|
-
};
|
|
6834
|
-
add("ct_ch", meta.channelName);
|
|
6835
|
-
add("ct_ti", meta.programTitle);
|
|
6836
|
-
add("ct_ne", meta.contentNetwork);
|
|
6837
|
-
return parsed.toString();
|
|
6838
|
-
} catch (unused) {
|
|
6839
|
-
return url;
|
|
6840
|
-
}
|
|
6841
|
-
}
|
|
6842
7116
|
// src/utils/screenActivity.ts
|
|
6843
7117
|
var hostStandby = false;
|
|
6844
7118
|
function setHostStandby(standby) {
|
|
@@ -8840,6 +9114,13 @@ var Scte35CueManager = /*#__PURE__*/ function() {
|
|
|
8840
9114
|
return Scte35CueManager;
|
|
8841
9115
|
}();
|
|
8842
9116
|
// src/player/AdConfigManager.ts
|
|
9117
|
+
function isGamAdUrl(rawUrl) {
|
|
9118
|
+
try {
|
|
9119
|
+
return GAM_AD_HOSTS.has(new URL(rawUrl).hostname);
|
|
9120
|
+
} catch (unused) {
|
|
9121
|
+
return false;
|
|
9122
|
+
}
|
|
9123
|
+
}
|
|
8843
9124
|
function withDeferredPodParams(rawUrl, deferNonce) {
|
|
8844
9125
|
try {
|
|
8845
9126
|
var url = new URL(rawUrl);
|
|
@@ -8857,11 +9138,15 @@ function withDeferredPodParams(rawUrl, deferNonce) {
|
|
|
8857
9138
|
}
|
|
8858
9139
|
var AdConfigManager = /*#__PURE__*/ function() {
|
|
8859
9140
|
function AdConfigManager(config, video) {
|
|
9141
|
+
var _this = this;
|
|
8860
9142
|
_class_call_check(this, AdConfigManager);
|
|
8861
9143
|
this.vmapBreaks = [];
|
|
8862
9144
|
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
8863
9145
|
this.streamCorrelator = generateCorrelator();
|
|
8864
9146
|
this.consentSignals = {};
|
|
9147
|
+
this.isLiveStream = function() {
|
|
9148
|
+
return !!_this.config.isLiveStream;
|
|
9149
|
+
};
|
|
8865
9150
|
this.podCounter = 0;
|
|
8866
9151
|
this.podAssignedByPrefetch = false;
|
|
8867
9152
|
this.lastHeartbeatTime = 0;
|
|
@@ -9312,13 +9597,22 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9312
9597
|
{
|
|
9313
9598
|
key: "generatePodVastUrl",
|
|
9314
9599
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9600
|
+
var _content_contentDurationSeconds;
|
|
9315
9601
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9316
9602
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9317
9603
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9318
9604
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
9319
9605
|
});
|
|
9320
9606
|
var content = resolveContentMetadata(this.config);
|
|
9321
|
-
var
|
|
9607
|
+
var isLive = this.isLiveStream();
|
|
9608
|
+
var device = getDeviceInfo();
|
|
9609
|
+
var playerSize = resolvePlayerSize(this.video);
|
|
9610
|
+
var videoDuration = this.video.duration;
|
|
9611
|
+
var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
|
|
9612
|
+
var userId = resolveUserId(this.config.adUserId);
|
|
9613
|
+
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9614
|
+
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9615
|
+
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
9322
9616
|
correlator: this.viewCorrelator,
|
|
9323
9617
|
streamCorrelator: this.streamCorrelator,
|
|
9324
9618
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
@@ -9340,8 +9634,46 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9340
9634
|
contentNetwork: content.contentNetwork
|
|
9341
9635
|
} : {}), {
|
|
9342
9636
|
consent: this.consentSignals,
|
|
9343
|
-
palNonce: palNonce.getCurrentNonce() || void 0
|
|
9344
|
-
|
|
9637
|
+
palNonce: palNonce.getCurrentNonce() || void 0,
|
|
9638
|
+
deviceIdSource: envSignals.deviceIdSource,
|
|
9639
|
+
isLive: isLive
|
|
9640
|
+
}), playerSize.width ? {
|
|
9641
|
+
playerWidth: playerSize.width
|
|
9642
|
+
} : {}, playerSize.height ? {
|
|
9643
|
+
playerHeight: playerSize.height
|
|
9644
|
+
} : {}), {
|
|
9645
|
+
timestamp: String(Date.now())
|
|
9646
|
+
}), device.make ? {
|
|
9647
|
+
deviceMake: device.make
|
|
9648
|
+
} : {}, device.model ? {
|
|
9649
|
+
deviceModel: device.model
|
|
9650
|
+
} : {}, device.hardwareVersion ? {
|
|
9651
|
+
deviceHardwareVersion: device.hardwareVersion
|
|
9652
|
+
} : {}, userAgent2 ? {
|
|
9653
|
+
userAgent: userAgent2
|
|
9654
|
+
} : {}, ipAddress ? {
|
|
9655
|
+
ipAddress: ipAddress
|
|
9656
|
+
} : {}, userId ? {
|
|
9657
|
+
userId: userId
|
|
9658
|
+
} : {}, content.contentType ? {
|
|
9659
|
+
contentType: content.contentType
|
|
9660
|
+
} : {}, content.contentCategory ? {
|
|
9661
|
+
contentCategory: content.contentCategory
|
|
9662
|
+
} : {}, content.contentGenre ? {
|
|
9663
|
+
contentGenre: content.contentGenre
|
|
9664
|
+
} : {}, content.contentLanguage ? {
|
|
9665
|
+
contentLanguage: content.contentLanguage
|
|
9666
|
+
} : {}, contentDurationSeconds != null ? {
|
|
9667
|
+
contentDurationSeconds: contentDurationSeconds
|
|
9668
|
+
} : {}, content.contentSeason ? {
|
|
9669
|
+
contentSeason: content.contentSeason
|
|
9670
|
+
} : {}, content.contentEpisode ? {
|
|
9671
|
+
contentEpisode: content.contentEpisode
|
|
9672
|
+
} : {}, content.contentRating ? {
|
|
9673
|
+
contentRating: content.contentRating
|
|
9674
|
+
} : {}, content.contentId ? {
|
|
9675
|
+
contentId: content.contentId
|
|
9676
|
+
} : {});
|
|
9345
9677
|
var nonceReady = !!macroContext.palNonce;
|
|
9346
9678
|
var finalUrl;
|
|
9347
9679
|
if (hasScvpMacros(baseUrl)) {
|
|
@@ -9355,9 +9687,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9355
9687
|
} else {
|
|
9356
9688
|
finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
|
|
9357
9689
|
}
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9690
|
+
if (isGamAdUrl(finalUrl)) {
|
|
9691
|
+
finalUrl = appendMissingContentParams(finalUrl, content);
|
|
9692
|
+
if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
|
|
9693
|
+
finalUrl = applyDeviceKeyValues(finalUrl, device);
|
|
9694
|
+
}
|
|
9361
9695
|
}
|
|
9362
9696
|
if (this.debug) {
|
|
9363
9697
|
var id = envSignals.deviceId;
|
|
@@ -9370,7 +9704,13 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9370
9704
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9371
9705
|
ct_ch: content.channelName,
|
|
9372
9706
|
ct_ti: content.programTitle,
|
|
9373
|
-
ct_ne: content.contentNetwork
|
|
9707
|
+
ct_ne: content.contentNetwork,
|
|
9708
|
+
rating: content.contentRating,
|
|
9709
|
+
ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
|
|
9710
|
+
live: isLive,
|
|
9711
|
+
player: playerSize,
|
|
9712
|
+
make: device.make,
|
|
9713
|
+
model: device.model
|
|
9374
9714
|
});
|
|
9375
9715
|
}
|
|
9376
9716
|
console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
|
|
@@ -11049,6 +11389,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11049
11389
|
this.adDetectSentForCurrentBreak = false;
|
|
11050
11390
|
this.slotState = "IDLE";
|
|
11051
11391
|
this.unusableResponsesInBreak = 0;
|
|
11392
|
+
this.playedAdIdsInBreak = /* @__PURE__ */ new Set();
|
|
11052
11393
|
this.controllerGeneration = 0;
|
|
11053
11394
|
this.requestDiagnostics = /* @__PURE__ */ new Map();
|
|
11054
11395
|
this.breakFunnel = {};
|
|
@@ -11145,6 +11486,11 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11145
11486
|
_this.recordRequestDiagnostic(payload);
|
|
11146
11487
|
});
|
|
11147
11488
|
adPlayer.on("ad_impression", function() {
|
|
11489
|
+
var _this_host_getAdPlayer_getLoadedAdId, _this_host_getAdPlayer;
|
|
11490
|
+
var impressionAdId = (_this_host_getAdPlayer_getLoadedAdId = (_this_host_getAdPlayer = _this.host.getAdPlayer()).getLoadedAdId) === null || _this_host_getAdPlayer_getLoadedAdId === void 0 ? void 0 : _this_host_getAdPlayer_getLoadedAdId.call(_this_host_getAdPlayer);
|
|
11491
|
+
if (impressionAdId != null && impressionAdId !== "") {
|
|
11492
|
+
_this.playedAdIdsInBreak.add(String(impressionAdId));
|
|
11493
|
+
}
|
|
11148
11494
|
_this.timing.consecutiveFailures = 0;
|
|
11149
11495
|
_this.setSlotState("PLAYING", "impression");
|
|
11150
11496
|
if (!_this.playbackStartedForCurrentRequest) {
|
|
@@ -11336,6 +11682,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11336
11682
|
this.resetEdgeStateForBreak();
|
|
11337
11683
|
this.followUpBaseVastUrl = void 0;
|
|
11338
11684
|
this.unusableResponsesInBreak = 0;
|
|
11685
|
+
this.playedAdIdsInBreak.clear();
|
|
11339
11686
|
this.timing.totalAdRequestsInBreak = 0;
|
|
11340
11687
|
this.setSlotState("NEEDS_NEXT_AD", "vmap_break_start");
|
|
11341
11688
|
this.noteOpportunity("vmap", breakKey, position);
|
|
@@ -11386,6 +11733,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11386
11733
|
this.breakSource = "scte35";
|
|
11387
11734
|
this.followUpBaseVastUrl = baseVastUrl;
|
|
11388
11735
|
this.unusableResponsesInBreak = 0;
|
|
11736
|
+
this.playedAdIdsInBreak.clear();
|
|
11389
11737
|
this.resetEdgeStateForBreak();
|
|
11390
11738
|
this.setSlotState("NEEDS_NEXT_AD", "scte35_break_start");
|
|
11391
11739
|
if (this.adConfig.podAssignedByPrefetch) {
|
|
@@ -12225,6 +12573,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12225
12573
|
var outcome;
|
|
12226
12574
|
if (message.includes("ad_duration_exceeds_budget")) {
|
|
12227
12575
|
outcome = "discarded_budget";
|
|
12576
|
+
} else if (message.includes("ad_repeated_in_break")) {
|
|
12577
|
+
outcome = "discarded_duplicate";
|
|
12228
12578
|
} else if (message.includes("VAST fill rejected")) {
|
|
12229
12579
|
outcome = "fill_rejected";
|
|
12230
12580
|
} else if (/no ads available|no fill|nofill/i.test(message)) {
|
|
@@ -12239,7 +12589,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12239
12589
|
outcome = "request_failed";
|
|
12240
12590
|
}
|
|
12241
12591
|
this.timing.consecutiveFailures++;
|
|
12242
|
-
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget") {
|
|
12592
|
+
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget" || outcome === "discarded_duplicate") {
|
|
12243
12593
|
this.unusableResponsesInBreak++;
|
|
12244
12594
|
}
|
|
12245
12595
|
if (outcome === "no_fill") {
|
|
@@ -12253,7 +12603,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12253
12603
|
}) ? diag.dispatchedUrl : vastTagUrl;
|
|
12254
12604
|
if (this.timing.isTemporaryAdError(error)) {
|
|
12255
12605
|
this.timing.temporaryFailureUrls.set(failureKey, Date.now());
|
|
12256
|
-
} else if (outcome !== "discarded_budget") {
|
|
12606
|
+
} else if (outcome !== "discarded_budget" && outcome !== "discarded_duplicate") {
|
|
12257
12607
|
this.timing.failedVastUrls.add(failureKey);
|
|
12258
12608
|
}
|
|
12259
12609
|
this.countFunnelStage("request_outcome:".concat(outcome));
|
|
@@ -12625,7 +12975,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12625
12975
|
value: function playSingleAd(vastTagUrl) {
|
|
12626
12976
|
var trigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "vmap";
|
|
12627
12977
|
return _async_to_generator(function() {
|
|
12628
|
-
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, finalizeRequestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
12978
|
+
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, _ref, _ap_getLoadedAdId, _ap_getPodAdCount, finalizeRequestUrl, loadedAdId, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
12629
12979
|
return _ts_generator(this, function(_state) {
|
|
12630
12980
|
switch(_state.label){
|
|
12631
12981
|
case 0:
|
|
@@ -12738,6 +13088,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12738
13088
|
vastUrl: (_this_currentVastUrl = this.currentVastUrl) !== null && _this_currentVastUrl !== void 0 ? _this_currentVastUrl : requestUrl,
|
|
12739
13089
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
12740
13090
|
}, this.analyticsContext).catch(function() {});
|
|
13091
|
+
loadedAdId = (_ap_getLoadedAdId = ap.getLoadedAdId) === null || _ap_getLoadedAdId === void 0 ? void 0 : _ap_getLoadedAdId.call(ap);
|
|
13092
|
+
if (!this.host.config.allowRepeatAdsInBreak && loadedAdId != null && loadedAdId !== "" && ((_ref = (_ap_getPodAdCount = ap.getPodAdCount) === null || _ap_getPodAdCount === void 0 ? void 0 : _ap_getPodAdCount.call(ap)) !== null && _ref !== void 0 ? _ref : 1) <= 1 && this.playedAdIdsInBreak.has(String(loadedAdId))) {
|
|
13093
|
+
if (this.debug) {
|
|
13094
|
+
console.log("[AD-DURATION] Rejected ad id=".concat(loadedAdId, ": already played in this break — requesting another ad"));
|
|
13095
|
+
}
|
|
13096
|
+
this.logOrchestratorFunnel("discarded_duplicate", {
|
|
13097
|
+
adId: String(loadedAdId)
|
|
13098
|
+
});
|
|
13099
|
+
throw new Error("ad_repeated_in_break");
|
|
13100
|
+
}
|
|
12741
13101
|
if (!this.timing.ensureLoadedAdFitsBudget(ap)) {
|
|
12742
13102
|
;
|
|
12743
13103
|
adDurationS = (_ap_getLoadedAdDuration = ap.getLoadedAdDuration) === null || _ap_getLoadedAdDuration === void 0 ? void 0 : _ap_getLoadedAdDuration.call(ap);
|
|
@@ -12791,6 +13151,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12791
13151
|
this.recordRequestFailure(error, vastTagUrl);
|
|
12792
13152
|
if ((error === null || error === void 0 ? void 0 : error.message) === "ad_duration_exceeds_budget") {
|
|
12793
13153
|
this.recreateAdController("discarded_budget");
|
|
13154
|
+
} else if ((error === null || error === void 0 ? void 0 : error.message) === "ad_repeated_in_break") {
|
|
13155
|
+
this.recreateAdController("discarded_duplicate");
|
|
12794
13156
|
}
|
|
12795
13157
|
throw error;
|
|
12796
13158
|
case 10:
|
|
@@ -12864,6 +13226,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12864
13226
|
tagAllowsAudio: count("tag_allows_audio"),
|
|
12865
13227
|
missingImpression: count("vast_missing_impression"),
|
|
12866
13228
|
discardedBudget: count("discarded_budget"),
|
|
13229
|
+
discardedDuplicate: count("discarded_duplicate"),
|
|
12867
13230
|
mediaCandidates: count("media_candidate:accepted") + count("media_candidate:rejected"),
|
|
12868
13231
|
mediaRejected: count("media_candidate:rejected"),
|
|
12869
13232
|
mediaFallbacks: count("media_fallback"),
|
|
@@ -12939,6 +13302,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12939
13302
|
this.breakSource = void 0;
|
|
12940
13303
|
this.followUpBaseVastUrl = void 0;
|
|
12941
13304
|
this.unusableResponsesInBreak = 0;
|
|
13305
|
+
this.playedAdIdsInBreak.clear();
|
|
12942
13306
|
this.resetEdgeStateForBreak();
|
|
12943
13307
|
adPlayer.stop().catch(function() {});
|
|
12944
13308
|
if (!alreadyEnded) this.logBreakFunnel(reason);
|
|
@@ -13039,9 +13403,18 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13039
13403
|
var maxMonitorMs = 45e3;
|
|
13040
13404
|
var startTime = Date.now();
|
|
13041
13405
|
var baseline = resumeBaseline;
|
|
13406
|
+
var lastSeenTime = resumeBaseline;
|
|
13042
13407
|
var recoveries = 0;
|
|
13043
13408
|
var lastRecoveryAt = 0;
|
|
13044
13409
|
var video = this.host.video;
|
|
13410
|
+
var onDecodeError = function onDecodeError() {
|
|
13411
|
+
var _video_error;
|
|
13412
|
+
if (needsReset || ((_video_error = video.error) === null || _video_error === void 0 ? void 0 : _video_error.code) !== 3) return;
|
|
13413
|
+
if (markSingleDecoderLearned() && _this.debug) {
|
|
13414
|
+
console.warn("[StormcloudVideoPlayer] Decoder error while resuming after ads \u2014 using single-decoder mode on this device from the next break");
|
|
13415
|
+
}
|
|
13416
|
+
};
|
|
13417
|
+
video.addEventListener("error", onDecodeError);
|
|
13045
13418
|
var listenersAttached = false;
|
|
13046
13419
|
var onMediaEvent;
|
|
13047
13420
|
var diagEvents = [
|
|
@@ -13091,6 +13464,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13091
13464
|
console.log("[ResumeDiag] +0.0s monitor start — ".concat(this.describeVideoState()));
|
|
13092
13465
|
}
|
|
13093
13466
|
var cleanup = function cleanup() {
|
|
13467
|
+
video.removeEventListener("error", onDecodeError);
|
|
13094
13468
|
if (listenersAttached && onMediaEvent) {
|
|
13095
13469
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
13096
13470
|
try {
|
|
@@ -13121,6 +13495,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13121
13495
|
return;
|
|
13122
13496
|
}
|
|
13123
13497
|
var currentTime = video.currentTime;
|
|
13498
|
+
if (currentTime + 1 < lastSeenTime) {
|
|
13499
|
+
baseline = currentTime;
|
|
13500
|
+
}
|
|
13501
|
+
lastSeenTime = currentTime;
|
|
13124
13502
|
var advanced = currentTime > baseline + 0.5;
|
|
13125
13503
|
var playing = !video.paused && video.readyState >= 3;
|
|
13126
13504
|
if (advanced && playing) {
|
|
@@ -13541,6 +13919,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13541
13919
|
return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
|
|
13542
13920
|
}
|
|
13543
13921
|
});
|
|
13922
|
+
this.adConfig.isLiveStream = function() {
|
|
13923
|
+
return _this.hlsEngine.isLiveStream;
|
|
13924
|
+
};
|
|
13544
13925
|
this.adBreak = new AdBreakOrchestrator({
|
|
13545
13926
|
config: this.config,
|
|
13546
13927
|
video: this.video,
|
|
@@ -13902,16 +14283,20 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13902
14283
|
{
|
|
13903
14284
|
key: "setContentMetadata",
|
|
13904
14285
|
value: function setContentMetadata(meta) {
|
|
13905
|
-
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
14286
|
+
applyContentMetadataUpdate(this.config, meta);
|
|
14287
|
+
}
|
|
14288
|
+
},
|
|
14289
|
+
{
|
|
14290
|
+
key: "setRequestSignals",
|
|
14291
|
+
value: function setRequestSignals(signals) {
|
|
14292
|
+
if (signals.userId !== void 0) {
|
|
14293
|
+
if (signals.userId) this.config.adUserId = signals.userId;
|
|
14294
|
+
else delete this.config.adUserId;
|
|
14295
|
+
}
|
|
14296
|
+
if (signals.ipAddress !== void 0) {
|
|
14297
|
+
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14298
|
+
else delete this.config.clientIpAddress;
|
|
14299
|
+
}
|
|
13915
14300
|
}
|
|
13916
14301
|
},
|
|
13917
14302
|
{
|