stormcloud-video-player 0.8.80 → 0.8.81
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 +2 -1
- package/lib/StormcloudPlayer.cjs +452 -139
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/StormcloudPlayer.d.cts +1 -0
- package/lib/index.cjs +478 -140
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -0
- package/lib/index.d.ts +30 -5
- package/lib/index.js +478 -140
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +37 -9
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +1 -0
- package/lib/player/AdConfigManager.cjs +408 -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 +452 -139
- 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 +452 -139
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -0
- package/lib/players/index.cjs +452 -139
- package/lib/players/index.cjs.map +1 -1
- package/lib/props.d.cts +1 -0
- package/lib/sdk/hlsAdPlayer.d.cts +1 -0
- package/lib/types.d.cts +7 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +478 -140
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -0
- package/lib/utils/__tests__/adSignals.test.cjs +169 -14
- package/lib/utils/__tests__/adSignals.test.cjs.map +1 -1
- package/lib/utils/contentMetadata.cjs +120 -4
- package/lib/utils/contentMetadata.cjs.map +1 -1
- package/lib/utils/contentMetadata.d.cts +37 -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 +294 -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
package/lib/index.cjs
CHANGED
|
@@ -1450,6 +1450,308 @@ function normalizeBoolean(value) {
|
|
|
1450
1450
|
}
|
|
1451
1451
|
return void 0;
|
|
1452
1452
|
}
|
|
1453
|
+
// src/utils/contentMetadata.ts
|
|
1454
|
+
var MAX_CONTENT_VALUE_LENGTH = 128;
|
|
1455
|
+
var BRIDGE_KEYS = {
|
|
1456
|
+
channelName: [
|
|
1457
|
+
"channelName",
|
|
1458
|
+
"ct_ch"
|
|
1459
|
+
],
|
|
1460
|
+
programTitle: [
|
|
1461
|
+
"programTitle",
|
|
1462
|
+
"ct_ti"
|
|
1463
|
+
],
|
|
1464
|
+
contentNetwork: [
|
|
1465
|
+
"contentNetwork",
|
|
1466
|
+
"ct_ne"
|
|
1467
|
+
],
|
|
1468
|
+
contentType: [
|
|
1469
|
+
"contentType",
|
|
1470
|
+
"ctt"
|
|
1471
|
+
],
|
|
1472
|
+
contentCategory: [
|
|
1473
|
+
"contentCategory",
|
|
1474
|
+
"ctc"
|
|
1475
|
+
],
|
|
1476
|
+
contentGenre: [
|
|
1477
|
+
"contentGenre",
|
|
1478
|
+
"ctgr"
|
|
1479
|
+
],
|
|
1480
|
+
contentLanguage: [
|
|
1481
|
+
"contentLanguage",
|
|
1482
|
+
"ctlg"
|
|
1483
|
+
],
|
|
1484
|
+
contentDuration: [
|
|
1485
|
+
"contentDuration",
|
|
1486
|
+
"ctd"
|
|
1487
|
+
],
|
|
1488
|
+
contentSeason: [
|
|
1489
|
+
"contentSeason",
|
|
1490
|
+
"cts"
|
|
1491
|
+
],
|
|
1492
|
+
contentEpisode: [
|
|
1493
|
+
"contentEpisode",
|
|
1494
|
+
"cte"
|
|
1495
|
+
],
|
|
1496
|
+
contentRating: [
|
|
1497
|
+
"contentRating",
|
|
1498
|
+
"ctr"
|
|
1499
|
+
],
|
|
1500
|
+
contentId: [
|
|
1501
|
+
"contentId",
|
|
1502
|
+
"ctid"
|
|
1503
|
+
]
|
|
1504
|
+
};
|
|
1505
|
+
function sanitizeContentValue(value) {
|
|
1506
|
+
if (typeof value !== "string") return void 0;
|
|
1507
|
+
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
1508
|
+
if (!cleaned) return void 0;
|
|
1509
|
+
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
1510
|
+
if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
|
|
1511
|
+
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
1512
|
+
}
|
|
1513
|
+
function sanitizeContentScalar(value) {
|
|
1514
|
+
if (typeof value === "number") {
|
|
1515
|
+
return Number.isFinite(value) ? String(value) : void 0;
|
|
1516
|
+
}
|
|
1517
|
+
return sanitizeContentValue(value);
|
|
1518
|
+
}
|
|
1519
|
+
function normalizeContentLanguage(value) {
|
|
1520
|
+
var cleaned = sanitizeContentValue(value);
|
|
1521
|
+
if (!cleaned) return void 0;
|
|
1522
|
+
var match = cleaned.match(/^([A-Za-z]{2})(?:[-_][A-Za-z0-9]{1,8})*$/);
|
|
1523
|
+
return match && match[1] ? match[1].toLowerCase() : void 0;
|
|
1524
|
+
}
|
|
1525
|
+
function normalizeContentDuration(value) {
|
|
1526
|
+
var raw = sanitizeContentScalar(value);
|
|
1527
|
+
if (raw == null || !/^-?\d+(\.\d+)?$/.test(raw)) return void 0;
|
|
1528
|
+
var seconds = Number(raw);
|
|
1529
|
+
if (seconds === -1) return -1;
|
|
1530
|
+
return seconds > 0 ? Math.round(seconds) : void 0;
|
|
1531
|
+
}
|
|
1532
|
+
function bridgeSources() {
|
|
1533
|
+
if (typeof window === "undefined") return [];
|
|
1534
|
+
var w = window;
|
|
1535
|
+
return [
|
|
1536
|
+
w.__STORMCLOUD_CTV__,
|
|
1537
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
1538
|
+
w.stormcloudCtv
|
|
1539
|
+
].filter(Boolean);
|
|
1540
|
+
}
|
|
1541
|
+
function readBridgeValue2(keys, sanitize) {
|
|
1542
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1543
|
+
try {
|
|
1544
|
+
for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1545
|
+
var source = _step.value;
|
|
1546
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
1547
|
+
try {
|
|
1548
|
+
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
1549
|
+
var key = _step1.value;
|
|
1550
|
+
var value = void 0;
|
|
1551
|
+
try {
|
|
1552
|
+
value = source === null || source === void 0 ? void 0 : source[key];
|
|
1553
|
+
if (typeof value === "function") value = value.call(source);
|
|
1554
|
+
} catch (unused) {
|
|
1555
|
+
value = void 0;
|
|
1556
|
+
}
|
|
1557
|
+
var sanitized = sanitize(value);
|
|
1558
|
+
if (sanitized != null) return sanitized;
|
|
1559
|
+
}
|
|
1560
|
+
} catch (err) {
|
|
1561
|
+
_didIteratorError1 = true;
|
|
1562
|
+
_iteratorError1 = err;
|
|
1563
|
+
} finally{
|
|
1564
|
+
try {
|
|
1565
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
1566
|
+
_iterator1.return();
|
|
1567
|
+
}
|
|
1568
|
+
} finally{
|
|
1569
|
+
if (_didIteratorError1) {
|
|
1570
|
+
throw _iteratorError1;
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
} catch (err) {
|
|
1576
|
+
_didIteratorError = true;
|
|
1577
|
+
_iteratorError = err;
|
|
1578
|
+
} finally{
|
|
1579
|
+
try {
|
|
1580
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1581
|
+
_iterator.return();
|
|
1582
|
+
}
|
|
1583
|
+
} finally{
|
|
1584
|
+
if (_didIteratorError) {
|
|
1585
|
+
throw _iteratorError;
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
return void 0;
|
|
1590
|
+
}
|
|
1591
|
+
function readBridgeContentValue(keys) {
|
|
1592
|
+
return readBridgeValue2(keys, sanitizeContentValue);
|
|
1593
|
+
}
|
|
1594
|
+
function resolveContentMetadata(config) {
|
|
1595
|
+
var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2, _config_contentDetails, _sanitizeContentValue3, _sanitizeContentValue4, _sanitizeContentValue5, _normalizeContentLanguage, _normalizeContentDuration, _sanitizeContentScalar, _sanitizeContentScalar1, _sanitizeContentValue6, _sanitizeContentValue7;
|
|
1596
|
+
var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
|
|
1597
|
+
var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
|
|
1598
|
+
var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
|
|
1599
|
+
var details = (_config_contentDetails = config.contentDetails) !== null && _config_contentDetails !== void 0 ? _config_contentDetails : {};
|
|
1600
|
+
var contentType = (_sanitizeContentValue3 = sanitizeContentValue(details.contentType)) !== null && _sanitizeContentValue3 !== void 0 ? _sanitizeContentValue3 : readBridgeContentValue(BRIDGE_KEYS.contentType);
|
|
1601
|
+
var contentCategory = (_sanitizeContentValue4 = sanitizeContentValue(details.category)) !== null && _sanitizeContentValue4 !== void 0 ? _sanitizeContentValue4 : readBridgeContentValue(BRIDGE_KEYS.contentCategory);
|
|
1602
|
+
var contentGenre = (_sanitizeContentValue5 = sanitizeContentValue(details.genre)) !== null && _sanitizeContentValue5 !== void 0 ? _sanitizeContentValue5 : readBridgeContentValue(BRIDGE_KEYS.contentGenre);
|
|
1603
|
+
var contentLanguage = (_normalizeContentLanguage = normalizeContentLanguage(details.language)) !== null && _normalizeContentLanguage !== void 0 ? _normalizeContentLanguage : readBridgeValue2(BRIDGE_KEYS.contentLanguage, normalizeContentLanguage);
|
|
1604
|
+
var contentDurationSeconds = (_normalizeContentDuration = normalizeContentDuration(details.durationSeconds)) !== null && _normalizeContentDuration !== void 0 ? _normalizeContentDuration : readBridgeValue2(BRIDGE_KEYS.contentDuration, normalizeContentDuration);
|
|
1605
|
+
var contentSeason = (_sanitizeContentScalar = sanitizeContentScalar(details.season)) !== null && _sanitizeContentScalar !== void 0 ? _sanitizeContentScalar : readBridgeValue2(BRIDGE_KEYS.contentSeason, sanitizeContentScalar);
|
|
1606
|
+
var contentEpisode = (_sanitizeContentScalar1 = sanitizeContentScalar(details.episode)) !== null && _sanitizeContentScalar1 !== void 0 ? _sanitizeContentScalar1 : readBridgeValue2(BRIDGE_KEYS.contentEpisode, sanitizeContentScalar);
|
|
1607
|
+
var contentRating = (_sanitizeContentValue6 = sanitizeContentValue(details.rating)) !== null && _sanitizeContentValue6 !== void 0 ? _sanitizeContentValue6 : readBridgeContentValue(BRIDGE_KEYS.contentRating);
|
|
1608
|
+
var contentId = (_sanitizeContentValue7 = sanitizeContentValue(details.contentId)) !== null && _sanitizeContentValue7 !== void 0 ? _sanitizeContentValue7 : readBridgeContentValue(BRIDGE_KEYS.contentId);
|
|
1609
|
+
return _object_spread({}, channelName ? {
|
|
1610
|
+
channelName: channelName
|
|
1611
|
+
} : {}, programTitle ? {
|
|
1612
|
+
programTitle: programTitle
|
|
1613
|
+
} : {}, contentNetwork ? {
|
|
1614
|
+
contentNetwork: contentNetwork
|
|
1615
|
+
} : {}, contentType ? {
|
|
1616
|
+
contentType: contentType
|
|
1617
|
+
} : {}, contentCategory ? {
|
|
1618
|
+
contentCategory: contentCategory
|
|
1619
|
+
} : {}, contentGenre ? {
|
|
1620
|
+
contentGenre: contentGenre
|
|
1621
|
+
} : {}, contentLanguage ? {
|
|
1622
|
+
contentLanguage: contentLanguage
|
|
1623
|
+
} : {}, contentDurationSeconds != null ? {
|
|
1624
|
+
contentDurationSeconds: contentDurationSeconds
|
|
1625
|
+
} : {}, contentSeason ? {
|
|
1626
|
+
contentSeason: contentSeason
|
|
1627
|
+
} : {}, contentEpisode ? {
|
|
1628
|
+
contentEpisode: contentEpisode
|
|
1629
|
+
} : {}, contentRating ? {
|
|
1630
|
+
contentRating: contentRating
|
|
1631
|
+
} : {}, contentId ? {
|
|
1632
|
+
contentId: contentId
|
|
1633
|
+
} : {});
|
|
1634
|
+
}
|
|
1635
|
+
function applyContentMetadataUpdate(target, meta) {
|
|
1636
|
+
var apply = function apply(key, value) {
|
|
1637
|
+
if (value === void 0) return;
|
|
1638
|
+
var clean = value === null ? void 0 : sanitizeContentValue(value);
|
|
1639
|
+
if (clean) target[key] = clean;
|
|
1640
|
+
else delete target[key];
|
|
1641
|
+
};
|
|
1642
|
+
apply("channelName", meta.channelName);
|
|
1643
|
+
apply("programTitle", meta.programTitle);
|
|
1644
|
+
apply("contentNetwork", meta.contentNetwork);
|
|
1645
|
+
if (meta.details === void 0) return;
|
|
1646
|
+
if (meta.details === null) delete target.contentDetails;
|
|
1647
|
+
else target.contentDetails = _object_spread({}, meta.details);
|
|
1648
|
+
}
|
|
1649
|
+
function appendMissingContentParams(url, meta) {
|
|
1650
|
+
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
1651
|
+
try {
|
|
1652
|
+
var parsed = new URL(url);
|
|
1653
|
+
var add = function add(key, value) {
|
|
1654
|
+
if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
|
|
1655
|
+
};
|
|
1656
|
+
add("ct_ch", meta.channelName);
|
|
1657
|
+
add("ct_ti", meta.programTitle);
|
|
1658
|
+
add("ct_ne", meta.contentNetwork);
|
|
1659
|
+
return parsed.toString();
|
|
1660
|
+
} catch (unused) {
|
|
1661
|
+
return url;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
// src/utils/partnerSignals.ts
|
|
1665
|
+
var PLATFORM_IFA_TYPES = /* @__PURE__ */ new Set([
|
|
1666
|
+
"aaid",
|
|
1667
|
+
"adid",
|
|
1668
|
+
"afai",
|
|
1669
|
+
"idfa",
|
|
1670
|
+
"lgudid",
|
|
1671
|
+
"msai",
|
|
1672
|
+
"rida",
|
|
1673
|
+
"tifa",
|
|
1674
|
+
"tvos",
|
|
1675
|
+
"vaid",
|
|
1676
|
+
"vida"
|
|
1677
|
+
]);
|
|
1678
|
+
function toIabIfaType(deviceIdType, source) {
|
|
1679
|
+
if (!deviceIdType) return void 0;
|
|
1680
|
+
var type = deviceIdType.trim().toLowerCase();
|
|
1681
|
+
if (source === "generated") return "sessionid";
|
|
1682
|
+
if (PLATFORM_IFA_TYPES.has(type)) return type;
|
|
1683
|
+
if (source === "platform") return "dpid";
|
|
1684
|
+
return "ppid";
|
|
1685
|
+
}
|
|
1686
|
+
function playbackMethodCode(autoPlay, muted) {
|
|
1687
|
+
if (autoPlay === false) return 3;
|
|
1688
|
+
if (autoPlay !== true || muted == null) return void 0;
|
|
1689
|
+
return muted ? 2 : 1;
|
|
1690
|
+
}
|
|
1691
|
+
function resolvePlayerSize(video) {
|
|
1692
|
+
var width = video ? video.clientWidth : 0;
|
|
1693
|
+
var height = video ? video.clientHeight : 0;
|
|
1694
|
+
if (!(width > 0 && height > 0) && typeof window !== "undefined") {
|
|
1695
|
+
width = window.innerWidth;
|
|
1696
|
+
height = window.innerHeight;
|
|
1697
|
+
}
|
|
1698
|
+
if (!(width > 0 && height > 0)) return {};
|
|
1699
|
+
return {
|
|
1700
|
+
width: Math.round(width),
|
|
1701
|
+
height: Math.round(height)
|
|
1702
|
+
};
|
|
1703
|
+
}
|
|
1704
|
+
function sanitizeUserId(value) {
|
|
1705
|
+
var cleaned = sanitizeContentValue(value);
|
|
1706
|
+
if (!cleaned || /\s/.test(cleaned)) return void 0;
|
|
1707
|
+
return cleaned;
|
|
1708
|
+
}
|
|
1709
|
+
function isPublicIpv4(ip) {
|
|
1710
|
+
var parts = ip.split(".");
|
|
1711
|
+
if (parts.length !== 4) return false;
|
|
1712
|
+
var nums = parts.map(function(p) {
|
|
1713
|
+
return /^\d{1,3}$/.test(p) ? Number(p) : NaN;
|
|
1714
|
+
});
|
|
1715
|
+
if (nums.some(function(n) {
|
|
1716
|
+
return !(n >= 0 && n <= 255);
|
|
1717
|
+
})) return false;
|
|
1718
|
+
var _nums = _sliced_to_array(nums, 2), a = _nums[0], b = _nums[1];
|
|
1719
|
+
if (a === 0 || a === 10 || a === 127 || a >= 224) return false;
|
|
1720
|
+
if (a === 100 && b >= 64 && b <= 127) return false;
|
|
1721
|
+
if (a === 169 && b === 254) return false;
|
|
1722
|
+
if (a === 172 && b >= 16 && b <= 31) return false;
|
|
1723
|
+
if (a === 192 && b === 168) return false;
|
|
1724
|
+
return true;
|
|
1725
|
+
}
|
|
1726
|
+
function isPublicIpv6(ip) {
|
|
1727
|
+
var lower = ip.toLowerCase();
|
|
1728
|
+
if (!/^[0-9a-f:]+$/.test(lower) || lower.split(":").length < 3) return false;
|
|
1729
|
+
if (lower === "::" || lower === "::1") return false;
|
|
1730
|
+
if (/^fe[89ab]/.test(lower)) return false;
|
|
1731
|
+
if (/^f[cd]/.test(lower)) return false;
|
|
1732
|
+
return true;
|
|
1733
|
+
}
|
|
1734
|
+
function sanitizePublicIp(value) {
|
|
1735
|
+
var cleaned = sanitizeContentValue(value);
|
|
1736
|
+
if (!cleaned) return void 0;
|
|
1737
|
+
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1738
|
+
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1739
|
+
}
|
|
1740
|
+
function resolveUserId(configValue) {
|
|
1741
|
+
var _sanitizeUserId;
|
|
1742
|
+
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
1743
|
+
"userId",
|
|
1744
|
+
"uid"
|
|
1745
|
+
], sanitizeUserId);
|
|
1746
|
+
}
|
|
1747
|
+
function resolveClientIp(configValue) {
|
|
1748
|
+
var _sanitizePublicIp;
|
|
1749
|
+
return (_sanitizePublicIp = sanitizePublicIp(configValue)) !== null && _sanitizePublicIp !== void 0 ? _sanitizePublicIp : readBridgeValue2([
|
|
1750
|
+
"ipAddress",
|
|
1751
|
+
"clientIp",
|
|
1752
|
+
"ip"
|
|
1753
|
+
], sanitizePublicIp);
|
|
1754
|
+
}
|
|
1453
1755
|
// src/utils/vastMacros.ts
|
|
1454
1756
|
var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
|
|
1455
1757
|
var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
|
|
@@ -1767,7 +2069,8 @@ var NESTED_QUERY_PARAM_KEYS = /* @__PURE__ */ new Set([
|
|
|
1767
2069
|
var SCVP_POD_MACROS = /* @__PURE__ */ new Set([
|
|
1768
2070
|
"PMND",
|
|
1769
2071
|
"PMXD",
|
|
1770
|
-
"PMAD"
|
|
2072
|
+
"PMAD",
|
|
2073
|
+
"MABD"
|
|
1771
2074
|
]);
|
|
1772
2075
|
function hasScvpMacros(url) {
|
|
1773
2076
|
return !!url && SCVP_MACRO_DETECT.test(url);
|
|
@@ -1812,6 +2115,8 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1812
2115
|
set("RDID", deviceId);
|
|
1813
2116
|
set("IDTYPE", deviceIdType);
|
|
1814
2117
|
set("IS-LAT", (_toFlag = toFlag(ctx.limitAdTracking)) !== null && _toFlag !== void 0 ? _toFlag : "0");
|
|
2118
|
+
set("IFA", deviceId);
|
|
2119
|
+
set("IFA-TYPE", toIabIfaType(deviceIdType, ctx.deviceIdSource));
|
|
1815
2120
|
}
|
|
1816
2121
|
set("SID", ctx.sessionId);
|
|
1817
2122
|
set("DTH", ctx.deviceTypeHint);
|
|
@@ -1829,6 +2134,26 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1829
2134
|
set("GDPR", (_ctx_consent = ctx.consent) === null || _ctx_consent === void 0 ? void 0 : _ctx_consent.gdpr);
|
|
1830
2135
|
set("GDPR-CONSENT", (_ctx_consent1 = ctx.consent) === null || _ctx_consent1 === void 0 ? void 0 : _ctx_consent1.gdprConsent);
|
|
1831
2136
|
set("US-PRIVACY", (_ctx_consent2 = ctx.consent) === null || _ctx_consent2 === void 0 ? void 0 : _ctx_consent2.usPrivacy);
|
|
2137
|
+
set("PLAYER-WIDTH", ctx.playerWidth);
|
|
2138
|
+
set("PLAYER-HEIGHT", ctx.playerHeight);
|
|
2139
|
+
set("TIMESTAMP", ctx.timestamp);
|
|
2140
|
+
set("LIVE", toFlag(ctx.isLive));
|
|
2141
|
+
set("VPMT", playbackMethodCode(ctx.isCtv ? true : ctx.adWillAutoPlay, ctx.adWillPlayMuted));
|
|
2142
|
+
set("DEVICE-MAKE", ctx.deviceMake);
|
|
2143
|
+
set("DEVICE-MODEL", ctx.deviceModel);
|
|
2144
|
+
set("DEVICE-HWV", ctx.deviceHardwareVersion);
|
|
2145
|
+
set("UA", ctx.userAgent);
|
|
2146
|
+
set("IP", ctx.ipAddress);
|
|
2147
|
+
set("UID", ctx.userId);
|
|
2148
|
+
set("CT-TYPE", ctx.contentType);
|
|
2149
|
+
set("CT-CATEGORY", ctx.contentCategory);
|
|
2150
|
+
set("CT-GENRE", ctx.contentGenre);
|
|
2151
|
+
set("CT-LANGUAGE", ctx.contentLanguage);
|
|
2152
|
+
set("CT-DURATION", ctx.contentDurationSeconds != null ? ctx.contentDurationSeconds : ctx.isLive ? -1 : void 0);
|
|
2153
|
+
set("CT-SEASON", ctx.contentSeason);
|
|
2154
|
+
set("CT-EPISODE", ctx.contentEpisode);
|
|
2155
|
+
set("CT-RATING", ctx.contentRating);
|
|
2156
|
+
set("CT-ID", ctx.contentId);
|
|
1832
2157
|
return values;
|
|
1833
2158
|
}
|
|
1834
2159
|
var keepNone = function keepNone() {
|
|
@@ -3076,15 +3401,20 @@ function finalizeGamRequestUrl(rawUrl, ctx) {
|
|
|
3076
3401
|
values.set("PMND", String(pod.pmnd));
|
|
3077
3402
|
values.set("PMXD", String(pod.pmxd));
|
|
3078
3403
|
if (pod.pmad != null) values.set("PMAD", String(pod.pmad));
|
|
3404
|
+
values.set("MABD", String(Math.max(1, Math.floor(pod.pmxd / 1e3))));
|
|
3079
3405
|
}
|
|
3080
3406
|
var substituted = substituteScvpMacros(rawUrl, values);
|
|
3081
3407
|
var finalUrl;
|
|
3082
3408
|
try {
|
|
3083
3409
|
var url = new URL(normalizeVastTagUrl(substituted.url));
|
|
3410
|
+
var isGam = GAM_AD_HOSTS.has(url.hostname);
|
|
3411
|
+
var setPodParam = function setPodParam(key, value) {
|
|
3412
|
+
if (isGam || url.searchParams.has(key)) url.searchParams.set(key, String(value));
|
|
3413
|
+
};
|
|
3084
3414
|
if (pod) {
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
if (pod.pmad != null)
|
|
3415
|
+
setPodParam("pmnd", pod.pmnd);
|
|
3416
|
+
setPodParam("pmxd", pod.pmxd);
|
|
3417
|
+
if (pod.pmad != null) setPodParam("pmad", pod.pmad);
|
|
3088
3418
|
else url.searchParams.delete("pmad");
|
|
3089
3419
|
} else {
|
|
3090
3420
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -3150,7 +3480,9 @@ function validateGamRequestUrl(url, expect) {
|
|
|
3150
3480
|
if (leftover.length > 0) problems.push("unresolved SCVP macros: ".concat(leftover.join(", ")));
|
|
3151
3481
|
var params;
|
|
3152
3482
|
try {
|
|
3153
|
-
|
|
3483
|
+
var parsed = new URL(url);
|
|
3484
|
+
if (!GAM_AD_HOSTS.has(parsed.hostname)) return problems;
|
|
3485
|
+
params = parsed.searchParams;
|
|
3154
3486
|
} catch (unused) {
|
|
3155
3487
|
return problems.concat("URL could not be parsed");
|
|
3156
3488
|
}
|
|
@@ -6571,7 +6903,7 @@ function safeCall2(fn, thisArg) {
|
|
|
6571
6903
|
function userAgent() {
|
|
6572
6904
|
return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
|
|
6573
6905
|
}
|
|
6574
|
-
function
|
|
6906
|
+
function bridgeSources2() {
|
|
6575
6907
|
if (typeof window === "undefined") return [];
|
|
6576
6908
|
var w = window;
|
|
6577
6909
|
return [
|
|
@@ -6583,7 +6915,7 @@ function bridgeSources() {
|
|
|
6583
6915
|
function readBridge(keys) {
|
|
6584
6916
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6585
6917
|
try {
|
|
6586
|
-
for(var _iterator =
|
|
6918
|
+
for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6587
6919
|
var source = _step.value;
|
|
6588
6920
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
6589
6921
|
try {
|
|
@@ -6630,6 +6962,11 @@ function readBridge(keys) {
|
|
|
6630
6962
|
}
|
|
6631
6963
|
return void 0;
|
|
6632
6964
|
}
|
|
6965
|
+
function makeForCategory(category) {
|
|
6966
|
+
if (category === "LG TV" || category === "LG Set-Top Box") return "LG";
|
|
6967
|
+
if (category === "Samsung TV") return "Samsung";
|
|
6968
|
+
return void 0;
|
|
6969
|
+
}
|
|
6633
6970
|
function normalizeCategory(value) {
|
|
6634
6971
|
var v = cleanString(value);
|
|
6635
6972
|
if (!v) return void 0;
|
|
@@ -6777,7 +7114,7 @@ function primeDeviceInfo() {
|
|
|
6777
7114
|
return primePromise;
|
|
6778
7115
|
}
|
|
6779
7116
|
function getDeviceInfo() {
|
|
6780
|
-
var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
|
|
7117
|
+
var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory, _ref3, _cleanString4, _cleanString5;
|
|
6781
7118
|
var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
|
|
6782
7119
|
if (primePromise && !platformCache) {} else {
|
|
6783
7120
|
platformCache = platform;
|
|
@@ -6800,7 +7137,14 @@ function getDeviceInfo() {
|
|
|
6800
7137
|
]),
|
|
6801
7138
|
category: normalizeCategory(readBridge([
|
|
6802
7139
|
"deviceCategory"
|
|
6803
|
-
]))
|
|
7140
|
+
])),
|
|
7141
|
+
make: readBridge([
|
|
7142
|
+
"deviceMake"
|
|
7143
|
+
]),
|
|
7144
|
+
hardwareVersion: readBridge([
|
|
7145
|
+
"deviceHardwareVersion",
|
|
7146
|
+
"hardwareVersion"
|
|
7147
|
+
])
|
|
6804
7148
|
};
|
|
6805
7149
|
var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
|
|
6806
7150
|
var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
|
|
@@ -6813,7 +7157,9 @@ function getDeviceInfo() {
|
|
|
6813
7157
|
bridge.internalDeviceId,
|
|
6814
7158
|
bridge.model,
|
|
6815
7159
|
bridge.firmware,
|
|
6816
|
-
bridge.category
|
|
7160
|
+
bridge.category,
|
|
7161
|
+
bridge.make,
|
|
7162
|
+
bridge.hardwareVersion
|
|
6817
7163
|
];
|
|
6818
7164
|
if (bridgeValues.some(function(v) {
|
|
6819
7165
|
return v !== void 0;
|
|
@@ -6821,12 +7167,18 @@ function getDeviceInfo() {
|
|
|
6821
7167
|
if (hostDeviceInfo) sources.unshift("host");
|
|
6822
7168
|
var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
|
|
6823
7169
|
var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
|
|
7170
|
+
var make = (_ref3 = (_cleanString4 = cleanString(host.make, 40)) !== null && _cleanString4 !== void 0 ? _cleanString4 : bridge.make) !== null && _ref3 !== void 0 ? _ref3 : makeForCategory(category);
|
|
7171
|
+
var hardwareVersion = (_cleanString5 = cleanString(host.hardwareVersion, 40)) !== null && _cleanString5 !== void 0 ? _cleanString5 : bridge.hardwareVersion;
|
|
6824
7172
|
var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
|
|
6825
7173
|
return _object_spread_props(_object_spread({
|
|
6826
7174
|
category: category,
|
|
6827
7175
|
categoryCode: CATEGORY_CODES[category]
|
|
6828
|
-
},
|
|
7176
|
+
}, make ? {
|
|
7177
|
+
make: make
|
|
7178
|
+
} : {}, model ? {
|
|
6829
7179
|
model: model
|
|
7180
|
+
} : {}, hardwareVersion ? {
|
|
7181
|
+
hardwareVersion: hardwareVersion
|
|
6830
7182
|
} : {}, sonifiModel ? {
|
|
6831
7183
|
sonifiModel: sonifiModel
|
|
6832
7184
|
} : {}, firmware ? {
|
|
@@ -6917,117 +7269,6 @@ function deviceInfoAnalyticsFields(info) {
|
|
|
6917
7269
|
terminal_id: info.terminalId
|
|
6918
7270
|
} : {});
|
|
6919
7271
|
}
|
|
6920
|
-
// src/utils/contentMetadata.ts
|
|
6921
|
-
var MAX_CONTENT_VALUE_LENGTH = 128;
|
|
6922
|
-
var BRIDGE_KEYS = {
|
|
6923
|
-
channelName: [
|
|
6924
|
-
"channelName",
|
|
6925
|
-
"ct_ch"
|
|
6926
|
-
],
|
|
6927
|
-
programTitle: [
|
|
6928
|
-
"programTitle",
|
|
6929
|
-
"ct_ti"
|
|
6930
|
-
],
|
|
6931
|
-
contentNetwork: [
|
|
6932
|
-
"contentNetwork",
|
|
6933
|
-
"ct_ne"
|
|
6934
|
-
]
|
|
6935
|
-
};
|
|
6936
|
-
function sanitizeContentValue(value) {
|
|
6937
|
-
if (typeof value !== "string") return void 0;
|
|
6938
|
-
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
6939
|
-
if (!cleaned) return void 0;
|
|
6940
|
-
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
6941
|
-
if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
|
|
6942
|
-
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
6943
|
-
}
|
|
6944
|
-
function bridgeSources2() {
|
|
6945
|
-
if (typeof window === "undefined") return [];
|
|
6946
|
-
var w = window;
|
|
6947
|
-
return [
|
|
6948
|
-
w.__STORMCLOUD_CTV__,
|
|
6949
|
-
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
6950
|
-
w.stormcloudCtv
|
|
6951
|
-
].filter(Boolean);
|
|
6952
|
-
}
|
|
6953
|
-
function readBridgeContentValue(keys) {
|
|
6954
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6955
|
-
try {
|
|
6956
|
-
for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6957
|
-
var source = _step.value;
|
|
6958
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
6959
|
-
try {
|
|
6960
|
-
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
6961
|
-
var key = _step1.value;
|
|
6962
|
-
var value = void 0;
|
|
6963
|
-
try {
|
|
6964
|
-
value = source === null || source === void 0 ? void 0 : source[key];
|
|
6965
|
-
if (typeof value === "function") value = value.call(source);
|
|
6966
|
-
} catch (unused) {
|
|
6967
|
-
value = void 0;
|
|
6968
|
-
}
|
|
6969
|
-
var sanitized = sanitizeContentValue(value);
|
|
6970
|
-
if (sanitized) return sanitized;
|
|
6971
|
-
}
|
|
6972
|
-
} catch (err) {
|
|
6973
|
-
_didIteratorError1 = true;
|
|
6974
|
-
_iteratorError1 = err;
|
|
6975
|
-
} finally{
|
|
6976
|
-
try {
|
|
6977
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
6978
|
-
_iterator1.return();
|
|
6979
|
-
}
|
|
6980
|
-
} finally{
|
|
6981
|
-
if (_didIteratorError1) {
|
|
6982
|
-
throw _iteratorError1;
|
|
6983
|
-
}
|
|
6984
|
-
}
|
|
6985
|
-
}
|
|
6986
|
-
}
|
|
6987
|
-
} catch (err) {
|
|
6988
|
-
_didIteratorError = true;
|
|
6989
|
-
_iteratorError = err;
|
|
6990
|
-
} finally{
|
|
6991
|
-
try {
|
|
6992
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
6993
|
-
_iterator.return();
|
|
6994
|
-
}
|
|
6995
|
-
} finally{
|
|
6996
|
-
if (_didIteratorError) {
|
|
6997
|
-
throw _iteratorError;
|
|
6998
|
-
}
|
|
6999
|
-
}
|
|
7000
|
-
}
|
|
7001
|
-
return void 0;
|
|
7002
|
-
}
|
|
7003
|
-
function resolveContentMetadata(config) {
|
|
7004
|
-
var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2;
|
|
7005
|
-
var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
|
|
7006
|
-
var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
|
|
7007
|
-
var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
|
|
7008
|
-
return _object_spread({}, channelName ? {
|
|
7009
|
-
channelName: channelName
|
|
7010
|
-
} : {}, programTitle ? {
|
|
7011
|
-
programTitle: programTitle
|
|
7012
|
-
} : {}, contentNetwork ? {
|
|
7013
|
-
contentNetwork: contentNetwork
|
|
7014
|
-
} : {});
|
|
7015
|
-
}
|
|
7016
|
-
function appendMissingContentParams(url, meta) {
|
|
7017
|
-
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
7018
|
-
try {
|
|
7019
|
-
var parsed = new URL(url);
|
|
7020
|
-
var add = function add(key, value) {
|
|
7021
|
-
if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
|
|
7022
|
-
};
|
|
7023
|
-
add("ct_ch", meta.channelName);
|
|
7024
|
-
add("ct_ti", meta.programTitle);
|
|
7025
|
-
add("ct_ne", meta.contentNetwork);
|
|
7026
|
-
return parsed.toString();
|
|
7027
|
-
} catch (unused) {
|
|
7028
|
-
return url;
|
|
7029
|
-
}
|
|
7030
|
-
}
|
|
7031
7272
|
// src/utils/screenActivity.ts
|
|
7032
7273
|
var hostStandby = false;
|
|
7033
7274
|
function setHostStandby(standby) {
|
|
@@ -9035,6 +9276,13 @@ var Scte35CueManager = /*#__PURE__*/ function() {
|
|
|
9035
9276
|
return Scte35CueManager;
|
|
9036
9277
|
}();
|
|
9037
9278
|
// src/player/AdConfigManager.ts
|
|
9279
|
+
function isGamAdUrl(rawUrl) {
|
|
9280
|
+
try {
|
|
9281
|
+
return GAM_AD_HOSTS.has(new URL(rawUrl).hostname);
|
|
9282
|
+
} catch (unused) {
|
|
9283
|
+
return false;
|
|
9284
|
+
}
|
|
9285
|
+
}
|
|
9038
9286
|
function withDeferredPodParams(rawUrl, deferNonce) {
|
|
9039
9287
|
try {
|
|
9040
9288
|
var url = new URL(rawUrl);
|
|
@@ -9052,11 +9300,15 @@ function withDeferredPodParams(rawUrl, deferNonce) {
|
|
|
9052
9300
|
}
|
|
9053
9301
|
var AdConfigManager = /*#__PURE__*/ function() {
|
|
9054
9302
|
function AdConfigManager(config, video) {
|
|
9303
|
+
var _this = this;
|
|
9055
9304
|
_class_call_check(this, AdConfigManager);
|
|
9056
9305
|
this.vmapBreaks = [];
|
|
9057
9306
|
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
9058
9307
|
this.streamCorrelator = generateCorrelator();
|
|
9059
9308
|
this.consentSignals = {};
|
|
9309
|
+
this.isLiveStream = function() {
|
|
9310
|
+
return !!_this.config.isLiveStream;
|
|
9311
|
+
};
|
|
9060
9312
|
this.podCounter = 0;
|
|
9061
9313
|
this.podAssignedByPrefetch = false;
|
|
9062
9314
|
this.lastHeartbeatTime = 0;
|
|
@@ -9507,13 +9759,22 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9507
9759
|
{
|
|
9508
9760
|
key: "generatePodVastUrl",
|
|
9509
9761
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9762
|
+
var _content_contentDurationSeconds;
|
|
9510
9763
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9511
9764
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9512
9765
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9513
9766
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
9514
9767
|
});
|
|
9515
9768
|
var content = resolveContentMetadata(this.config);
|
|
9516
|
-
var
|
|
9769
|
+
var isLive = this.isLiveStream();
|
|
9770
|
+
var device = getDeviceInfo();
|
|
9771
|
+
var playerSize = resolvePlayerSize(this.video);
|
|
9772
|
+
var videoDuration = this.video.duration;
|
|
9773
|
+
var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
|
|
9774
|
+
var userId = resolveUserId(this.config.adUserId);
|
|
9775
|
+
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9776
|
+
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9777
|
+
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
9517
9778
|
correlator: this.viewCorrelator,
|
|
9518
9779
|
streamCorrelator: this.streamCorrelator,
|
|
9519
9780
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
@@ -9535,8 +9796,46 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9535
9796
|
contentNetwork: content.contentNetwork
|
|
9536
9797
|
} : {}), {
|
|
9537
9798
|
consent: this.consentSignals,
|
|
9538
|
-
palNonce: palNonce.getCurrentNonce() || void 0
|
|
9539
|
-
|
|
9799
|
+
palNonce: palNonce.getCurrentNonce() || void 0,
|
|
9800
|
+
deviceIdSource: envSignals.deviceIdSource,
|
|
9801
|
+
isLive: isLive
|
|
9802
|
+
}), playerSize.width ? {
|
|
9803
|
+
playerWidth: playerSize.width
|
|
9804
|
+
} : {}, playerSize.height ? {
|
|
9805
|
+
playerHeight: playerSize.height
|
|
9806
|
+
} : {}), {
|
|
9807
|
+
timestamp: String(Date.now())
|
|
9808
|
+
}), device.make ? {
|
|
9809
|
+
deviceMake: device.make
|
|
9810
|
+
} : {}, device.model ? {
|
|
9811
|
+
deviceModel: device.model
|
|
9812
|
+
} : {}, device.hardwareVersion ? {
|
|
9813
|
+
deviceHardwareVersion: device.hardwareVersion
|
|
9814
|
+
} : {}, userAgent2 ? {
|
|
9815
|
+
userAgent: userAgent2
|
|
9816
|
+
} : {}, ipAddress ? {
|
|
9817
|
+
ipAddress: ipAddress
|
|
9818
|
+
} : {}, userId ? {
|
|
9819
|
+
userId: userId
|
|
9820
|
+
} : {}, content.contentType ? {
|
|
9821
|
+
contentType: content.contentType
|
|
9822
|
+
} : {}, content.contentCategory ? {
|
|
9823
|
+
contentCategory: content.contentCategory
|
|
9824
|
+
} : {}, content.contentGenre ? {
|
|
9825
|
+
contentGenre: content.contentGenre
|
|
9826
|
+
} : {}, content.contentLanguage ? {
|
|
9827
|
+
contentLanguage: content.contentLanguage
|
|
9828
|
+
} : {}, contentDurationSeconds != null ? {
|
|
9829
|
+
contentDurationSeconds: contentDurationSeconds
|
|
9830
|
+
} : {}, content.contentSeason ? {
|
|
9831
|
+
contentSeason: content.contentSeason
|
|
9832
|
+
} : {}, content.contentEpisode ? {
|
|
9833
|
+
contentEpisode: content.contentEpisode
|
|
9834
|
+
} : {}, content.contentRating ? {
|
|
9835
|
+
contentRating: content.contentRating
|
|
9836
|
+
} : {}, content.contentId ? {
|
|
9837
|
+
contentId: content.contentId
|
|
9838
|
+
} : {});
|
|
9540
9839
|
var nonceReady = !!macroContext.palNonce;
|
|
9541
9840
|
var finalUrl;
|
|
9542
9841
|
if (hasScvpMacros(baseUrl)) {
|
|
@@ -9550,9 +9849,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9550
9849
|
} else {
|
|
9551
9850
|
finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
|
|
9552
9851
|
}
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9852
|
+
if (isGamAdUrl(finalUrl)) {
|
|
9853
|
+
finalUrl = appendMissingContentParams(finalUrl, content);
|
|
9854
|
+
if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
|
|
9855
|
+
finalUrl = applyDeviceKeyValues(finalUrl, device);
|
|
9856
|
+
}
|
|
9556
9857
|
}
|
|
9557
9858
|
if (this.debug) {
|
|
9558
9859
|
var id = envSignals.deviceId;
|
|
@@ -9565,7 +9866,12 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9565
9866
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9566
9867
|
ct_ch: content.channelName,
|
|
9567
9868
|
ct_ti: content.programTitle,
|
|
9568
|
-
ct_ne: content.contentNetwork
|
|
9869
|
+
ct_ne: content.contentNetwork,
|
|
9870
|
+
ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
|
|
9871
|
+
live: isLive,
|
|
9872
|
+
player: playerSize,
|
|
9873
|
+
make: device.make,
|
|
9874
|
+
model: device.model
|
|
9569
9875
|
});
|
|
9570
9876
|
}
|
|
9571
9877
|
console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
|
|
@@ -13736,6 +14042,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13736
14042
|
return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
|
|
13737
14043
|
}
|
|
13738
14044
|
});
|
|
14045
|
+
this.adConfig.isLiveStream = function() {
|
|
14046
|
+
return _this.hlsEngine.isLiveStream;
|
|
14047
|
+
};
|
|
13739
14048
|
this.adBreak = new AdBreakOrchestrator({
|
|
13740
14049
|
config: this.config,
|
|
13741
14050
|
video: this.video,
|
|
@@ -14097,16 +14406,20 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14097
14406
|
{
|
|
14098
14407
|
key: "setContentMetadata",
|
|
14099
14408
|
value: function setContentMetadata(meta) {
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14409
|
+
applyContentMetadataUpdate(this.config, meta);
|
|
14410
|
+
}
|
|
14411
|
+
},
|
|
14412
|
+
{
|
|
14413
|
+
key: "setRequestSignals",
|
|
14414
|
+
value: function setRequestSignals(signals) {
|
|
14415
|
+
if (signals.userId !== void 0) {
|
|
14416
|
+
if (signals.userId) this.config.adUserId = signals.userId;
|
|
14417
|
+
else delete this.config.adUserId;
|
|
14418
|
+
}
|
|
14419
|
+
if (signals.ipAddress !== void 0) {
|
|
14420
|
+
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14421
|
+
else delete this.config.clientIpAddress;
|
|
14422
|
+
}
|
|
14110
14423
|
}
|
|
14111
14424
|
},
|
|
14112
14425
|
{
|
|
@@ -14822,7 +15135,7 @@ var CRITICAL_PROPS = [
|
|
|
14822
15135
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
14823
15136
|
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
14824
15137
|
var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
14825
|
-
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, isLiveStream = props.isLiveStream, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastTagUrl = props.vastTagUrl, isVmap = props.isVmap, vmapUrl = props.vmapUrl, minSegmentsBeforePlay = props.minSegmentsBeforePlay, ctvAdRequest = props.ctvAdRequest, programTitle = props.programTitle, channelName = props.channelName, contentNetwork = props.contentNetwork, minRemainingMsToStartAd = props.minRemainingMsToStartAd, minRemainingMsToRequestAd = props.minRemainingMsToRequestAd, maxNoFillsPerBreak = props.maxNoFillsPerBreak, maxAdBreakExtensionMs = props.maxAdBreakExtensionMs, adDeviceId = props.adDeviceId, adDeviceIdType = props.adDeviceIdType, adLimitAdTracking = props.adLimitAdTracking, fallbackDeviceIdMaxAgeMs = props.fallbackDeviceIdMaxAgeMs, sessionIdMaxAgeMs = props.sessionIdMaxAgeMs, palIconsSupported = props.palIconsSupported, palSupportedApiFrameworks = props.palSupportedApiFrameworks, palContinuousPlayback = props.palContinuousPlayback, palNonceMaxAgeMs = props.palNonceMaxAgeMs, forceSingleDecoderMode = props.forceSingleDecoderMode, deviceInfo = props.deviceInfo, sendDeviceKeyValues = props.sendDeviceKeyValues, sendDeviceInfoToAnalytics = props.sendDeviceInfoToAnalytics, restVideoAttrs = _object_without_properties(props, [
|
|
15138
|
+
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, isLiveStream = props.isLiveStream, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastTagUrl = props.vastTagUrl, isVmap = props.isVmap, vmapUrl = props.vmapUrl, minSegmentsBeforePlay = props.minSegmentsBeforePlay, ctvAdRequest = props.ctvAdRequest, programTitle = props.programTitle, channelName = props.channelName, contentNetwork = props.contentNetwork, contentDetails = props.contentDetails, adUserId = props.adUserId, clientIpAddress = props.clientIpAddress, minRemainingMsToStartAd = props.minRemainingMsToStartAd, minRemainingMsToRequestAd = props.minRemainingMsToRequestAd, maxNoFillsPerBreak = props.maxNoFillsPerBreak, maxAdBreakExtensionMs = props.maxAdBreakExtensionMs, adDeviceId = props.adDeviceId, adDeviceIdType = props.adDeviceIdType, adLimitAdTracking = props.adLimitAdTracking, fallbackDeviceIdMaxAgeMs = props.fallbackDeviceIdMaxAgeMs, sessionIdMaxAgeMs = props.sessionIdMaxAgeMs, palIconsSupported = props.palIconsSupported, palSupportedApiFrameworks = props.palSupportedApiFrameworks, palContinuousPlayback = props.palContinuousPlayback, palNonceMaxAgeMs = props.palNonceMaxAgeMs, forceSingleDecoderMode = props.forceSingleDecoderMode, deviceInfo = props.deviceInfo, sendDeviceKeyValues = props.sendDeviceKeyValues, sendDeviceInfoToAnalytics = props.sendDeviceInfoToAnalytics, restVideoAttrs = _object_without_properties(props, [
|
|
14826
15139
|
"src",
|
|
14827
15140
|
"autoplay",
|
|
14828
15141
|
"muted",
|
|
@@ -14856,6 +15169,9 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
14856
15169
|
"programTitle",
|
|
14857
15170
|
"channelName",
|
|
14858
15171
|
"contentNetwork",
|
|
15172
|
+
"contentDetails",
|
|
15173
|
+
"adUserId",
|
|
15174
|
+
"clientIpAddress",
|
|
14859
15175
|
"minRemainingMsToStartAd",
|
|
14860
15176
|
"minRemainingMsToRequestAd",
|
|
14861
15177
|
"maxNoFillsPerBreak",
|
|
@@ -15064,6 +15380,9 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
15064
15380
|
if (programTitle !== void 0) cfg.programTitle = programTitle;
|
|
15065
15381
|
if (channelName !== void 0) cfg.channelName = channelName;
|
|
15066
15382
|
if (contentNetwork !== void 0) cfg.contentNetwork = contentNetwork;
|
|
15383
|
+
if (contentDetails !== void 0) cfg.contentDetails = contentDetails;
|
|
15384
|
+
if (adUserId !== void 0) cfg.adUserId = adUserId;
|
|
15385
|
+
if (clientIpAddress !== void 0) cfg.clientIpAddress = clientIpAddress;
|
|
15067
15386
|
if (minRemainingMsToStartAd !== void 0) cfg.minRemainingMsToStartAd = minRemainingMsToStartAd;
|
|
15068
15387
|
if (minRemainingMsToRequestAd !== void 0) cfg.minRemainingMsToRequestAd = minRemainingMsToRequestAd;
|
|
15069
15388
|
if (maxNoFillsPerBreak !== void 0) cfg.maxNoFillsPerBreak = maxNoFillsPerBreak;
|
|
@@ -15132,6 +15451,25 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
15132
15451
|
programTitle,
|
|
15133
15452
|
contentNetwork
|
|
15134
15453
|
]);
|
|
15454
|
+
var contentDetailsKey = contentDetails ? JSON.stringify(contentDetails) : "";
|
|
15455
|
+
(0, import_react.useEffect)(function() {
|
|
15456
|
+
var _playerRef_current;
|
|
15457
|
+
(_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.setContentMetadata({
|
|
15458
|
+
details: contentDetailsKey ? JSON.parse(contentDetailsKey) : null
|
|
15459
|
+
});
|
|
15460
|
+
}, [
|
|
15461
|
+
contentDetailsKey
|
|
15462
|
+
]);
|
|
15463
|
+
(0, import_react.useEffect)(function() {
|
|
15464
|
+
var _playerRef_current;
|
|
15465
|
+
(_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.setRequestSignals({
|
|
15466
|
+
userId: adUserId !== null && adUserId !== void 0 ? adUserId : null,
|
|
15467
|
+
ipAddress: clientIpAddress !== null && clientIpAddress !== void 0 ? clientIpAddress : null
|
|
15468
|
+
});
|
|
15469
|
+
}, [
|
|
15470
|
+
adUserId,
|
|
15471
|
+
clientIpAddress
|
|
15472
|
+
]);
|
|
15135
15473
|
var lastAdDeviceIdRef = (0, import_react.useRef)(void 0);
|
|
15136
15474
|
(0, import_react.useEffect)(function() {
|
|
15137
15475
|
var player = playerRef.current;
|