stormcloud-video-player 0.8.78 → 0.8.80
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.cjs +6 -0
- package/lib/Player.cjs.map +1 -1
- package/lib/Player.d.cts +2 -0
- package/lib/StormcloudPlayer.cjs +1143 -160
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/StormcloudPlayer.d.cts +2 -0
- package/lib/index.cjs +1206 -162
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2 -0
- package/lib/index.d.ts +64 -2
- package/lib/index.js +1206 -162
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +424 -84
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdConfigManager.cjs +738 -94
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdTimingService.cjs +0 -9
- package/lib/player/AdTimingService.cjs.map +1 -1
- package/lib/player/FloorLadder.cjs +3 -0
- package/lib/player/FloorLadder.cjs.map +1 -1
- package/lib/player/HlsEngine.cjs +7 -1
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +1 -0
- package/lib/player/OptimizedPodRequest.cjs +4 -1
- package/lib/player/OptimizedPodRequest.cjs.map +1 -1
- package/lib/player/OptimizedPodRequest.d.cts +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +1143 -160
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +18 -1
- package/lib/players/HlsPlayer.cjs +1143 -160
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +1143 -160
- package/lib/players/index.cjs.map +1 -1
- package/lib/props.cjs +6 -0
- package/lib/props.cjs.map +1 -1
- package/lib/props.d.cts +2 -0
- package/lib/sdk/hlsAdPlayer.cjs +32 -3
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/pal.cjs +10 -3
- package/lib/sdk/pal.cjs.map +1 -1
- package/lib/sdk/pal.d.cts +3 -0
- package/lib/types.d.cts +24 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +1206 -162
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +2 -0
- package/lib/utils/__tests__/adSignals.test.cjs +25662 -0
- package/lib/utils/__tests__/adSignals.test.cjs.map +1 -0
- package/lib/utils/__tests__/adSignals.test.d.cts +2 -0
- package/lib/utils/adIdentity.cjs +421 -0
- package/lib/utils/adIdentity.cjs.map +1 -0
- package/lib/utils/adIdentity.d.cts +30 -0
- package/lib/utils/browserCompat.cjs +13 -0
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/browserCompat.d.cts +2 -1
- package/lib/utils/contentMetadata.cjs +208 -0
- package/lib/utils/contentMetadata.cjs.map +1 -0
- package/lib/utils/contentMetadata.d.cts +15 -0
- package/lib/utils/ctvVastSignals.cjs +250 -181
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/deviceInfo.cjs +678 -0
- package/lib/utils/deviceInfo.cjs.map +1 -0
- package/lib/utils/deviceInfo.d.cts +43 -0
- package/lib/utils/screenActivity.cjs +125 -0
- package/lib/utils/screenActivity.cjs.map +1 -0
- package/lib/utils/screenActivity.d.cts +5 -0
- package/lib/utils/tracking.cjs +391 -57
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/lib/utils/vastEnvironmentSignals.cjs +255 -85
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.d.cts +8 -2
- package/lib/utils/vastMacros.cjs +7 -0
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +1 -0
- package/package.json +1 -1
|
@@ -308,8 +308,174 @@ __export(AdConfigManager_exports, {
|
|
|
308
308
|
}
|
|
309
309
|
});
|
|
310
310
|
module.exports = __toCommonJS(AdConfigManager_exports);
|
|
311
|
+
// src/utils/adIdentity.ts
|
|
312
|
+
var GOOGLE_ID_TYPES = [
|
|
313
|
+
"aaid",
|
|
314
|
+
"adid",
|
|
315
|
+
"afai",
|
|
316
|
+
"idfa",
|
|
317
|
+
"lgudid",
|
|
318
|
+
"msai",
|
|
319
|
+
"rida",
|
|
320
|
+
"tifa",
|
|
321
|
+
"tvOS",
|
|
322
|
+
"vaid",
|
|
323
|
+
"vida",
|
|
324
|
+
"dpid"
|
|
325
|
+
];
|
|
326
|
+
var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
|
|
327
|
+
var DEFAULT_SESSION_ID_MAX_AGE_MS = MAX_SESSION_ID_AGE_MS;
|
|
328
|
+
var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
329
|
+
var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
|
|
330
|
+
var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
|
|
331
|
+
var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
|
|
332
|
+
var ZEROED_IDS = /* @__PURE__ */ new Set([
|
|
333
|
+
"00000000-0000-0000-0000-000000000000",
|
|
334
|
+
"38400000-8cf0-11bd-b23e-10b96e40000d"
|
|
335
|
+
]);
|
|
336
|
+
var hostIdentity;
|
|
337
|
+
var memoryStore = {};
|
|
338
|
+
var lgUdidResult;
|
|
339
|
+
var legacyCleared = false;
|
|
340
|
+
function isUsableAdId(value) {
|
|
341
|
+
if (typeof value !== "string") return false;
|
|
342
|
+
var t = value.trim();
|
|
343
|
+
if (!t) return false;
|
|
344
|
+
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
|
|
345
|
+
if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
|
|
346
|
+
return !ZEROED_IDS.has(t.toLowerCase());
|
|
347
|
+
}
|
|
348
|
+
function isZeroedAdId(value) {
|
|
349
|
+
return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
|
|
350
|
+
}
|
|
351
|
+
function normalizeIdType(value) {
|
|
352
|
+
if (typeof value !== "string") return void 0;
|
|
353
|
+
var lower = value.trim().toLowerCase();
|
|
354
|
+
if (!lower) return void 0;
|
|
355
|
+
var match = GOOGLE_ID_TYPES.find(function(t) {
|
|
356
|
+
return t.toLowerCase() === lower;
|
|
357
|
+
});
|
|
358
|
+
return match !== null && match !== void 0 ? match : "dpid";
|
|
359
|
+
}
|
|
360
|
+
function createUuid() {
|
|
361
|
+
var _bytes_, _bytes_1, _bytes_i;
|
|
362
|
+
var c = typeof crypto !== "undefined" ? crypto : void 0;
|
|
363
|
+
if (c && typeof c.randomUUID === "function") return c.randomUUID();
|
|
364
|
+
var bytes = new Uint8Array(16);
|
|
365
|
+
if (c && typeof c.getRandomValues === "function") {
|
|
366
|
+
c.getRandomValues(bytes);
|
|
367
|
+
} else {
|
|
368
|
+
for(var i = 0; i < 16; i++)bytes[i] = Math.floor(Math.random() * 256);
|
|
369
|
+
}
|
|
370
|
+
bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
|
|
371
|
+
bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
|
|
372
|
+
var hex = "";
|
|
373
|
+
for(var i1 = 0; i1 < 16; i1++)hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
|
|
374
|
+
return "".concat(hex.slice(0, 8), "-").concat(hex.slice(8, 12), "-").concat(hex.slice(12, 16), "-").concat(hex.slice(16, 20), "-").concat(hex.slice(20));
|
|
375
|
+
}
|
|
376
|
+
function readStored(key) {
|
|
377
|
+
try {
|
|
378
|
+
var _window_localStorage;
|
|
379
|
+
var raw = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
|
|
380
|
+
if (raw) {
|
|
381
|
+
var parsed = JSON.parse(raw);
|
|
382
|
+
if (parsed && typeof parsed.id === "string" && typeof parsed.createdAt === "number" && isFinite(parsed.createdAt)) {
|
|
383
|
+
return {
|
|
384
|
+
id: parsed.id,
|
|
385
|
+
createdAt: parsed.createdAt
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
} catch (unused) {}
|
|
390
|
+
return memoryStore[key];
|
|
391
|
+
}
|
|
392
|
+
function writeStored(key, value) {
|
|
393
|
+
memoryStore[key] = value;
|
|
394
|
+
try {
|
|
395
|
+
if (typeof window !== "undefined") {
|
|
396
|
+
var _window_localStorage;
|
|
397
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(key, JSON.stringify(value));
|
|
398
|
+
}
|
|
399
|
+
} catch (unused) {}
|
|
400
|
+
}
|
|
401
|
+
function clearLegacyIdsOnce() {
|
|
402
|
+
if (legacyCleared) return;
|
|
403
|
+
legacyCleared = true;
|
|
404
|
+
try {
|
|
405
|
+
var _window_localStorage;
|
|
406
|
+
if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(LEGACY_SESSION_KEY);
|
|
407
|
+
} catch (unused) {}
|
|
408
|
+
try {
|
|
409
|
+
if (typeof document !== "undefined") {
|
|
410
|
+
document.cookie = "".concat(encodeURIComponent(LEGACY_SESSION_KEY), "=;path=/;max-age=0;SameSite=Lax");
|
|
411
|
+
}
|
|
412
|
+
} catch (unused) {}
|
|
413
|
+
}
|
|
414
|
+
function clampAge(value, fallback, max) {
|
|
415
|
+
var v = typeof value === "number" && isFinite(value) && value > 0 ? value : fallback;
|
|
416
|
+
if (max != null) v = Math.min(v, max);
|
|
417
|
+
return v;
|
|
418
|
+
}
|
|
419
|
+
function getHostAdIdentity() {
|
|
420
|
+
return hostIdentity ? _object_spread({}, hostIdentity) : void 0;
|
|
421
|
+
}
|
|
422
|
+
function readSamsungTifa() {
|
|
423
|
+
try {
|
|
424
|
+
var _window_webapis;
|
|
425
|
+
var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
|
|
426
|
+
if (!adinfo) return void 0;
|
|
427
|
+
var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
|
|
428
|
+
var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
|
|
429
|
+
if (isZeroedAdId(tifa)) return {
|
|
430
|
+
deviceIdType: "tifa",
|
|
431
|
+
limitAdTracking: true
|
|
432
|
+
};
|
|
433
|
+
if (!isUsableAdId(tifa)) return void 0;
|
|
434
|
+
return _object_spread({
|
|
435
|
+
deviceId: tifa.trim(),
|
|
436
|
+
deviceIdType: "tifa"
|
|
437
|
+
}, typeof lat === "boolean" ? {
|
|
438
|
+
limitAdTracking: lat
|
|
439
|
+
} : {});
|
|
440
|
+
} catch (unused) {
|
|
441
|
+
return void 0;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
function readCachedLgUdid() {
|
|
445
|
+
return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
|
|
446
|
+
}
|
|
447
|
+
function getOrRotateFallbackDeviceId() {
|
|
448
|
+
var maxAgeMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS, now = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Date.now();
|
|
449
|
+
clearLegacyIdsOnce();
|
|
450
|
+
var age = clampAge(maxAgeMs, DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS);
|
|
451
|
+
var stored = readStored(FALLBACK_DEVICE_ID_KEY);
|
|
452
|
+
if (stored && isUsableAdId(stored.id) && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
|
|
453
|
+
return stored.id;
|
|
454
|
+
}
|
|
455
|
+
var id = createUuid();
|
|
456
|
+
writeStored(FALLBACK_DEVICE_ID_KEY, {
|
|
457
|
+
id: id,
|
|
458
|
+
createdAt: now
|
|
459
|
+
});
|
|
460
|
+
return id;
|
|
461
|
+
}
|
|
462
|
+
function getOrRotateSessionId() {
|
|
463
|
+
var maxAgeMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_SESSION_ID_MAX_AGE_MS, avoidValue = arguments.length > 1 ? arguments[1] : void 0, now = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Date.now();
|
|
464
|
+
clearLegacyIdsOnce();
|
|
465
|
+
var age = clampAge(maxAgeMs, DEFAULT_SESSION_ID_MAX_AGE_MS, MAX_SESSION_ID_AGE_MS);
|
|
466
|
+
var stored = readStored(SESSION_ID_KEY);
|
|
467
|
+
if (stored && isUsableAdId(stored.id) && stored.id !== avoidValue && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
|
|
468
|
+
return stored.id;
|
|
469
|
+
}
|
|
470
|
+
var id = createUuid();
|
|
471
|
+
while(id === avoidValue)id = createUuid();
|
|
472
|
+
writeStored(SESSION_ID_KEY, {
|
|
473
|
+
id: id,
|
|
474
|
+
createdAt: now
|
|
475
|
+
});
|
|
476
|
+
return id;
|
|
477
|
+
}
|
|
311
478
|
// src/utils/vastEnvironmentSignals.ts
|
|
312
|
-
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
313
479
|
var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
|
|
314
480
|
var DEVICE_ID_STORAGE_KEYS = [
|
|
315
481
|
"rdid",
|
|
@@ -328,49 +494,96 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
|
|
|
328
494
|
"adid"
|
|
329
495
|
]);
|
|
330
496
|
function resolveVastEnvironmentSignals(isCtv) {
|
|
331
|
-
var
|
|
332
|
-
var platformDevice = readPlatformNativeDeviceId();
|
|
333
|
-
var bridgeDeviceId = validDeviceId(bridgeSignals.deviceId);
|
|
334
|
-
var realDeviceId = bridgeDeviceId || (isCtv ? validDeviceId(readStoredDeviceId()) : void 0) || validDeviceId(platformDevice.deviceId);
|
|
335
|
-
var deviceId = realDeviceId;
|
|
336
|
-
var deviceIdType = (bridgeDeviceId ? bridgeSignals.deviceIdType : void 0) || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
|
|
337
|
-
var platformLat = bridgeDeviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
|
|
338
|
-
var limitAdTracking = deviceId != null ? platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking() : void 0;
|
|
339
|
-
if (!deviceId && isCtv) {
|
|
340
|
-
var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
|
|
341
|
-
if (dpid) {
|
|
342
|
-
deviceId = dpid;
|
|
343
|
-
deviceIdType = "dpid";
|
|
344
|
-
limitAdTracking = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking();
|
|
345
|
-
}
|
|
346
|
-
}
|
|
497
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
347
498
|
var deviceTypeHint = resolveDeviceTypeHint(isCtv);
|
|
499
|
+
var identity = resolveDeviceIdentity(isCtv, options);
|
|
500
|
+
var identityFields = _object_spread({}, identity.deviceId ? {
|
|
501
|
+
deviceId: identity.deviceId
|
|
502
|
+
} : {}, identity.deviceId && identity.deviceIdType ? {
|
|
503
|
+
deviceIdType: identity.deviceIdType
|
|
504
|
+
} : {}, identity.deviceId && identity.limitAdTracking != null ? {
|
|
505
|
+
limitAdTracking: identity.limitAdTracking
|
|
506
|
+
} : {}, identity.source ? {
|
|
507
|
+
deviceIdSource: identity.source
|
|
508
|
+
} : {});
|
|
348
509
|
if (isCtv) {
|
|
349
510
|
return _object_spread_props(_object_spread({
|
|
350
511
|
isCtv: true,
|
|
351
|
-
sessionId:
|
|
352
|
-
},
|
|
353
|
-
deviceId: deviceId
|
|
354
|
-
} : {}, deviceId && deviceIdType ? {
|
|
355
|
-
deviceIdType: deviceIdType
|
|
356
|
-
} : {}, deviceId && limitAdTracking != null ? {
|
|
357
|
-
limitAdTracking: limitAdTracking
|
|
358
|
-
} : {}), {
|
|
512
|
+
sessionId: getOrRotateSessionId(options.sessionIdMaxAgeMs, identity.deviceId)
|
|
513
|
+
}, identityFields), {
|
|
359
514
|
deviceTypeHint: deviceTypeHint
|
|
360
515
|
});
|
|
361
516
|
}
|
|
362
517
|
return _object_spread_props(_object_spread({
|
|
363
518
|
isCtv: false
|
|
364
|
-
},
|
|
365
|
-
deviceId: deviceId
|
|
366
|
-
} : {}, deviceId && deviceIdType ? {
|
|
367
|
-
deviceIdType: deviceIdType
|
|
368
|
-
} : {}, deviceId && limitAdTracking != null ? {
|
|
369
|
-
limitAdTracking: limitAdTracking
|
|
370
|
-
} : {}), {
|
|
519
|
+
}, identityFields), {
|
|
371
520
|
deviceTypeHint: deviceTypeHint
|
|
372
521
|
});
|
|
373
522
|
}
|
|
523
|
+
function resolveDeviceIdentity(isCtv, options) {
|
|
524
|
+
var _platform_limitAdTracking;
|
|
525
|
+
var host = getHostAdIdentity();
|
|
526
|
+
if (host) {
|
|
527
|
+
var _host_deviceIdType;
|
|
528
|
+
return _object_spread_props(_object_spread({
|
|
529
|
+
deviceId: host.deviceId,
|
|
530
|
+
deviceIdType: (_host_deviceIdType = host.deviceIdType) !== null && _host_deviceIdType !== void 0 ? _host_deviceIdType : "dpid"
|
|
531
|
+
}, host.limitAdTracking != null ? {
|
|
532
|
+
limitAdTracking: host.limitAdTracking
|
|
533
|
+
} : {}), {
|
|
534
|
+
source: "host"
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
var bridge = readNativeBridgeSignals();
|
|
538
|
+
var bridgeDeviceId = validDeviceId(bridge.deviceId);
|
|
539
|
+
if (bridgeDeviceId) {
|
|
540
|
+
var _normalizeIdType;
|
|
541
|
+
return _object_spread_props(_object_spread({
|
|
542
|
+
deviceId: bridgeDeviceId,
|
|
543
|
+
deviceIdType: (_normalizeIdType = normalizeIdType(bridge.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
544
|
+
}, bridge.limitAdTracking != null ? {
|
|
545
|
+
limitAdTracking: bridge.limitAdTracking
|
|
546
|
+
} : {}), {
|
|
547
|
+
source: "bridge"
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
var platform = readPlatformNativeDeviceId();
|
|
551
|
+
var platformDeviceId = validDeviceId(platform.deviceId);
|
|
552
|
+
if (platformDeviceId) {
|
|
553
|
+
var _platform_deviceIdType;
|
|
554
|
+
return _object_spread_props(_object_spread({
|
|
555
|
+
deviceId: platformDeviceId,
|
|
556
|
+
deviceIdType: (_platform_deviceIdType = platform.deviceIdType) !== null && _platform_deviceIdType !== void 0 ? _platform_deviceIdType : "dpid"
|
|
557
|
+
}, platform.limitAdTracking != null ? {
|
|
558
|
+
limitAdTracking: platform.limitAdTracking
|
|
559
|
+
} : {}), {
|
|
560
|
+
source: "platform"
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
if (!isCtv) return {};
|
|
564
|
+
var storedDeviceId = validDeviceId(readStoredDeviceId());
|
|
565
|
+
if (storedDeviceId) {
|
|
566
|
+
var _normalizeIdType1;
|
|
567
|
+
var storedLat = readStoredLimitAdTracking();
|
|
568
|
+
return _object_spread_props(_object_spread({
|
|
569
|
+
deviceId: storedDeviceId,
|
|
570
|
+
deviceIdType: (_normalizeIdType1 = normalizeIdType(readStoredString("deviceIdType") || readStoredString("idtype"))) !== null && _normalizeIdType1 !== void 0 ? _normalizeIdType1 : "dpid"
|
|
571
|
+
}, storedLat != null ? {
|
|
572
|
+
limitAdTracking: storedLat
|
|
573
|
+
} : {}), {
|
|
574
|
+
source: "stored"
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
var fallbackLat = (_platform_limitAdTracking = platform.limitAdTracking) !== null && _platform_limitAdTracking !== void 0 ? _platform_limitAdTracking : readStoredLimitAdTracking();
|
|
578
|
+
return _object_spread_props(_object_spread({
|
|
579
|
+
deviceId: getOrRotateFallbackDeviceId(options.fallbackDeviceIdMaxAgeMs),
|
|
580
|
+
deviceIdType: "dpid"
|
|
581
|
+
}, fallbackLat != null ? {
|
|
582
|
+
limitAdTracking: fallbackLat
|
|
583
|
+
} : {}), {
|
|
584
|
+
source: "generated"
|
|
585
|
+
});
|
|
586
|
+
}
|
|
374
587
|
var DEVICE_TYPE_HINT = {
|
|
375
588
|
FEATURE_PHONE: 1,
|
|
376
589
|
SMARTPHONE: 2,
|
|
@@ -531,7 +744,7 @@ function resolveNativeDeviceId() {
|
|
|
531
744
|
var bridgeSignals = readNativeBridgeSignals();
|
|
532
745
|
var platformDevice = readPlatformNativeDeviceId();
|
|
533
746
|
var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
|
|
534
|
-
if (!deviceId || isMacroPlaceholder(deviceId) ||
|
|
747
|
+
if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
|
|
535
748
|
return void 0;
|
|
536
749
|
}
|
|
537
750
|
return deviceId;
|
|
@@ -545,20 +758,10 @@ function getOrCreateStoredUuid(storageKey) {
|
|
|
545
758
|
writePersistentId(storageKey, existing);
|
|
546
759
|
return existing;
|
|
547
760
|
}
|
|
548
|
-
var id =
|
|
761
|
+
var id = createUuid2();
|
|
549
762
|
writePersistentId(storageKey, id);
|
|
550
763
|
return id;
|
|
551
764
|
}
|
|
552
|
-
function getOrCreateCtvSessionId() {
|
|
553
|
-
var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
|
|
554
|
-
if (existing) {
|
|
555
|
-
writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
|
|
556
|
-
return existing;
|
|
557
|
-
}
|
|
558
|
-
var sessionId = createUuid();
|
|
559
|
-
writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
560
|
-
return sessionId;
|
|
561
|
-
}
|
|
562
765
|
function readPersistentId(storageKey) {
|
|
563
766
|
return readStoredString(storageKey) || readCookie(storageKey);
|
|
564
767
|
}
|
|
@@ -611,7 +814,7 @@ function writeCookie(name, value) {
|
|
|
611
814
|
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
|
|
612
815
|
} catch (unused) {}
|
|
613
816
|
}
|
|
614
|
-
function
|
|
817
|
+
function createUuid2() {
|
|
615
818
|
var _bytes_, _bytes_1;
|
|
616
819
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
617
820
|
return crypto.randomUUID();
|
|
@@ -645,44 +848,10 @@ function performanceNow() {
|
|
|
645
848
|
}
|
|
646
849
|
function readPlatformNativeDeviceId() {
|
|
647
850
|
if (typeof window === "undefined") return {};
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
|
|
653
|
-
if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
|
|
654
|
-
var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
|
|
655
|
-
return _object_spread({
|
|
656
|
-
deviceId: tifa,
|
|
657
|
-
deviceIdType: "tifa"
|
|
658
|
-
}, typeof lat === "boolean" ? {
|
|
659
|
-
limitAdTracking: lat
|
|
660
|
-
} : {});
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
} catch (unused) {}
|
|
664
|
-
try {
|
|
665
|
-
var webOSDev = window.webOSDev;
|
|
666
|
-
if (webOSDev) {
|
|
667
|
-
var _webOSDev_lgudid;
|
|
668
|
-
var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
|
|
669
|
-
if (typeof lgudid === "string" && lgudid) {
|
|
670
|
-
if (isZeroedAdId(lgudid)) {
|
|
671
|
-
return {
|
|
672
|
-
deviceIdType: "lgudid",
|
|
673
|
-
limitAdTracking: true
|
|
674
|
-
};
|
|
675
|
-
}
|
|
676
|
-
if (!isMacroPlaceholder(lgudid)) {
|
|
677
|
-
return {
|
|
678
|
-
deviceId: lgudid,
|
|
679
|
-
deviceIdType: "lgudid",
|
|
680
|
-
limitAdTracking: false
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
} catch (unused) {}
|
|
851
|
+
var tifa = readSamsungTifa();
|
|
852
|
+
if (tifa) return tifa;
|
|
853
|
+
var lgudid = readCachedLgUdid();
|
|
854
|
+
if (lgudid) return lgudid;
|
|
686
855
|
try {
|
|
687
856
|
var roku = window.Roku;
|
|
688
857
|
if (roku) {
|
|
@@ -709,7 +878,7 @@ function isMacroPlaceholder(value) {
|
|
|
709
878
|
function validDeviceId(value) {
|
|
710
879
|
return value && !isMacroPlaceholder(value) ? value : void 0;
|
|
711
880
|
}
|
|
712
|
-
function
|
|
881
|
+
function isZeroedAdId2(value) {
|
|
713
882
|
return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
|
|
714
883
|
}
|
|
715
884
|
function readNativeBridgeSignals() {
|
|
@@ -753,7 +922,7 @@ function readNativeBridgeSignals() {
|
|
|
753
922
|
"deviceIdType",
|
|
754
923
|
"advertisingIdType",
|
|
755
924
|
"idType"
|
|
756
|
-
]) ||
|
|
925
|
+
]) || void 0;
|
|
757
926
|
var limitAdTracking = readBridgeBoolean(source, [
|
|
758
927
|
"is_lat",
|
|
759
928
|
"limitAdTracking",
|
|
@@ -1301,6 +1470,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1301
1470
|
set("GIVN", ctx.palNonce);
|
|
1302
1471
|
set("CT-TI", ctx.programTitle);
|
|
1303
1472
|
set("CT-CH", ctx.channelName);
|
|
1473
|
+
set("CT-NE", ctx.contentNetwork);
|
|
1304
1474
|
set("POD", ctx.pod);
|
|
1305
1475
|
set("CORRELATOR", ctx.correlator);
|
|
1306
1476
|
set("SCOR", ctx.streamCorrelator);
|
|
@@ -1522,6 +1692,9 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
1522
1692
|
if (ctx.channelName) {
|
|
1523
1693
|
params.set("ct_ch", ctx.channelName);
|
|
1524
1694
|
}
|
|
1695
|
+
if (ctx.contentNetwork) {
|
|
1696
|
+
params.set("ct_ne", ctx.contentNetwork);
|
|
1697
|
+
}
|
|
1525
1698
|
var staleKeys = [];
|
|
1526
1699
|
params.forEach(function(value, key) {
|
|
1527
1700
|
if (isMacroPlaceholder2(value)) {
|
|
@@ -1560,7 +1733,7 @@ function replaceCorrelatorFallback(baseUrl, correlator) {
|
|
|
1560
1733
|
return "".concat(baseUrl).concat(sep, "correlator=").concat(correlator);
|
|
1561
1734
|
}
|
|
1562
1735
|
// src/player/OptimizedPodRequest.ts
|
|
1563
|
-
var DEFAULT_REQUEST_SAFETY_MS =
|
|
1736
|
+
var DEFAULT_REQUEST_SAFETY_MS = 2500;
|
|
1564
1737
|
function nonNegativeInt(value) {
|
|
1565
1738
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : void 0;
|
|
1566
1739
|
}
|
|
@@ -1578,6 +1751,449 @@ function resolveAdPodConfig(config) {
|
|
|
1578
1751
|
exactDuration: config.podExactDuration === true
|
|
1579
1752
|
};
|
|
1580
1753
|
}
|
|
1754
|
+
// src/utils/contentMetadata.ts
|
|
1755
|
+
var MAX_CONTENT_VALUE_LENGTH = 128;
|
|
1756
|
+
var BRIDGE_KEYS = {
|
|
1757
|
+
channelName: [
|
|
1758
|
+
"channelName",
|
|
1759
|
+
"ct_ch"
|
|
1760
|
+
],
|
|
1761
|
+
programTitle: [
|
|
1762
|
+
"programTitle",
|
|
1763
|
+
"ct_ti"
|
|
1764
|
+
],
|
|
1765
|
+
contentNetwork: [
|
|
1766
|
+
"contentNetwork",
|
|
1767
|
+
"ct_ne"
|
|
1768
|
+
]
|
|
1769
|
+
};
|
|
1770
|
+
function sanitizeContentValue(value) {
|
|
1771
|
+
if (typeof value !== "string") return void 0;
|
|
1772
|
+
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
1773
|
+
if (!cleaned) return void 0;
|
|
1774
|
+
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
1775
|
+
if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
|
|
1776
|
+
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
1777
|
+
}
|
|
1778
|
+
function bridgeSources() {
|
|
1779
|
+
if (typeof window === "undefined") return [];
|
|
1780
|
+
var w = window;
|
|
1781
|
+
return [
|
|
1782
|
+
w.__STORMCLOUD_CTV__,
|
|
1783
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
1784
|
+
w.stormcloudCtv
|
|
1785
|
+
].filter(Boolean);
|
|
1786
|
+
}
|
|
1787
|
+
function readBridgeContentValue(keys) {
|
|
1788
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1789
|
+
try {
|
|
1790
|
+
for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1791
|
+
var source = _step.value;
|
|
1792
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
1793
|
+
try {
|
|
1794
|
+
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
1795
|
+
var key = _step1.value;
|
|
1796
|
+
var value = void 0;
|
|
1797
|
+
try {
|
|
1798
|
+
value = source === null || source === void 0 ? void 0 : source[key];
|
|
1799
|
+
if (typeof value === "function") value = value.call(source);
|
|
1800
|
+
} catch (unused) {
|
|
1801
|
+
value = void 0;
|
|
1802
|
+
}
|
|
1803
|
+
var sanitized = sanitizeContentValue(value);
|
|
1804
|
+
if (sanitized) return sanitized;
|
|
1805
|
+
}
|
|
1806
|
+
} catch (err) {
|
|
1807
|
+
_didIteratorError1 = true;
|
|
1808
|
+
_iteratorError1 = err;
|
|
1809
|
+
} finally{
|
|
1810
|
+
try {
|
|
1811
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
1812
|
+
_iterator1.return();
|
|
1813
|
+
}
|
|
1814
|
+
} finally{
|
|
1815
|
+
if (_didIteratorError1) {
|
|
1816
|
+
throw _iteratorError1;
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
} catch (err) {
|
|
1822
|
+
_didIteratorError = true;
|
|
1823
|
+
_iteratorError = err;
|
|
1824
|
+
} finally{
|
|
1825
|
+
try {
|
|
1826
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1827
|
+
_iterator.return();
|
|
1828
|
+
}
|
|
1829
|
+
} finally{
|
|
1830
|
+
if (_didIteratorError) {
|
|
1831
|
+
throw _iteratorError;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
return void 0;
|
|
1836
|
+
}
|
|
1837
|
+
function resolveContentMetadata(config) {
|
|
1838
|
+
var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2;
|
|
1839
|
+
var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
|
|
1840
|
+
var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
|
|
1841
|
+
var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
|
|
1842
|
+
return _object_spread({}, channelName ? {
|
|
1843
|
+
channelName: channelName
|
|
1844
|
+
} : {}, programTitle ? {
|
|
1845
|
+
programTitle: programTitle
|
|
1846
|
+
} : {}, contentNetwork ? {
|
|
1847
|
+
contentNetwork: contentNetwork
|
|
1848
|
+
} : {});
|
|
1849
|
+
}
|
|
1850
|
+
function appendMissingContentParams(url, meta) {
|
|
1851
|
+
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
1852
|
+
try {
|
|
1853
|
+
var parsed = new URL(url);
|
|
1854
|
+
var add = function add(key, value) {
|
|
1855
|
+
if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
|
|
1856
|
+
};
|
|
1857
|
+
add("ct_ch", meta.channelName);
|
|
1858
|
+
add("ct_ti", meta.programTitle);
|
|
1859
|
+
add("ct_ne", meta.contentNetwork);
|
|
1860
|
+
return parsed.toString();
|
|
1861
|
+
} catch (unused) {
|
|
1862
|
+
return url;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
// src/utils/deviceInfo.ts
|
|
1866
|
+
var CATEGORY_CODES = {
|
|
1867
|
+
"LG TV": "lg_tv",
|
|
1868
|
+
"LG Set-Top Box": "lg_stb",
|
|
1869
|
+
"Samsung TV": "samsung_tv",
|
|
1870
|
+
Other: "other"
|
|
1871
|
+
};
|
|
1872
|
+
var DEVICE_CATEGORIES = [
|
|
1873
|
+
"LG TV",
|
|
1874
|
+
"LG Set-Top Box",
|
|
1875
|
+
"Samsung TV",
|
|
1876
|
+
"Other"
|
|
1877
|
+
];
|
|
1878
|
+
var hostDeviceInfo;
|
|
1879
|
+
var lgDeviceInfo;
|
|
1880
|
+
var platformCache;
|
|
1881
|
+
var primePromise;
|
|
1882
|
+
function cleanString(value) {
|
|
1883
|
+
var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
|
|
1884
|
+
if (typeof value !== "string") return void 0;
|
|
1885
|
+
var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
1886
|
+
if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
|
|
1887
|
+
return t.length > maxLength ? t.slice(0, maxLength) : t;
|
|
1888
|
+
}
|
|
1889
|
+
function safeCall2(fn, thisArg) {
|
|
1890
|
+
if (typeof fn !== "function") return void 0;
|
|
1891
|
+
try {
|
|
1892
|
+
return fn.call(thisArg);
|
|
1893
|
+
} catch (unused) {
|
|
1894
|
+
return void 0;
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
function userAgent() {
|
|
1898
|
+
return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
|
|
1899
|
+
}
|
|
1900
|
+
function bridgeSources2() {
|
|
1901
|
+
if (typeof window === "undefined") return [];
|
|
1902
|
+
var w = window;
|
|
1903
|
+
return [
|
|
1904
|
+
w.__STORMCLOUD_CTV__,
|
|
1905
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
1906
|
+
w.stormcloudCtv
|
|
1907
|
+
].filter(Boolean);
|
|
1908
|
+
}
|
|
1909
|
+
function readBridge(keys) {
|
|
1910
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1911
|
+
try {
|
|
1912
|
+
for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1913
|
+
var source = _step.value;
|
|
1914
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
1915
|
+
try {
|
|
1916
|
+
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
1917
|
+
var key = _step1.value;
|
|
1918
|
+
var value = void 0;
|
|
1919
|
+
try {
|
|
1920
|
+
value = source === null || source === void 0 ? void 0 : source[key];
|
|
1921
|
+
if (typeof value === "function") value = value.call(source);
|
|
1922
|
+
} catch (unused) {
|
|
1923
|
+
value = void 0;
|
|
1924
|
+
}
|
|
1925
|
+
var clean = cleanString(value);
|
|
1926
|
+
if (clean) return clean;
|
|
1927
|
+
}
|
|
1928
|
+
} catch (err) {
|
|
1929
|
+
_didIteratorError1 = true;
|
|
1930
|
+
_iteratorError1 = err;
|
|
1931
|
+
} finally{
|
|
1932
|
+
try {
|
|
1933
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
1934
|
+
_iterator1.return();
|
|
1935
|
+
}
|
|
1936
|
+
} finally{
|
|
1937
|
+
if (_didIteratorError1) {
|
|
1938
|
+
throw _iteratorError1;
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
} catch (err) {
|
|
1944
|
+
_didIteratorError = true;
|
|
1945
|
+
_iteratorError = err;
|
|
1946
|
+
} finally{
|
|
1947
|
+
try {
|
|
1948
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1949
|
+
_iterator.return();
|
|
1950
|
+
}
|
|
1951
|
+
} finally{
|
|
1952
|
+
if (_didIteratorError) {
|
|
1953
|
+
throw _iteratorError;
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
return void 0;
|
|
1958
|
+
}
|
|
1959
|
+
function normalizeCategory(value) {
|
|
1960
|
+
var v = cleanString(value);
|
|
1961
|
+
if (!v) return void 0;
|
|
1962
|
+
var exact = DEVICE_CATEGORIES.find(function(c) {
|
|
1963
|
+
return c.toLowerCase() === v.toLowerCase();
|
|
1964
|
+
});
|
|
1965
|
+
if (exact) return exact;
|
|
1966
|
+
var code = v.toLowerCase().replace(/[\s-]+/g, "_");
|
|
1967
|
+
var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
|
|
1968
|
+
return CATEGORY_CODES[c] === code;
|
|
1969
|
+
});
|
|
1970
|
+
return byCode;
|
|
1971
|
+
}
|
|
1972
|
+
function parseUserAgentDeviceInfo(ua) {
|
|
1973
|
+
var sources = [];
|
|
1974
|
+
var out = {
|
|
1975
|
+
platform: "other",
|
|
1976
|
+
sources: sources
|
|
1977
|
+
};
|
|
1978
|
+
var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
|
|
1979
|
+
if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
|
|
1980
|
+
if (/Web0S|webOS/i.test(ua)) {
|
|
1981
|
+
out.platform = "webos";
|
|
1982
|
+
var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
|
|
1983
|
+
if (lg && lg[1] && lg[2]) {
|
|
1984
|
+
out.model = lg[1];
|
|
1985
|
+
out.firmware = lg[2];
|
|
1986
|
+
sources.push("user_agent");
|
|
1987
|
+
}
|
|
1988
|
+
} else if (/Tizen/i.test(ua)) {
|
|
1989
|
+
out.platform = "tizen";
|
|
1990
|
+
var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
|
|
1991
|
+
if (tizen && tizen[1]) {
|
|
1992
|
+
out.osVersion = "Tizen ".concat(tizen[1]);
|
|
1993
|
+
sources.push("user_agent");
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
return out;
|
|
1997
|
+
}
|
|
1998
|
+
function readSamsungProductInfo() {
|
|
1999
|
+
var _cleanString;
|
|
2000
|
+
var _window_webapis;
|
|
2001
|
+
if (typeof window === "undefined") return void 0;
|
|
2002
|
+
var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
|
|
2003
|
+
if (!productinfo) return void 0;
|
|
2004
|
+
var model = (_cleanString = cleanString(safeCall2(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall2(productinfo.getModel, productinfo), 40);
|
|
2005
|
+
var firmware = cleanString(safeCall2(productinfo.getFirmware, productinfo), 64);
|
|
2006
|
+
var duid = cleanString(safeCall2(productinfo.getDuid, productinfo), 128);
|
|
2007
|
+
if (!model && !firmware && !duid) return void 0;
|
|
2008
|
+
return _object_spread({}, model ? {
|
|
2009
|
+
model: model
|
|
2010
|
+
} : {}, firmware ? {
|
|
2011
|
+
firmware: firmware
|
|
2012
|
+
} : {}, duid ? {
|
|
2013
|
+
internalDeviceId: duid,
|
|
2014
|
+
internalDeviceIdSource: "samsung_duid"
|
|
2015
|
+
} : {});
|
|
2016
|
+
}
|
|
2017
|
+
function computePlatformInfo() {
|
|
2018
|
+
var info = parseUserAgentDeviceInfo(userAgent());
|
|
2019
|
+
var sources = _to_consumable_array(info.sources);
|
|
2020
|
+
var samsung = readSamsungProductInfo();
|
|
2021
|
+
if (samsung) {
|
|
2022
|
+
info.platform = "tizen";
|
|
2023
|
+
if (samsung.model) info.model = samsung.model;
|
|
2024
|
+
if (samsung.firmware) info.firmware = samsung.firmware;
|
|
2025
|
+
if (samsung.internalDeviceId) {
|
|
2026
|
+
info.internalDeviceId = samsung.internalDeviceId;
|
|
2027
|
+
info.internalDeviceIdSource = "samsung_duid";
|
|
2028
|
+
}
|
|
2029
|
+
sources.push("samsung_productinfo");
|
|
2030
|
+
}
|
|
2031
|
+
if (lgDeviceInfo) {
|
|
2032
|
+
info.platform = "webos";
|
|
2033
|
+
if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
|
|
2034
|
+
if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
|
|
2035
|
+
if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
|
|
2036
|
+
sources.push("lg_deviceinfo");
|
|
2037
|
+
}
|
|
2038
|
+
var lgUdid = readCachedLgUdid();
|
|
2039
|
+
if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
|
|
2040
|
+
info.internalDeviceId = lgUdid.deviceId;
|
|
2041
|
+
info.internalDeviceIdSource = "lg_udid";
|
|
2042
|
+
sources.push("lg_udid");
|
|
2043
|
+
}
|
|
2044
|
+
info.sources = sources;
|
|
2045
|
+
return info;
|
|
2046
|
+
}
|
|
2047
|
+
function categorize(platform, model) {
|
|
2048
|
+
if (platform === "tizen") return "Samsung TV";
|
|
2049
|
+
if (platform === "webos") {
|
|
2050
|
+
var ua = userAgent();
|
|
2051
|
+
if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
|
|
2052
|
+
return "LG TV";
|
|
2053
|
+
}
|
|
2054
|
+
return "Other";
|
|
2055
|
+
}
|
|
2056
|
+
function getDeviceInfo() {
|
|
2057
|
+
var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
|
|
2058
|
+
var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
|
|
2059
|
+
if (primePromise && !platformCache) {} else {
|
|
2060
|
+
platformCache = platform;
|
|
2061
|
+
}
|
|
2062
|
+
var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
|
|
2063
|
+
var bridge = {
|
|
2064
|
+
terminalId: readBridge([
|
|
2065
|
+
"terminalId",
|
|
2066
|
+
"terminal_id"
|
|
2067
|
+
]),
|
|
2068
|
+
internalDeviceId: readBridge([
|
|
2069
|
+
"internalDeviceId",
|
|
2070
|
+
"internal_device_id"
|
|
2071
|
+
]),
|
|
2072
|
+
model: readBridge([
|
|
2073
|
+
"deviceModel"
|
|
2074
|
+
]),
|
|
2075
|
+
firmware: readBridge([
|
|
2076
|
+
"firmwareVersion"
|
|
2077
|
+
]),
|
|
2078
|
+
category: normalizeCategory(readBridge([
|
|
2079
|
+
"deviceCategory"
|
|
2080
|
+
]))
|
|
2081
|
+
};
|
|
2082
|
+
var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
|
|
2083
|
+
var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
|
|
2084
|
+
var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
|
|
2085
|
+
var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
|
|
2086
|
+
var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
|
|
2087
|
+
var sources = _to_consumable_array(platform.sources);
|
|
2088
|
+
var bridgeValues = [
|
|
2089
|
+
bridge.terminalId,
|
|
2090
|
+
bridge.internalDeviceId,
|
|
2091
|
+
bridge.model,
|
|
2092
|
+
bridge.firmware,
|
|
2093
|
+
bridge.category
|
|
2094
|
+
];
|
|
2095
|
+
if (bridgeValues.some(function(v) {
|
|
2096
|
+
return v !== void 0;
|
|
2097
|
+
})) sources.unshift("bridge");
|
|
2098
|
+
if (hostDeviceInfo) sources.unshift("host");
|
|
2099
|
+
var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
|
|
2100
|
+
var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
|
|
2101
|
+
var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
|
|
2102
|
+
return _object_spread_props(_object_spread({
|
|
2103
|
+
category: category,
|
|
2104
|
+
categoryCode: CATEGORY_CODES[category]
|
|
2105
|
+
}, model ? {
|
|
2106
|
+
model: model
|
|
2107
|
+
} : {}, sonifiModel ? {
|
|
2108
|
+
sonifiModel: sonifiModel
|
|
2109
|
+
} : {}, firmware ? {
|
|
2110
|
+
firmware: firmware
|
|
2111
|
+
} : {}, platform.osVersion ? {
|
|
2112
|
+
osVersion: platform.osVersion
|
|
2113
|
+
} : {}, platform.browserMajorVersion != null ? {
|
|
2114
|
+
browserMajorVersion: platform.browserMajorVersion
|
|
2115
|
+
} : {}, internalDeviceId ? {
|
|
2116
|
+
internalDeviceId: internalDeviceId
|
|
2117
|
+
} : {}, internalDeviceId && internalDeviceIdSource ? {
|
|
2118
|
+
internalDeviceIdSource: internalDeviceIdSource
|
|
2119
|
+
} : {}, terminalId ? {
|
|
2120
|
+
terminalId: terminalId
|
|
2121
|
+
} : {}), {
|
|
2122
|
+
sources: sources
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
var DEVICE_KEY_VALUE_KEYS = {
|
|
2126
|
+
category: "sc_dev",
|
|
2127
|
+
model: "sc_model",
|
|
2128
|
+
firmware: "sc_fw"
|
|
2129
|
+
};
|
|
2130
|
+
function sanitizeKeyValue(value) {
|
|
2131
|
+
if (typeof value !== "string") return void 0;
|
|
2132
|
+
var v = value.trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
|
|
2133
|
+
return v ? v.slice(0, 40) : void 0;
|
|
2134
|
+
}
|
|
2135
|
+
function deviceKeyValuePairs(info) {
|
|
2136
|
+
var pairs = [
|
|
2137
|
+
[
|
|
2138
|
+
DEVICE_KEY_VALUE_KEYS.category,
|
|
2139
|
+
info.categoryCode
|
|
2140
|
+
]
|
|
2141
|
+
];
|
|
2142
|
+
var model = sanitizeKeyValue(info.model);
|
|
2143
|
+
var firmware = sanitizeKeyValue(info.firmware);
|
|
2144
|
+
if (model) pairs.push([
|
|
2145
|
+
DEVICE_KEY_VALUE_KEYS.model,
|
|
2146
|
+
model
|
|
2147
|
+
]);
|
|
2148
|
+
if (firmware) pairs.push([
|
|
2149
|
+
DEVICE_KEY_VALUE_KEYS.firmware,
|
|
2150
|
+
firmware
|
|
2151
|
+
]);
|
|
2152
|
+
return pairs;
|
|
2153
|
+
}
|
|
2154
|
+
function applyDeviceKeyValues(url, info) {
|
|
2155
|
+
try {
|
|
2156
|
+
var parsed = new URL(url);
|
|
2157
|
+
var pairs = deviceKeyValuePairs(info);
|
|
2158
|
+
var ours = new Set(pairs.map(function(param) {
|
|
2159
|
+
var _param = _sliced_to_array(param, 1), k = _param[0];
|
|
2160
|
+
return k;
|
|
2161
|
+
}));
|
|
2162
|
+
var existing = (parsed.searchParams.get("cust_params") || "").split("&").filter(function(p) {
|
|
2163
|
+
var _p_split_;
|
|
2164
|
+
return p !== "" && !ours.has((_p_split_ = p.split("=")[0]) !== null && _p_split_ !== void 0 ? _p_split_ : "");
|
|
2165
|
+
});
|
|
2166
|
+
var merged = existing.concat(pairs.map(function(param) {
|
|
2167
|
+
var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
|
|
2168
|
+
return "".concat(k, "=").concat(v);
|
|
2169
|
+
})).join("&");
|
|
2170
|
+
parsed.searchParams.set("cust_params", merged);
|
|
2171
|
+
return parsed.toString();
|
|
2172
|
+
} catch (unused) {
|
|
2173
|
+
return url;
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
function deviceInfoAnalyticsFields(info) {
|
|
2177
|
+
return _object_spread({
|
|
2178
|
+
device_category: info.category
|
|
2179
|
+
}, info.model ? {
|
|
2180
|
+
device_model: info.model
|
|
2181
|
+
} : {}, info.sonifiModel ? {
|
|
2182
|
+
sonifi_model: info.sonifiModel
|
|
2183
|
+
} : {}, info.firmware ? {
|
|
2184
|
+
firmware_version: info.firmware
|
|
2185
|
+
} : {}, info.osVersion ? {
|
|
2186
|
+
os_version: info.osVersion
|
|
2187
|
+
} : {}, info.browserMajorVersion != null ? {
|
|
2188
|
+
browser_major_version: info.browserMajorVersion
|
|
2189
|
+
} : {}, info.internalDeviceId ? {
|
|
2190
|
+
internal_device_id: info.internalDeviceId
|
|
2191
|
+
} : {}, info.internalDeviceIdSource ? {
|
|
2192
|
+
internal_device_id_source: info.internalDeviceIdSource
|
|
2193
|
+
} : {}, info.terminalId ? {
|
|
2194
|
+
terminal_id: info.terminalId
|
|
2195
|
+
} : {});
|
|
2196
|
+
}
|
|
1581
2197
|
// src/utils/devUrl.ts
|
|
1582
2198
|
var PRIVATE_HOST_PATTERNS = [
|
|
1583
2199
|
/^localhost$/i,
|
|
@@ -1694,20 +2310,25 @@ function ingestPlayerTracking(licenseKey, channel, body) {
|
|
|
1694
2310
|
// src/utils/tracking.ts
|
|
1695
2311
|
var cachedBrowserId = null;
|
|
1696
2312
|
function buildAnalyticsContext(config) {
|
|
1697
|
-
var _config_contentNetwork, _config_channelName, _config_programTitle;
|
|
2313
|
+
var _config_contentNetwork, _config_channelName, _config_programTitle, _config_src;
|
|
1698
2314
|
var context = {};
|
|
1699
2315
|
var contentNetwork = (_config_contentNetwork = config.contentNetwork) === null || _config_contentNetwork === void 0 ? void 0 : _config_contentNetwork.trim();
|
|
1700
2316
|
var contentChannel = (_config_channelName = config.channelName) === null || _config_channelName === void 0 ? void 0 : _config_channelName.trim();
|
|
1701
2317
|
var contentTitle = (_config_programTitle = config.programTitle) === null || _config_programTitle === void 0 ? void 0 : _config_programTitle.trim();
|
|
2318
|
+
var hlsUrl = (_config_src = config.src) === null || _config_src === void 0 ? void 0 : _config_src.trim();
|
|
1702
2319
|
if (contentNetwork) context.contentNetwork = contentNetwork;
|
|
1703
2320
|
if (contentChannel) context.contentChannel = contentChannel;
|
|
1704
2321
|
if (contentTitle) context.contentTitle = contentTitle;
|
|
2322
|
+
if (hlsUrl) context.hlsUrl = hlsUrl;
|
|
1705
2323
|
if (config.debugAdTiming) {
|
|
1706
2324
|
context.debugAdTiming = true;
|
|
1707
2325
|
}
|
|
1708
2326
|
if (config.isLiveStream !== void 0) {
|
|
1709
2327
|
context.inputStreamType = config.isLiveStream ? "live" : "vod";
|
|
1710
2328
|
}
|
|
2329
|
+
if (config.sendDeviceInfoToAnalytics) {
|
|
2330
|
+
context.includeDeviceInfo = true;
|
|
2331
|
+
}
|
|
1711
2332
|
return context;
|
|
1712
2333
|
}
|
|
1713
2334
|
function getClientInfo() {
|
|
@@ -2000,7 +2621,7 @@ function buildPlayerMetricEvent() {
|
|
|
2000
2621
|
capture_at: captureAt
|
|
2001
2622
|
}, context.inputStreamType ? {
|
|
2002
2623
|
input_stream_type: context.inputStreamType
|
|
2003
|
-
} : {})
|
|
2624
|
+
} : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
|
|
2004
2625
|
];
|
|
2005
2626
|
}
|
|
2006
2627
|
});
|
|
@@ -2591,7 +3212,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
2591
3212
|
key: "generatePodVastUrl",
|
|
2592
3213
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
2593
3214
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
2594
|
-
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest
|
|
3215
|
+
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
3216
|
+
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
3217
|
+
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
3218
|
+
});
|
|
3219
|
+
var content = resolveContentMetadata(this.config);
|
|
2595
3220
|
var macroContext = _object_spread_props(_object_spread({
|
|
2596
3221
|
correlator: this.viewCorrelator,
|
|
2597
3222
|
streamCorrelator: this.streamCorrelator,
|
|
@@ -2606,10 +3231,12 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
2606
3231
|
limitAdTracking: envSignals.limitAdTracking,
|
|
2607
3232
|
deviceTypeHint: envSignals.deviceTypeHint,
|
|
2608
3233
|
adTest: this.config.adTest
|
|
2609
|
-
},
|
|
2610
|
-
programTitle:
|
|
2611
|
-
} : {},
|
|
2612
|
-
channelName:
|
|
3234
|
+
}, content.programTitle ? {
|
|
3235
|
+
programTitle: content.programTitle
|
|
3236
|
+
} : {}, content.channelName ? {
|
|
3237
|
+
channelName: content.channelName
|
|
3238
|
+
} : {}, content.contentNetwork ? {
|
|
3239
|
+
contentNetwork: content.contentNetwork
|
|
2613
3240
|
} : {}), {
|
|
2614
3241
|
consent: this.consentSignals,
|
|
2615
3242
|
palNonce: palNonce.getCurrentNonce() || void 0
|
|
@@ -2627,6 +3254,24 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
2627
3254
|
} else {
|
|
2628
3255
|
finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
|
|
2629
3256
|
}
|
|
3257
|
+
finalUrl = appendMissingContentParams(finalUrl, content);
|
|
3258
|
+
if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
|
|
3259
|
+
finalUrl = applyDeviceKeyValues(finalUrl, getDeviceInfo());
|
|
3260
|
+
}
|
|
3261
|
+
if (this.debug) {
|
|
3262
|
+
var id = envSignals.deviceId;
|
|
3263
|
+
console.log("[AD-IDENTITY]", {
|
|
3264
|
+
source: envSignals.deviceIdSource,
|
|
3265
|
+
idtype: envSignals.deviceIdType,
|
|
3266
|
+
rdidTail: id ? id.slice(-4) : void 0,
|
|
3267
|
+
isLat: envSignals.limitAdTracking,
|
|
3268
|
+
dth: envSignals.deviceTypeHint,
|
|
3269
|
+
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
3270
|
+
ct_ch: content.channelName,
|
|
3271
|
+
ct_ti: content.programTitle,
|
|
3272
|
+
ct_ne: content.contentNetwork
|
|
3273
|
+
});
|
|
3274
|
+
}
|
|
2630
3275
|
console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
|
|
2631
3276
|
return finalUrl;
|
|
2632
3277
|
}
|
|
@@ -2678,7 +3323,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
2678
3323
|
}
|
|
2679
3324
|
},
|
|
2680
3325
|
{
|
|
2681
|
-
// --- Tracking ---
|
|
2682
3326
|
key: "initializeTracking",
|
|
2683
3327
|
value: function initializeTracking() {
|
|
2684
3328
|
var _this = this;
|