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
package/lib/players/index.cjs
CHANGED
|
@@ -1329,6 +1329,319 @@ function normalizeBoolean(value) {
|
|
|
1329
1329
|
}
|
|
1330
1330
|
return void 0;
|
|
1331
1331
|
}
|
|
1332
|
+
// src/utils/contentMetadata.ts
|
|
1333
|
+
var MAX_CONTENT_VALUE_LENGTH = 128;
|
|
1334
|
+
var BRIDGE_KEYS = {
|
|
1335
|
+
channelName: [
|
|
1336
|
+
"channelName",
|
|
1337
|
+
"ct_ch"
|
|
1338
|
+
],
|
|
1339
|
+
programTitle: [
|
|
1340
|
+
"programTitle",
|
|
1341
|
+
"ct_ti"
|
|
1342
|
+
],
|
|
1343
|
+
contentNetwork: [
|
|
1344
|
+
"contentNetwork",
|
|
1345
|
+
"ct_ne"
|
|
1346
|
+
],
|
|
1347
|
+
contentType: [
|
|
1348
|
+
"contentType",
|
|
1349
|
+
"ctt"
|
|
1350
|
+
],
|
|
1351
|
+
contentCategory: [
|
|
1352
|
+
"contentCategory",
|
|
1353
|
+
"ctc"
|
|
1354
|
+
],
|
|
1355
|
+
contentGenre: [
|
|
1356
|
+
"contentGenre",
|
|
1357
|
+
"ctgr"
|
|
1358
|
+
],
|
|
1359
|
+
contentLanguage: [
|
|
1360
|
+
"contentLanguage",
|
|
1361
|
+
"ctlg"
|
|
1362
|
+
],
|
|
1363
|
+
contentDuration: [
|
|
1364
|
+
"contentDuration",
|
|
1365
|
+
"ctd"
|
|
1366
|
+
],
|
|
1367
|
+
contentSeason: [
|
|
1368
|
+
"contentSeason",
|
|
1369
|
+
"cts"
|
|
1370
|
+
],
|
|
1371
|
+
contentEpisode: [
|
|
1372
|
+
"contentEpisode",
|
|
1373
|
+
"cte"
|
|
1374
|
+
],
|
|
1375
|
+
contentRating: [
|
|
1376
|
+
"contentRating",
|
|
1377
|
+
"ctr",
|
|
1378
|
+
"programRating",
|
|
1379
|
+
"rating"
|
|
1380
|
+
],
|
|
1381
|
+
contentId: [
|
|
1382
|
+
"contentId",
|
|
1383
|
+
"ctid"
|
|
1384
|
+
]
|
|
1385
|
+
};
|
|
1386
|
+
function sanitizeContentValue(value) {
|
|
1387
|
+
if (typeof value !== "string") return void 0;
|
|
1388
|
+
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
1389
|
+
if (!cleaned) return void 0;
|
|
1390
|
+
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
1391
|
+
if (/^(unknown|null|undefined|none|n\/a|-|tbd|tba|to be (announced|determined))$/i.test(cleaned)) {
|
|
1392
|
+
return void 0;
|
|
1393
|
+
}
|
|
1394
|
+
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
1395
|
+
}
|
|
1396
|
+
function sanitizeContentScalar(value) {
|
|
1397
|
+
if (typeof value === "number") {
|
|
1398
|
+
return Number.isFinite(value) ? String(value) : void 0;
|
|
1399
|
+
}
|
|
1400
|
+
return sanitizeContentValue(value);
|
|
1401
|
+
}
|
|
1402
|
+
function normalizeContentLanguage(value) {
|
|
1403
|
+
var cleaned = sanitizeContentValue(value);
|
|
1404
|
+
if (!cleaned) return void 0;
|
|
1405
|
+
var match = cleaned.match(/^([A-Za-z]{2})(?:[-_][A-Za-z0-9]{1,8})*$/);
|
|
1406
|
+
return match && match[1] ? match[1].toLowerCase() : void 0;
|
|
1407
|
+
}
|
|
1408
|
+
function normalizeContentDuration(value) {
|
|
1409
|
+
var raw = sanitizeContentScalar(value);
|
|
1410
|
+
if (raw == null || !/^-?\d+(\.\d+)?$/.test(raw)) return void 0;
|
|
1411
|
+
var seconds = Number(raw);
|
|
1412
|
+
if (seconds === -1) return -1;
|
|
1413
|
+
return seconds > 0 ? Math.round(seconds) : void 0;
|
|
1414
|
+
}
|
|
1415
|
+
function bridgeSources() {
|
|
1416
|
+
if (typeof window === "undefined") return [];
|
|
1417
|
+
var w = window;
|
|
1418
|
+
return [
|
|
1419
|
+
w.__STORMCLOUD_CTV__,
|
|
1420
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
1421
|
+
w.stormcloudCtv
|
|
1422
|
+
].filter(Boolean);
|
|
1423
|
+
}
|
|
1424
|
+
function readBridgeValue2(keys, sanitize) {
|
|
1425
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1426
|
+
try {
|
|
1427
|
+
for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1428
|
+
var source = _step.value;
|
|
1429
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
1430
|
+
try {
|
|
1431
|
+
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
1432
|
+
var key = _step1.value;
|
|
1433
|
+
var value = void 0;
|
|
1434
|
+
try {
|
|
1435
|
+
value = source === null || source === void 0 ? void 0 : source[key];
|
|
1436
|
+
if (typeof value === "function") value = value.call(source);
|
|
1437
|
+
} catch (unused) {
|
|
1438
|
+
value = void 0;
|
|
1439
|
+
}
|
|
1440
|
+
var sanitized = sanitize(value);
|
|
1441
|
+
if (sanitized != null) return sanitized;
|
|
1442
|
+
}
|
|
1443
|
+
} catch (err) {
|
|
1444
|
+
_didIteratorError1 = true;
|
|
1445
|
+
_iteratorError1 = err;
|
|
1446
|
+
} finally{
|
|
1447
|
+
try {
|
|
1448
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
1449
|
+
_iterator1.return();
|
|
1450
|
+
}
|
|
1451
|
+
} finally{
|
|
1452
|
+
if (_didIteratorError1) {
|
|
1453
|
+
throw _iteratorError1;
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
} catch (err) {
|
|
1459
|
+
_didIteratorError = true;
|
|
1460
|
+
_iteratorError = err;
|
|
1461
|
+
} finally{
|
|
1462
|
+
try {
|
|
1463
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1464
|
+
_iterator.return();
|
|
1465
|
+
}
|
|
1466
|
+
} finally{
|
|
1467
|
+
if (_didIteratorError) {
|
|
1468
|
+
throw _iteratorError;
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
return void 0;
|
|
1473
|
+
}
|
|
1474
|
+
function readBridgeContentValue(keys) {
|
|
1475
|
+
return readBridgeValue2(keys, sanitizeContentValue);
|
|
1476
|
+
}
|
|
1477
|
+
function resolveContentMetadata(config) {
|
|
1478
|
+
var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2, _config_contentDetails, _sanitizeContentValue3, _sanitizeContentValue4, _sanitizeContentValue5, _normalizeContentLanguage, _normalizeContentDuration, _sanitizeContentScalar, _sanitizeContentScalar1, _sanitizeContentValue6, _sanitizeContentValue7;
|
|
1479
|
+
var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
|
|
1480
|
+
var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
|
|
1481
|
+
var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
|
|
1482
|
+
var details = (_config_contentDetails = config.contentDetails) !== null && _config_contentDetails !== void 0 ? _config_contentDetails : {};
|
|
1483
|
+
var contentType = (_sanitizeContentValue3 = sanitizeContentValue(details.contentType)) !== null && _sanitizeContentValue3 !== void 0 ? _sanitizeContentValue3 : readBridgeContentValue(BRIDGE_KEYS.contentType);
|
|
1484
|
+
var contentCategory = (_sanitizeContentValue4 = sanitizeContentValue(details.category)) !== null && _sanitizeContentValue4 !== void 0 ? _sanitizeContentValue4 : readBridgeContentValue(BRIDGE_KEYS.contentCategory);
|
|
1485
|
+
var contentGenre = (_sanitizeContentValue5 = sanitizeContentValue(details.genre)) !== null && _sanitizeContentValue5 !== void 0 ? _sanitizeContentValue5 : readBridgeContentValue(BRIDGE_KEYS.contentGenre);
|
|
1486
|
+
var contentLanguage = (_normalizeContentLanguage = normalizeContentLanguage(details.language)) !== null && _normalizeContentLanguage !== void 0 ? _normalizeContentLanguage : readBridgeValue2(BRIDGE_KEYS.contentLanguage, normalizeContentLanguage);
|
|
1487
|
+
var contentDurationSeconds = (_normalizeContentDuration = normalizeContentDuration(details.durationSeconds)) !== null && _normalizeContentDuration !== void 0 ? _normalizeContentDuration : readBridgeValue2(BRIDGE_KEYS.contentDuration, normalizeContentDuration);
|
|
1488
|
+
var contentSeason = (_sanitizeContentScalar = sanitizeContentScalar(details.season)) !== null && _sanitizeContentScalar !== void 0 ? _sanitizeContentScalar : readBridgeValue2(BRIDGE_KEYS.contentSeason, sanitizeContentScalar);
|
|
1489
|
+
var contentEpisode = (_sanitizeContentScalar1 = sanitizeContentScalar(details.episode)) !== null && _sanitizeContentScalar1 !== void 0 ? _sanitizeContentScalar1 : readBridgeValue2(BRIDGE_KEYS.contentEpisode, sanitizeContentScalar);
|
|
1490
|
+
var contentRating = (_sanitizeContentValue6 = sanitizeContentValue(details.rating)) !== null && _sanitizeContentValue6 !== void 0 ? _sanitizeContentValue6 : readBridgeContentValue(BRIDGE_KEYS.contentRating);
|
|
1491
|
+
var contentId = (_sanitizeContentValue7 = sanitizeContentValue(details.contentId)) !== null && _sanitizeContentValue7 !== void 0 ? _sanitizeContentValue7 : readBridgeContentValue(BRIDGE_KEYS.contentId);
|
|
1492
|
+
return _object_spread({}, channelName ? {
|
|
1493
|
+
channelName: channelName
|
|
1494
|
+
} : {}, programTitle ? {
|
|
1495
|
+
programTitle: programTitle
|
|
1496
|
+
} : {}, contentNetwork ? {
|
|
1497
|
+
contentNetwork: contentNetwork
|
|
1498
|
+
} : {}, contentType ? {
|
|
1499
|
+
contentType: contentType
|
|
1500
|
+
} : {}, contentCategory ? {
|
|
1501
|
+
contentCategory: contentCategory
|
|
1502
|
+
} : {}, contentGenre ? {
|
|
1503
|
+
contentGenre: contentGenre
|
|
1504
|
+
} : {}, contentLanguage ? {
|
|
1505
|
+
contentLanguage: contentLanguage
|
|
1506
|
+
} : {}, contentDurationSeconds != null ? {
|
|
1507
|
+
contentDurationSeconds: contentDurationSeconds
|
|
1508
|
+
} : {}, contentSeason ? {
|
|
1509
|
+
contentSeason: contentSeason
|
|
1510
|
+
} : {}, contentEpisode ? {
|
|
1511
|
+
contentEpisode: contentEpisode
|
|
1512
|
+
} : {}, contentRating ? {
|
|
1513
|
+
contentRating: contentRating
|
|
1514
|
+
} : {}, contentId ? {
|
|
1515
|
+
contentId: contentId
|
|
1516
|
+
} : {});
|
|
1517
|
+
}
|
|
1518
|
+
function applyContentMetadataUpdate(target, meta) {
|
|
1519
|
+
var _target_contentDetails;
|
|
1520
|
+
var apply = function apply(key, value) {
|
|
1521
|
+
if (value === void 0) return;
|
|
1522
|
+
var clean = value === null ? void 0 : sanitizeContentValue(value);
|
|
1523
|
+
if (clean) target[key] = clean;
|
|
1524
|
+
else delete target[key];
|
|
1525
|
+
};
|
|
1526
|
+
apply("channelName", meta.channelName);
|
|
1527
|
+
apply("programTitle", meta.programTitle);
|
|
1528
|
+
apply("contentNetwork", meta.contentNetwork);
|
|
1529
|
+
if (meta.details === null) delete target.contentDetails;
|
|
1530
|
+
else if (meta.details !== void 0) target.contentDetails = _object_spread({}, meta.details);
|
|
1531
|
+
var rating = meta.programRating !== void 0 ? meta.programRating : meta.contentRating;
|
|
1532
|
+
if (rating === void 0) return;
|
|
1533
|
+
var cleanRating = rating === null ? void 0 : sanitizeContentValue(rating);
|
|
1534
|
+
var details = _object_spread({}, (_target_contentDetails = target.contentDetails) !== null && _target_contentDetails !== void 0 ? _target_contentDetails : {});
|
|
1535
|
+
if (cleanRating) details.rating = cleanRating;
|
|
1536
|
+
else delete details.rating;
|
|
1537
|
+
target.contentDetails = details;
|
|
1538
|
+
}
|
|
1539
|
+
function appendMissingContentParams(url, meta) {
|
|
1540
|
+
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
1541
|
+
try {
|
|
1542
|
+
var parsed = new URL(url);
|
|
1543
|
+
var add = function add(key, value) {
|
|
1544
|
+
if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
|
|
1545
|
+
};
|
|
1546
|
+
add("ct_ch", meta.channelName);
|
|
1547
|
+
add("ct_ti", meta.programTitle);
|
|
1548
|
+
add("ct_ne", meta.contentNetwork);
|
|
1549
|
+
return parsed.toString();
|
|
1550
|
+
} catch (unused) {
|
|
1551
|
+
return url;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
// src/utils/partnerSignals.ts
|
|
1555
|
+
var PLATFORM_IFA_TYPES = /* @__PURE__ */ new Set([
|
|
1556
|
+
"aaid",
|
|
1557
|
+
"adid",
|
|
1558
|
+
"afai",
|
|
1559
|
+
"idfa",
|
|
1560
|
+
"lgudid",
|
|
1561
|
+
"msai",
|
|
1562
|
+
"rida",
|
|
1563
|
+
"tifa",
|
|
1564
|
+
"tvos",
|
|
1565
|
+
"vaid",
|
|
1566
|
+
"vida"
|
|
1567
|
+
]);
|
|
1568
|
+
function toIabIfaType(deviceIdType, source) {
|
|
1569
|
+
if (!deviceIdType) return void 0;
|
|
1570
|
+
var type = deviceIdType.trim().toLowerCase();
|
|
1571
|
+
if (source === "generated") return "sessionid";
|
|
1572
|
+
if (PLATFORM_IFA_TYPES.has(type)) return type;
|
|
1573
|
+
if (source === "platform") return "dpid";
|
|
1574
|
+
return "ppid";
|
|
1575
|
+
}
|
|
1576
|
+
function playbackMethodCode(autoPlay, muted) {
|
|
1577
|
+
if (autoPlay === false) return 3;
|
|
1578
|
+
if (autoPlay !== true || muted == null) return void 0;
|
|
1579
|
+
return muted ? 2 : 1;
|
|
1580
|
+
}
|
|
1581
|
+
function resolvePlayerSize(video) {
|
|
1582
|
+
var width = video ? video.clientWidth : 0;
|
|
1583
|
+
var height = video ? video.clientHeight : 0;
|
|
1584
|
+
if (!(width > 0 && height > 0) && typeof window !== "undefined") {
|
|
1585
|
+
width = window.innerWidth;
|
|
1586
|
+
height = window.innerHeight;
|
|
1587
|
+
}
|
|
1588
|
+
if (!(width > 0 && height > 0)) return {};
|
|
1589
|
+
return {
|
|
1590
|
+
width: Math.round(width),
|
|
1591
|
+
height: Math.round(height)
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
function sanitizeUserId(value) {
|
|
1595
|
+
var cleaned = sanitizeContentValue(value);
|
|
1596
|
+
if (!cleaned || /\s/.test(cleaned)) return void 0;
|
|
1597
|
+
return cleaned;
|
|
1598
|
+
}
|
|
1599
|
+
function isPublicIpv4(ip) {
|
|
1600
|
+
var parts = ip.split(".");
|
|
1601
|
+
if (parts.length !== 4) return false;
|
|
1602
|
+
var nums = parts.map(function(p) {
|
|
1603
|
+
return /^\d{1,3}$/.test(p) ? Number(p) : NaN;
|
|
1604
|
+
});
|
|
1605
|
+
if (nums.some(function(n) {
|
|
1606
|
+
return !(n >= 0 && n <= 255);
|
|
1607
|
+
})) return false;
|
|
1608
|
+
var _nums = _sliced_to_array(nums, 2), a = _nums[0], b = _nums[1];
|
|
1609
|
+
if (a === 0 || a === 10 || a === 127 || a >= 224) return false;
|
|
1610
|
+
if (a === 100 && b >= 64 && b <= 127) return false;
|
|
1611
|
+
if (a === 169 && b === 254) return false;
|
|
1612
|
+
if (a === 172 && b >= 16 && b <= 31) return false;
|
|
1613
|
+
if (a === 192 && b === 168) return false;
|
|
1614
|
+
return true;
|
|
1615
|
+
}
|
|
1616
|
+
function isPublicIpv6(ip) {
|
|
1617
|
+
var lower = ip.toLowerCase();
|
|
1618
|
+
if (!/^[0-9a-f:]+$/.test(lower) || lower.split(":").length < 3) return false;
|
|
1619
|
+
if (lower === "::" || lower === "::1") return false;
|
|
1620
|
+
if (/^fe[89ab]/.test(lower)) return false;
|
|
1621
|
+
if (/^f[cd]/.test(lower)) return false;
|
|
1622
|
+
return true;
|
|
1623
|
+
}
|
|
1624
|
+
function sanitizePublicIp(value) {
|
|
1625
|
+
var cleaned = sanitizeContentValue(value);
|
|
1626
|
+
if (!cleaned) return void 0;
|
|
1627
|
+
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1628
|
+
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1629
|
+
}
|
|
1630
|
+
function resolveUserId(configValue) {
|
|
1631
|
+
var _sanitizeUserId;
|
|
1632
|
+
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
1633
|
+
"userId",
|
|
1634
|
+
"uid"
|
|
1635
|
+
], sanitizeUserId);
|
|
1636
|
+
}
|
|
1637
|
+
function resolveClientIp(configValue) {
|
|
1638
|
+
var _sanitizePublicIp;
|
|
1639
|
+
return (_sanitizePublicIp = sanitizePublicIp(configValue)) !== null && _sanitizePublicIp !== void 0 ? _sanitizePublicIp : readBridgeValue2([
|
|
1640
|
+
"ipAddress",
|
|
1641
|
+
"clientIp",
|
|
1642
|
+
"ip"
|
|
1643
|
+
], sanitizePublicIp);
|
|
1644
|
+
}
|
|
1332
1645
|
// src/utils/vastMacros.ts
|
|
1333
1646
|
var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
|
|
1334
1647
|
var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
|
|
@@ -1646,7 +1959,8 @@ var NESTED_QUERY_PARAM_KEYS = /* @__PURE__ */ new Set([
|
|
|
1646
1959
|
var SCVP_POD_MACROS = /* @__PURE__ */ new Set([
|
|
1647
1960
|
"PMND",
|
|
1648
1961
|
"PMXD",
|
|
1649
|
-
"PMAD"
|
|
1962
|
+
"PMAD",
|
|
1963
|
+
"MABD"
|
|
1650
1964
|
]);
|
|
1651
1965
|
function hasScvpMacros(url) {
|
|
1652
1966
|
return !!url && SCVP_MACRO_DETECT.test(url);
|
|
@@ -1691,6 +2005,8 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1691
2005
|
set("RDID", deviceId);
|
|
1692
2006
|
set("IDTYPE", deviceIdType);
|
|
1693
2007
|
set("IS-LAT", (_toFlag = toFlag(ctx.limitAdTracking)) !== null && _toFlag !== void 0 ? _toFlag : "0");
|
|
2008
|
+
set("IFA", deviceId);
|
|
2009
|
+
set("IFA-TYPE", toIabIfaType(deviceIdType, ctx.deviceIdSource));
|
|
1694
2010
|
}
|
|
1695
2011
|
set("SID", ctx.sessionId);
|
|
1696
2012
|
set("DTH", ctx.deviceTypeHint);
|
|
@@ -1708,6 +2024,26 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1708
2024
|
set("GDPR", (_ctx_consent = ctx.consent) === null || _ctx_consent === void 0 ? void 0 : _ctx_consent.gdpr);
|
|
1709
2025
|
set("GDPR-CONSENT", (_ctx_consent1 = ctx.consent) === null || _ctx_consent1 === void 0 ? void 0 : _ctx_consent1.gdprConsent);
|
|
1710
2026
|
set("US-PRIVACY", (_ctx_consent2 = ctx.consent) === null || _ctx_consent2 === void 0 ? void 0 : _ctx_consent2.usPrivacy);
|
|
2027
|
+
set("PLAYER-WIDTH", ctx.playerWidth);
|
|
2028
|
+
set("PLAYER-HEIGHT", ctx.playerHeight);
|
|
2029
|
+
set("TIMESTAMP", ctx.timestamp);
|
|
2030
|
+
set("LIVE", toFlag(ctx.isLive));
|
|
2031
|
+
set("VPMT", playbackMethodCode(ctx.isCtv ? true : ctx.adWillAutoPlay, ctx.adWillPlayMuted));
|
|
2032
|
+
set("DEVICE-MAKE", ctx.deviceMake);
|
|
2033
|
+
set("DEVICE-MODEL", ctx.deviceModel);
|
|
2034
|
+
set("DEVICE-HWV", ctx.deviceHardwareVersion);
|
|
2035
|
+
set("UA", ctx.userAgent);
|
|
2036
|
+
set("IP", ctx.ipAddress);
|
|
2037
|
+
set("UID", ctx.userId);
|
|
2038
|
+
set("CT-TYPE", ctx.contentType);
|
|
2039
|
+
set("CT-CATEGORY", ctx.contentCategory);
|
|
2040
|
+
set("CT-GENRE", ctx.contentGenre);
|
|
2041
|
+
set("CT-LANGUAGE", ctx.contentLanguage);
|
|
2042
|
+
set("CT-DURATION", ctx.contentDurationSeconds != null ? ctx.contentDurationSeconds : ctx.isLive ? -1 : void 0);
|
|
2043
|
+
set("CT-SEASON", ctx.contentSeason);
|
|
2044
|
+
set("CT-EPISODE", ctx.contentEpisode);
|
|
2045
|
+
set("CT-RATING", ctx.contentRating);
|
|
2046
|
+
set("CT-ID", ctx.contentId);
|
|
1711
2047
|
return values;
|
|
1712
2048
|
}
|
|
1713
2049
|
var keepNone = function keepNone() {
|
|
@@ -2594,9 +2930,30 @@ function detectBrowser() {
|
|
|
2594
2930
|
};
|
|
2595
2931
|
}
|
|
2596
2932
|
var singleDecoderOverride;
|
|
2933
|
+
var LEARNED_SINGLE_DECODER_KEY = "stormcloud.singleDecoder.learned.v1";
|
|
2934
|
+
var learnedSingleDecoder;
|
|
2597
2935
|
function setSingleDecoderOverride(value) {
|
|
2598
2936
|
singleDecoderOverride = value;
|
|
2599
2937
|
}
|
|
2938
|
+
function readLearnedSingleDecoder() {
|
|
2939
|
+
if (learnedSingleDecoder !== void 0) return learnedSingleDecoder;
|
|
2940
|
+
try {
|
|
2941
|
+
var _window_localStorage;
|
|
2942
|
+
learnedSingleDecoder = typeof window !== "undefined" && ((_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(LEARNED_SINGLE_DECODER_KEY)) === "1";
|
|
2943
|
+
} catch (unused) {
|
|
2944
|
+
learnedSingleDecoder = false;
|
|
2945
|
+
}
|
|
2946
|
+
return learnedSingleDecoder;
|
|
2947
|
+
}
|
|
2948
|
+
function markSingleDecoderLearned() {
|
|
2949
|
+
if (readLearnedSingleDecoder()) return false;
|
|
2950
|
+
learnedSingleDecoder = true;
|
|
2951
|
+
try {
|
|
2952
|
+
var _window_localStorage;
|
|
2953
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(LEARNED_SINGLE_DECODER_KEY, "1");
|
|
2954
|
+
} catch (unused) {}
|
|
2955
|
+
return true;
|
|
2956
|
+
}
|
|
2600
2957
|
function requiresMediaPipelineResetAfterAds() {
|
|
2601
2958
|
var _browser_tizenVersion;
|
|
2602
2959
|
if (singleDecoderOverride != null) return singleDecoderOverride;
|
|
@@ -2604,6 +2961,7 @@ function requiresMediaPipelineResetAfterAds() {
|
|
|
2604
2961
|
var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
|
|
2605
2962
|
if (typeof globalOverride === "boolean") return globalOverride;
|
|
2606
2963
|
} catch (unused) {}
|
|
2964
|
+
if (readLearnedSingleDecoder()) return true;
|
|
2607
2965
|
var browser = detectBrowser();
|
|
2608
2966
|
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
2609
2967
|
}
|
|
@@ -2923,15 +3281,20 @@ function finalizeGamRequestUrl(rawUrl, ctx) {
|
|
|
2923
3281
|
values.set("PMND", String(pod.pmnd));
|
|
2924
3282
|
values.set("PMXD", String(pod.pmxd));
|
|
2925
3283
|
if (pod.pmad != null) values.set("PMAD", String(pod.pmad));
|
|
3284
|
+
values.set("MABD", String(Math.max(1, Math.floor(pod.pmxd / 1e3))));
|
|
2926
3285
|
}
|
|
2927
3286
|
var substituted = substituteScvpMacros(rawUrl, values);
|
|
2928
3287
|
var finalUrl;
|
|
2929
3288
|
try {
|
|
2930
3289
|
var url = new URL(normalizeVastTagUrl(substituted.url));
|
|
3290
|
+
var isGam = GAM_AD_HOSTS.has(url.hostname);
|
|
3291
|
+
var setPodParam = function setPodParam(key, value) {
|
|
3292
|
+
if (isGam || url.searchParams.has(key)) url.searchParams.set(key, String(value));
|
|
3293
|
+
};
|
|
2931
3294
|
if (pod) {
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
if (pod.pmad != null)
|
|
3295
|
+
setPodParam("pmnd", pod.pmnd);
|
|
3296
|
+
setPodParam("pmxd", pod.pmxd);
|
|
3297
|
+
if (pod.pmad != null) setPodParam("pmad", pod.pmad);
|
|
2935
3298
|
else url.searchParams.delete("pmad");
|
|
2936
3299
|
} else {
|
|
2937
3300
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -2997,7 +3360,9 @@ function validateGamRequestUrl(url, expect) {
|
|
|
2997
3360
|
if (leftover.length > 0) problems.push("unresolved SCVP macros: ".concat(leftover.join(", ")));
|
|
2998
3361
|
var params;
|
|
2999
3362
|
try {
|
|
3000
|
-
|
|
3363
|
+
var parsed = new URL(url);
|
|
3364
|
+
if (!GAM_AD_HOSTS.has(parsed.hostname)) return problems;
|
|
3365
|
+
params = parsed.searchParams;
|
|
3001
3366
|
} catch (unused) {
|
|
3002
3367
|
return problems.concat("URL could not be parsed");
|
|
3003
3368
|
}
|
|
@@ -6418,7 +6783,7 @@ function safeCall2(fn, thisArg) {
|
|
|
6418
6783
|
function userAgent() {
|
|
6419
6784
|
return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
|
|
6420
6785
|
}
|
|
6421
|
-
function
|
|
6786
|
+
function bridgeSources2() {
|
|
6422
6787
|
if (typeof window === "undefined") return [];
|
|
6423
6788
|
var w = window;
|
|
6424
6789
|
return [
|
|
@@ -6430,7 +6795,7 @@ function bridgeSources() {
|
|
|
6430
6795
|
function readBridge(keys) {
|
|
6431
6796
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6432
6797
|
try {
|
|
6433
|
-
for(var _iterator =
|
|
6798
|
+
for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6434
6799
|
var source = _step.value;
|
|
6435
6800
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
6436
6801
|
try {
|
|
@@ -6477,6 +6842,11 @@ function readBridge(keys) {
|
|
|
6477
6842
|
}
|
|
6478
6843
|
return void 0;
|
|
6479
6844
|
}
|
|
6845
|
+
function makeForCategory(category) {
|
|
6846
|
+
if (category === "LG TV" || category === "LG Set-Top Box") return "LG";
|
|
6847
|
+
if (category === "Samsung TV") return "Samsung";
|
|
6848
|
+
return void 0;
|
|
6849
|
+
}
|
|
6480
6850
|
function normalizeCategory(value) {
|
|
6481
6851
|
var v = cleanString(value);
|
|
6482
6852
|
if (!v) return void 0;
|
|
@@ -6624,7 +6994,7 @@ function primeDeviceInfo() {
|
|
|
6624
6994
|
return primePromise;
|
|
6625
6995
|
}
|
|
6626
6996
|
function getDeviceInfo() {
|
|
6627
|
-
var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
|
|
6997
|
+
var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory, _ref3, _cleanString4, _cleanString5;
|
|
6628
6998
|
var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
|
|
6629
6999
|
if (primePromise && !platformCache) {} else {
|
|
6630
7000
|
platformCache = platform;
|
|
@@ -6647,7 +7017,14 @@ function getDeviceInfo() {
|
|
|
6647
7017
|
]),
|
|
6648
7018
|
category: normalizeCategory(readBridge([
|
|
6649
7019
|
"deviceCategory"
|
|
6650
|
-
]))
|
|
7020
|
+
])),
|
|
7021
|
+
make: readBridge([
|
|
7022
|
+
"deviceMake"
|
|
7023
|
+
]),
|
|
7024
|
+
hardwareVersion: readBridge([
|
|
7025
|
+
"deviceHardwareVersion",
|
|
7026
|
+
"hardwareVersion"
|
|
7027
|
+
])
|
|
6651
7028
|
};
|
|
6652
7029
|
var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
|
|
6653
7030
|
var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
|
|
@@ -6660,7 +7037,9 @@ function getDeviceInfo() {
|
|
|
6660
7037
|
bridge.internalDeviceId,
|
|
6661
7038
|
bridge.model,
|
|
6662
7039
|
bridge.firmware,
|
|
6663
|
-
bridge.category
|
|
7040
|
+
bridge.category,
|
|
7041
|
+
bridge.make,
|
|
7042
|
+
bridge.hardwareVersion
|
|
6664
7043
|
];
|
|
6665
7044
|
if (bridgeValues.some(function(v) {
|
|
6666
7045
|
return v !== void 0;
|
|
@@ -6668,12 +7047,18 @@ function getDeviceInfo() {
|
|
|
6668
7047
|
if (hostDeviceInfo) sources.unshift("host");
|
|
6669
7048
|
var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
|
|
6670
7049
|
var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
|
|
7050
|
+
var make = (_ref3 = (_cleanString4 = cleanString(host.make, 40)) !== null && _cleanString4 !== void 0 ? _cleanString4 : bridge.make) !== null && _ref3 !== void 0 ? _ref3 : makeForCategory(category);
|
|
7051
|
+
var hardwareVersion = (_cleanString5 = cleanString(host.hardwareVersion, 40)) !== null && _cleanString5 !== void 0 ? _cleanString5 : bridge.hardwareVersion;
|
|
6671
7052
|
var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
|
|
6672
7053
|
return _object_spread_props(_object_spread({
|
|
6673
7054
|
category: category,
|
|
6674
7055
|
categoryCode: CATEGORY_CODES[category]
|
|
6675
|
-
},
|
|
7056
|
+
}, make ? {
|
|
7057
|
+
make: make
|
|
7058
|
+
} : {}, model ? {
|
|
6676
7059
|
model: model
|
|
7060
|
+
} : {}, hardwareVersion ? {
|
|
7061
|
+
hardwareVersion: hardwareVersion
|
|
6677
7062
|
} : {}, sonifiModel ? {
|
|
6678
7063
|
sonifiModel: sonifiModel
|
|
6679
7064
|
} : {}, firmware ? {
|
|
@@ -6764,117 +7149,6 @@ function deviceInfoAnalyticsFields(info) {
|
|
|
6764
7149
|
terminal_id: info.terminalId
|
|
6765
7150
|
} : {});
|
|
6766
7151
|
}
|
|
6767
|
-
// src/utils/contentMetadata.ts
|
|
6768
|
-
var MAX_CONTENT_VALUE_LENGTH = 128;
|
|
6769
|
-
var BRIDGE_KEYS = {
|
|
6770
|
-
channelName: [
|
|
6771
|
-
"channelName",
|
|
6772
|
-
"ct_ch"
|
|
6773
|
-
],
|
|
6774
|
-
programTitle: [
|
|
6775
|
-
"programTitle",
|
|
6776
|
-
"ct_ti"
|
|
6777
|
-
],
|
|
6778
|
-
contentNetwork: [
|
|
6779
|
-
"contentNetwork",
|
|
6780
|
-
"ct_ne"
|
|
6781
|
-
]
|
|
6782
|
-
};
|
|
6783
|
-
function sanitizeContentValue(value) {
|
|
6784
|
-
if (typeof value !== "string") return void 0;
|
|
6785
|
-
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
6786
|
-
if (!cleaned) return void 0;
|
|
6787
|
-
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
6788
|
-
if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
|
|
6789
|
-
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
6790
|
-
}
|
|
6791
|
-
function bridgeSources2() {
|
|
6792
|
-
if (typeof window === "undefined") return [];
|
|
6793
|
-
var w = window;
|
|
6794
|
-
return [
|
|
6795
|
-
w.__STORMCLOUD_CTV__,
|
|
6796
|
-
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
6797
|
-
w.stormcloudCtv
|
|
6798
|
-
].filter(Boolean);
|
|
6799
|
-
}
|
|
6800
|
-
function readBridgeContentValue(keys) {
|
|
6801
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6802
|
-
try {
|
|
6803
|
-
for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6804
|
-
var source = _step.value;
|
|
6805
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
6806
|
-
try {
|
|
6807
|
-
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
6808
|
-
var key = _step1.value;
|
|
6809
|
-
var value = void 0;
|
|
6810
|
-
try {
|
|
6811
|
-
value = source === null || source === void 0 ? void 0 : source[key];
|
|
6812
|
-
if (typeof value === "function") value = value.call(source);
|
|
6813
|
-
} catch (unused) {
|
|
6814
|
-
value = void 0;
|
|
6815
|
-
}
|
|
6816
|
-
var sanitized = sanitizeContentValue(value);
|
|
6817
|
-
if (sanitized) return sanitized;
|
|
6818
|
-
}
|
|
6819
|
-
} catch (err) {
|
|
6820
|
-
_didIteratorError1 = true;
|
|
6821
|
-
_iteratorError1 = err;
|
|
6822
|
-
} finally{
|
|
6823
|
-
try {
|
|
6824
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
6825
|
-
_iterator1.return();
|
|
6826
|
-
}
|
|
6827
|
-
} finally{
|
|
6828
|
-
if (_didIteratorError1) {
|
|
6829
|
-
throw _iteratorError1;
|
|
6830
|
-
}
|
|
6831
|
-
}
|
|
6832
|
-
}
|
|
6833
|
-
}
|
|
6834
|
-
} catch (err) {
|
|
6835
|
-
_didIteratorError = true;
|
|
6836
|
-
_iteratorError = err;
|
|
6837
|
-
} finally{
|
|
6838
|
-
try {
|
|
6839
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
6840
|
-
_iterator.return();
|
|
6841
|
-
}
|
|
6842
|
-
} finally{
|
|
6843
|
-
if (_didIteratorError) {
|
|
6844
|
-
throw _iteratorError;
|
|
6845
|
-
}
|
|
6846
|
-
}
|
|
6847
|
-
}
|
|
6848
|
-
return void 0;
|
|
6849
|
-
}
|
|
6850
|
-
function resolveContentMetadata(config) {
|
|
6851
|
-
var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2;
|
|
6852
|
-
var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
|
|
6853
|
-
var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
|
|
6854
|
-
var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
|
|
6855
|
-
return _object_spread({}, channelName ? {
|
|
6856
|
-
channelName: channelName
|
|
6857
|
-
} : {}, programTitle ? {
|
|
6858
|
-
programTitle: programTitle
|
|
6859
|
-
} : {}, contentNetwork ? {
|
|
6860
|
-
contentNetwork: contentNetwork
|
|
6861
|
-
} : {});
|
|
6862
|
-
}
|
|
6863
|
-
function appendMissingContentParams(url, meta) {
|
|
6864
|
-
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
6865
|
-
try {
|
|
6866
|
-
var parsed = new URL(url);
|
|
6867
|
-
var add = function add(key, value) {
|
|
6868
|
-
if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
|
|
6869
|
-
};
|
|
6870
|
-
add("ct_ch", meta.channelName);
|
|
6871
|
-
add("ct_ti", meta.programTitle);
|
|
6872
|
-
add("ct_ne", meta.contentNetwork);
|
|
6873
|
-
return parsed.toString();
|
|
6874
|
-
} catch (unused) {
|
|
6875
|
-
return url;
|
|
6876
|
-
}
|
|
6877
|
-
}
|
|
6878
7152
|
// src/utils/screenActivity.ts
|
|
6879
7153
|
var hostStandby = false;
|
|
6880
7154
|
function setHostStandby(standby) {
|
|
@@ -8876,6 +9150,13 @@ var Scte35CueManager = /*#__PURE__*/ function() {
|
|
|
8876
9150
|
return Scte35CueManager;
|
|
8877
9151
|
}();
|
|
8878
9152
|
// src/player/AdConfigManager.ts
|
|
9153
|
+
function isGamAdUrl(rawUrl) {
|
|
9154
|
+
try {
|
|
9155
|
+
return GAM_AD_HOSTS.has(new URL(rawUrl).hostname);
|
|
9156
|
+
} catch (unused) {
|
|
9157
|
+
return false;
|
|
9158
|
+
}
|
|
9159
|
+
}
|
|
8879
9160
|
function withDeferredPodParams(rawUrl, deferNonce) {
|
|
8880
9161
|
try {
|
|
8881
9162
|
var url = new URL(rawUrl);
|
|
@@ -8893,11 +9174,15 @@ function withDeferredPodParams(rawUrl, deferNonce) {
|
|
|
8893
9174
|
}
|
|
8894
9175
|
var AdConfigManager = /*#__PURE__*/ function() {
|
|
8895
9176
|
function AdConfigManager(config, video) {
|
|
9177
|
+
var _this = this;
|
|
8896
9178
|
_class_call_check(this, AdConfigManager);
|
|
8897
9179
|
this.vmapBreaks = [];
|
|
8898
9180
|
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
8899
9181
|
this.streamCorrelator = generateCorrelator();
|
|
8900
9182
|
this.consentSignals = {};
|
|
9183
|
+
this.isLiveStream = function() {
|
|
9184
|
+
return !!_this.config.isLiveStream;
|
|
9185
|
+
};
|
|
8901
9186
|
this.podCounter = 0;
|
|
8902
9187
|
this.podAssignedByPrefetch = false;
|
|
8903
9188
|
this.lastHeartbeatTime = 0;
|
|
@@ -9348,13 +9633,22 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9348
9633
|
{
|
|
9349
9634
|
key: "generatePodVastUrl",
|
|
9350
9635
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9636
|
+
var _content_contentDurationSeconds;
|
|
9351
9637
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9352
9638
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9353
9639
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9354
9640
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
9355
9641
|
});
|
|
9356
9642
|
var content = resolveContentMetadata(this.config);
|
|
9357
|
-
var
|
|
9643
|
+
var isLive = this.isLiveStream();
|
|
9644
|
+
var device = getDeviceInfo();
|
|
9645
|
+
var playerSize = resolvePlayerSize(this.video);
|
|
9646
|
+
var videoDuration = this.video.duration;
|
|
9647
|
+
var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
|
|
9648
|
+
var userId = resolveUserId(this.config.adUserId);
|
|
9649
|
+
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9650
|
+
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9651
|
+
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
9358
9652
|
correlator: this.viewCorrelator,
|
|
9359
9653
|
streamCorrelator: this.streamCorrelator,
|
|
9360
9654
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
@@ -9376,8 +9670,46 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9376
9670
|
contentNetwork: content.contentNetwork
|
|
9377
9671
|
} : {}), {
|
|
9378
9672
|
consent: this.consentSignals,
|
|
9379
|
-
palNonce: palNonce.getCurrentNonce() || void 0
|
|
9380
|
-
|
|
9673
|
+
palNonce: palNonce.getCurrentNonce() || void 0,
|
|
9674
|
+
deviceIdSource: envSignals.deviceIdSource,
|
|
9675
|
+
isLive: isLive
|
|
9676
|
+
}), playerSize.width ? {
|
|
9677
|
+
playerWidth: playerSize.width
|
|
9678
|
+
} : {}, playerSize.height ? {
|
|
9679
|
+
playerHeight: playerSize.height
|
|
9680
|
+
} : {}), {
|
|
9681
|
+
timestamp: String(Date.now())
|
|
9682
|
+
}), device.make ? {
|
|
9683
|
+
deviceMake: device.make
|
|
9684
|
+
} : {}, device.model ? {
|
|
9685
|
+
deviceModel: device.model
|
|
9686
|
+
} : {}, device.hardwareVersion ? {
|
|
9687
|
+
deviceHardwareVersion: device.hardwareVersion
|
|
9688
|
+
} : {}, userAgent2 ? {
|
|
9689
|
+
userAgent: userAgent2
|
|
9690
|
+
} : {}, ipAddress ? {
|
|
9691
|
+
ipAddress: ipAddress
|
|
9692
|
+
} : {}, userId ? {
|
|
9693
|
+
userId: userId
|
|
9694
|
+
} : {}, content.contentType ? {
|
|
9695
|
+
contentType: content.contentType
|
|
9696
|
+
} : {}, content.contentCategory ? {
|
|
9697
|
+
contentCategory: content.contentCategory
|
|
9698
|
+
} : {}, content.contentGenre ? {
|
|
9699
|
+
contentGenre: content.contentGenre
|
|
9700
|
+
} : {}, content.contentLanguage ? {
|
|
9701
|
+
contentLanguage: content.contentLanguage
|
|
9702
|
+
} : {}, contentDurationSeconds != null ? {
|
|
9703
|
+
contentDurationSeconds: contentDurationSeconds
|
|
9704
|
+
} : {}, content.contentSeason ? {
|
|
9705
|
+
contentSeason: content.contentSeason
|
|
9706
|
+
} : {}, content.contentEpisode ? {
|
|
9707
|
+
contentEpisode: content.contentEpisode
|
|
9708
|
+
} : {}, content.contentRating ? {
|
|
9709
|
+
contentRating: content.contentRating
|
|
9710
|
+
} : {}, content.contentId ? {
|
|
9711
|
+
contentId: content.contentId
|
|
9712
|
+
} : {});
|
|
9381
9713
|
var nonceReady = !!macroContext.palNonce;
|
|
9382
9714
|
var finalUrl;
|
|
9383
9715
|
if (hasScvpMacros(baseUrl)) {
|
|
@@ -9391,9 +9723,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9391
9723
|
} else {
|
|
9392
9724
|
finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
|
|
9393
9725
|
}
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9726
|
+
if (isGamAdUrl(finalUrl)) {
|
|
9727
|
+
finalUrl = appendMissingContentParams(finalUrl, content);
|
|
9728
|
+
if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
|
|
9729
|
+
finalUrl = applyDeviceKeyValues(finalUrl, device);
|
|
9730
|
+
}
|
|
9397
9731
|
}
|
|
9398
9732
|
if (this.debug) {
|
|
9399
9733
|
var id = envSignals.deviceId;
|
|
@@ -9406,7 +9740,13 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9406
9740
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9407
9741
|
ct_ch: content.channelName,
|
|
9408
9742
|
ct_ti: content.programTitle,
|
|
9409
|
-
ct_ne: content.contentNetwork
|
|
9743
|
+
ct_ne: content.contentNetwork,
|
|
9744
|
+
rating: content.contentRating,
|
|
9745
|
+
ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
|
|
9746
|
+
live: isLive,
|
|
9747
|
+
player: playerSize,
|
|
9748
|
+
make: device.make,
|
|
9749
|
+
model: device.model
|
|
9410
9750
|
});
|
|
9411
9751
|
}
|
|
9412
9752
|
console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
|
|
@@ -11085,6 +11425,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11085
11425
|
this.adDetectSentForCurrentBreak = false;
|
|
11086
11426
|
this.slotState = "IDLE";
|
|
11087
11427
|
this.unusableResponsesInBreak = 0;
|
|
11428
|
+
this.playedAdIdsInBreak = /* @__PURE__ */ new Set();
|
|
11088
11429
|
this.controllerGeneration = 0;
|
|
11089
11430
|
this.requestDiagnostics = /* @__PURE__ */ new Map();
|
|
11090
11431
|
this.breakFunnel = {};
|
|
@@ -11181,6 +11522,11 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11181
11522
|
_this.recordRequestDiagnostic(payload);
|
|
11182
11523
|
});
|
|
11183
11524
|
adPlayer.on("ad_impression", function() {
|
|
11525
|
+
var _this_host_getAdPlayer_getLoadedAdId, _this_host_getAdPlayer;
|
|
11526
|
+
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);
|
|
11527
|
+
if (impressionAdId != null && impressionAdId !== "") {
|
|
11528
|
+
_this.playedAdIdsInBreak.add(String(impressionAdId));
|
|
11529
|
+
}
|
|
11184
11530
|
_this.timing.consecutiveFailures = 0;
|
|
11185
11531
|
_this.setSlotState("PLAYING", "impression");
|
|
11186
11532
|
if (!_this.playbackStartedForCurrentRequest) {
|
|
@@ -11372,6 +11718,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11372
11718
|
this.resetEdgeStateForBreak();
|
|
11373
11719
|
this.followUpBaseVastUrl = void 0;
|
|
11374
11720
|
this.unusableResponsesInBreak = 0;
|
|
11721
|
+
this.playedAdIdsInBreak.clear();
|
|
11375
11722
|
this.timing.totalAdRequestsInBreak = 0;
|
|
11376
11723
|
this.setSlotState("NEEDS_NEXT_AD", "vmap_break_start");
|
|
11377
11724
|
this.noteOpportunity("vmap", breakKey, position);
|
|
@@ -11422,6 +11769,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11422
11769
|
this.breakSource = "scte35";
|
|
11423
11770
|
this.followUpBaseVastUrl = baseVastUrl;
|
|
11424
11771
|
this.unusableResponsesInBreak = 0;
|
|
11772
|
+
this.playedAdIdsInBreak.clear();
|
|
11425
11773
|
this.resetEdgeStateForBreak();
|
|
11426
11774
|
this.setSlotState("NEEDS_NEXT_AD", "scte35_break_start");
|
|
11427
11775
|
if (this.adConfig.podAssignedByPrefetch) {
|
|
@@ -12261,6 +12609,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12261
12609
|
var outcome;
|
|
12262
12610
|
if (message.includes("ad_duration_exceeds_budget")) {
|
|
12263
12611
|
outcome = "discarded_budget";
|
|
12612
|
+
} else if (message.includes("ad_repeated_in_break")) {
|
|
12613
|
+
outcome = "discarded_duplicate";
|
|
12264
12614
|
} else if (message.includes("VAST fill rejected")) {
|
|
12265
12615
|
outcome = "fill_rejected";
|
|
12266
12616
|
} else if (/no ads available|no fill|nofill/i.test(message)) {
|
|
@@ -12275,7 +12625,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12275
12625
|
outcome = "request_failed";
|
|
12276
12626
|
}
|
|
12277
12627
|
this.timing.consecutiveFailures++;
|
|
12278
|
-
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget") {
|
|
12628
|
+
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget" || outcome === "discarded_duplicate") {
|
|
12279
12629
|
this.unusableResponsesInBreak++;
|
|
12280
12630
|
}
|
|
12281
12631
|
if (outcome === "no_fill") {
|
|
@@ -12289,7 +12639,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12289
12639
|
}) ? diag.dispatchedUrl : vastTagUrl;
|
|
12290
12640
|
if (this.timing.isTemporaryAdError(error)) {
|
|
12291
12641
|
this.timing.temporaryFailureUrls.set(failureKey, Date.now());
|
|
12292
|
-
} else if (outcome !== "discarded_budget") {
|
|
12642
|
+
} else if (outcome !== "discarded_budget" && outcome !== "discarded_duplicate") {
|
|
12293
12643
|
this.timing.failedVastUrls.add(failureKey);
|
|
12294
12644
|
}
|
|
12295
12645
|
this.countFunnelStage("request_outcome:".concat(outcome));
|
|
@@ -12661,7 +13011,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12661
13011
|
value: function playSingleAd(vastTagUrl) {
|
|
12662
13012
|
var trigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "vmap";
|
|
12663
13013
|
return _async_to_generator(function() {
|
|
12664
|
-
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, finalizeRequestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
13014
|
+
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, _ref, _ap_getLoadedAdId, _ap_getPodAdCount, finalizeRequestUrl, loadedAdId, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
12665
13015
|
return _ts_generator(this, function(_state) {
|
|
12666
13016
|
switch(_state.label){
|
|
12667
13017
|
case 0:
|
|
@@ -12774,6 +13124,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12774
13124
|
vastUrl: (_this_currentVastUrl = this.currentVastUrl) !== null && _this_currentVastUrl !== void 0 ? _this_currentVastUrl : requestUrl,
|
|
12775
13125
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
12776
13126
|
}, this.analyticsContext).catch(function() {});
|
|
13127
|
+
loadedAdId = (_ap_getLoadedAdId = ap.getLoadedAdId) === null || _ap_getLoadedAdId === void 0 ? void 0 : _ap_getLoadedAdId.call(ap);
|
|
13128
|
+
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))) {
|
|
13129
|
+
if (this.debug) {
|
|
13130
|
+
console.log("[AD-DURATION] Rejected ad id=".concat(loadedAdId, ": already played in this break — requesting another ad"));
|
|
13131
|
+
}
|
|
13132
|
+
this.logOrchestratorFunnel("discarded_duplicate", {
|
|
13133
|
+
adId: String(loadedAdId)
|
|
13134
|
+
});
|
|
13135
|
+
throw new Error("ad_repeated_in_break");
|
|
13136
|
+
}
|
|
12777
13137
|
if (!this.timing.ensureLoadedAdFitsBudget(ap)) {
|
|
12778
13138
|
;
|
|
12779
13139
|
adDurationS = (_ap_getLoadedAdDuration = ap.getLoadedAdDuration) === null || _ap_getLoadedAdDuration === void 0 ? void 0 : _ap_getLoadedAdDuration.call(ap);
|
|
@@ -12827,6 +13187,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12827
13187
|
this.recordRequestFailure(error, vastTagUrl);
|
|
12828
13188
|
if ((error === null || error === void 0 ? void 0 : error.message) === "ad_duration_exceeds_budget") {
|
|
12829
13189
|
this.recreateAdController("discarded_budget");
|
|
13190
|
+
} else if ((error === null || error === void 0 ? void 0 : error.message) === "ad_repeated_in_break") {
|
|
13191
|
+
this.recreateAdController("discarded_duplicate");
|
|
12830
13192
|
}
|
|
12831
13193
|
throw error;
|
|
12832
13194
|
case 10:
|
|
@@ -12900,6 +13262,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12900
13262
|
tagAllowsAudio: count("tag_allows_audio"),
|
|
12901
13263
|
missingImpression: count("vast_missing_impression"),
|
|
12902
13264
|
discardedBudget: count("discarded_budget"),
|
|
13265
|
+
discardedDuplicate: count("discarded_duplicate"),
|
|
12903
13266
|
mediaCandidates: count("media_candidate:accepted") + count("media_candidate:rejected"),
|
|
12904
13267
|
mediaRejected: count("media_candidate:rejected"),
|
|
12905
13268
|
mediaFallbacks: count("media_fallback"),
|
|
@@ -12975,6 +13338,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12975
13338
|
this.breakSource = void 0;
|
|
12976
13339
|
this.followUpBaseVastUrl = void 0;
|
|
12977
13340
|
this.unusableResponsesInBreak = 0;
|
|
13341
|
+
this.playedAdIdsInBreak.clear();
|
|
12978
13342
|
this.resetEdgeStateForBreak();
|
|
12979
13343
|
adPlayer.stop().catch(function() {});
|
|
12980
13344
|
if (!alreadyEnded) this.logBreakFunnel(reason);
|
|
@@ -13075,9 +13439,18 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13075
13439
|
var maxMonitorMs = 45e3;
|
|
13076
13440
|
var startTime = Date.now();
|
|
13077
13441
|
var baseline = resumeBaseline;
|
|
13442
|
+
var lastSeenTime = resumeBaseline;
|
|
13078
13443
|
var recoveries = 0;
|
|
13079
13444
|
var lastRecoveryAt = 0;
|
|
13080
13445
|
var video = this.host.video;
|
|
13446
|
+
var onDecodeError = function onDecodeError() {
|
|
13447
|
+
var _video_error;
|
|
13448
|
+
if (needsReset || ((_video_error = video.error) === null || _video_error === void 0 ? void 0 : _video_error.code) !== 3) return;
|
|
13449
|
+
if (markSingleDecoderLearned() && _this.debug) {
|
|
13450
|
+
console.warn("[StormcloudVideoPlayer] Decoder error while resuming after ads \u2014 using single-decoder mode on this device from the next break");
|
|
13451
|
+
}
|
|
13452
|
+
};
|
|
13453
|
+
video.addEventListener("error", onDecodeError);
|
|
13081
13454
|
var listenersAttached = false;
|
|
13082
13455
|
var onMediaEvent;
|
|
13083
13456
|
var diagEvents = [
|
|
@@ -13127,6 +13500,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13127
13500
|
console.log("[ResumeDiag] +0.0s monitor start — ".concat(this.describeVideoState()));
|
|
13128
13501
|
}
|
|
13129
13502
|
var cleanup = function cleanup() {
|
|
13503
|
+
video.removeEventListener("error", onDecodeError);
|
|
13130
13504
|
if (listenersAttached && onMediaEvent) {
|
|
13131
13505
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
13132
13506
|
try {
|
|
@@ -13157,6 +13531,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13157
13531
|
return;
|
|
13158
13532
|
}
|
|
13159
13533
|
var currentTime = video.currentTime;
|
|
13534
|
+
if (currentTime + 1 < lastSeenTime) {
|
|
13535
|
+
baseline = currentTime;
|
|
13536
|
+
}
|
|
13537
|
+
lastSeenTime = currentTime;
|
|
13160
13538
|
var advanced = currentTime > baseline + 0.5;
|
|
13161
13539
|
var playing = !video.paused && video.readyState >= 3;
|
|
13162
13540
|
if (advanced && playing) {
|
|
@@ -13577,6 +13955,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13577
13955
|
return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
|
|
13578
13956
|
}
|
|
13579
13957
|
});
|
|
13958
|
+
this.adConfig.isLiveStream = function() {
|
|
13959
|
+
return _this.hlsEngine.isLiveStream;
|
|
13960
|
+
};
|
|
13580
13961
|
this.adBreak = new AdBreakOrchestrator({
|
|
13581
13962
|
config: this.config,
|
|
13582
13963
|
video: this.video,
|
|
@@ -13938,16 +14319,20 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13938
14319
|
{
|
|
13939
14320
|
key: "setContentMetadata",
|
|
13940
14321
|
value: function setContentMetadata(meta) {
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
14322
|
+
applyContentMetadataUpdate(this.config, meta);
|
|
14323
|
+
}
|
|
14324
|
+
},
|
|
14325
|
+
{
|
|
14326
|
+
key: "setRequestSignals",
|
|
14327
|
+
value: function setRequestSignals(signals) {
|
|
14328
|
+
if (signals.userId !== void 0) {
|
|
14329
|
+
if (signals.userId) this.config.adUserId = signals.userId;
|
|
14330
|
+
else delete this.config.adUserId;
|
|
14331
|
+
}
|
|
14332
|
+
if (signals.ipAddress !== void 0) {
|
|
14333
|
+
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14334
|
+
else delete this.config.clientIpAddress;
|
|
14335
|
+
}
|
|
13951
14336
|
}
|
|
13952
14337
|
},
|
|
13953
14338
|
{
|