stormcloud-video-player 0.8.79 → 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 +1138 -159
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/StormcloudPlayer.d.cts +2 -0
- package/lib/index.cjs +1201 -161
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2 -0
- package/lib/index.d.ts +63 -2
- package/lib/index.js +1201 -161
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +419 -83
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdConfigManager.cjs +735 -93
- 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 +1138 -159
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +18 -1
- package/lib/players/HlsPlayer.cjs +1138 -159
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +1138 -159
- 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 +23 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +1201 -161
- 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 +386 -56
- 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
|
@@ -363,8 +363,264 @@ __export(StormcloudVideoPlayer_exports, {
|
|
|
363
363
|
});
|
|
364
364
|
module.exports = __toCommonJS(StormcloudVideoPlayer_exports);
|
|
365
365
|
var import_react = __toESM(require("react"), 1);
|
|
366
|
+
// src/utils/adIdentity.ts
|
|
367
|
+
var GOOGLE_ID_TYPES = [
|
|
368
|
+
"aaid",
|
|
369
|
+
"adid",
|
|
370
|
+
"afai",
|
|
371
|
+
"idfa",
|
|
372
|
+
"lgudid",
|
|
373
|
+
"msai",
|
|
374
|
+
"rida",
|
|
375
|
+
"tifa",
|
|
376
|
+
"tvOS",
|
|
377
|
+
"vaid",
|
|
378
|
+
"vida",
|
|
379
|
+
"dpid"
|
|
380
|
+
];
|
|
381
|
+
var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
|
|
382
|
+
var DEFAULT_SESSION_ID_MAX_AGE_MS = MAX_SESSION_ID_AGE_MS;
|
|
383
|
+
var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
384
|
+
var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
|
|
385
|
+
var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
|
|
386
|
+
var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
|
|
387
|
+
var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
|
|
388
|
+
var ZEROED_IDS = /* @__PURE__ */ new Set([
|
|
389
|
+
"00000000-0000-0000-0000-000000000000",
|
|
390
|
+
"38400000-8cf0-11bd-b23e-10b96e40000d"
|
|
391
|
+
]);
|
|
392
|
+
var hostIdentity;
|
|
393
|
+
var memoryStore = {};
|
|
394
|
+
var lgUdidResult;
|
|
395
|
+
var lgUdidPromise;
|
|
396
|
+
var legacyCleared = false;
|
|
397
|
+
function isUsableAdId(value) {
|
|
398
|
+
if (typeof value !== "string") return false;
|
|
399
|
+
var t = value.trim();
|
|
400
|
+
if (!t) return false;
|
|
401
|
+
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
|
|
402
|
+
if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
|
|
403
|
+
return !ZEROED_IDS.has(t.toLowerCase());
|
|
404
|
+
}
|
|
405
|
+
function isZeroedAdId(value) {
|
|
406
|
+
return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
|
|
407
|
+
}
|
|
408
|
+
function normalizeIdType(value) {
|
|
409
|
+
if (typeof value !== "string") return void 0;
|
|
410
|
+
var lower = value.trim().toLowerCase();
|
|
411
|
+
if (!lower) return void 0;
|
|
412
|
+
var match = GOOGLE_ID_TYPES.find(function(t) {
|
|
413
|
+
return t.toLowerCase() === lower;
|
|
414
|
+
});
|
|
415
|
+
return match !== null && match !== void 0 ? match : "dpid";
|
|
416
|
+
}
|
|
417
|
+
function createUuid() {
|
|
418
|
+
var _bytes_, _bytes_1, _bytes_i;
|
|
419
|
+
var c = typeof crypto !== "undefined" ? crypto : void 0;
|
|
420
|
+
if (c && typeof c.randomUUID === "function") return c.randomUUID();
|
|
421
|
+
var bytes = new Uint8Array(16);
|
|
422
|
+
if (c && typeof c.getRandomValues === "function") {
|
|
423
|
+
c.getRandomValues(bytes);
|
|
424
|
+
} else {
|
|
425
|
+
for(var i = 0; i < 16; i++)bytes[i] = Math.floor(Math.random() * 256);
|
|
426
|
+
}
|
|
427
|
+
bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
|
|
428
|
+
bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
|
|
429
|
+
var hex = "";
|
|
430
|
+
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");
|
|
431
|
+
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));
|
|
432
|
+
}
|
|
433
|
+
function readStored(key) {
|
|
434
|
+
try {
|
|
435
|
+
var _window_localStorage;
|
|
436
|
+
var raw = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
|
|
437
|
+
if (raw) {
|
|
438
|
+
var parsed = JSON.parse(raw);
|
|
439
|
+
if (parsed && typeof parsed.id === "string" && typeof parsed.createdAt === "number" && isFinite(parsed.createdAt)) {
|
|
440
|
+
return {
|
|
441
|
+
id: parsed.id,
|
|
442
|
+
createdAt: parsed.createdAt
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
} catch (unused) {}
|
|
447
|
+
return memoryStore[key];
|
|
448
|
+
}
|
|
449
|
+
function writeStored(key, value) {
|
|
450
|
+
memoryStore[key] = value;
|
|
451
|
+
try {
|
|
452
|
+
if (typeof window !== "undefined") {
|
|
453
|
+
var _window_localStorage;
|
|
454
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(key, JSON.stringify(value));
|
|
455
|
+
}
|
|
456
|
+
} catch (unused) {}
|
|
457
|
+
}
|
|
458
|
+
function removeStored(key) {
|
|
459
|
+
delete memoryStore[key];
|
|
460
|
+
try {
|
|
461
|
+
var _window_localStorage;
|
|
462
|
+
if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(key);
|
|
463
|
+
} catch (unused) {}
|
|
464
|
+
}
|
|
465
|
+
function clearLegacyIdsOnce() {
|
|
466
|
+
if (legacyCleared) return;
|
|
467
|
+
legacyCleared = true;
|
|
468
|
+
try {
|
|
469
|
+
var _window_localStorage;
|
|
470
|
+
if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(LEGACY_SESSION_KEY);
|
|
471
|
+
} catch (unused) {}
|
|
472
|
+
try {
|
|
473
|
+
if (typeof document !== "undefined") {
|
|
474
|
+
document.cookie = "".concat(encodeURIComponent(LEGACY_SESSION_KEY), "=;path=/;max-age=0;SameSite=Lax");
|
|
475
|
+
}
|
|
476
|
+
} catch (unused) {}
|
|
477
|
+
}
|
|
478
|
+
function clampAge(value, fallback, max) {
|
|
479
|
+
var v = typeof value === "number" && isFinite(value) && value > 0 ? value : fallback;
|
|
480
|
+
if (max != null) v = Math.min(v, max);
|
|
481
|
+
return v;
|
|
482
|
+
}
|
|
483
|
+
function setHostAdIdentity(identity) {
|
|
484
|
+
var _normalizeIdType;
|
|
485
|
+
if (!identity || !isUsableAdId(identity.deviceId)) {
|
|
486
|
+
hostIdentity = void 0;
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
var deviceId = identity.deviceId.trim();
|
|
490
|
+
var changed = !hostIdentity || hostIdentity.deviceId !== deviceId;
|
|
491
|
+
hostIdentity = _object_spread({
|
|
492
|
+
deviceId: deviceId,
|
|
493
|
+
deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
494
|
+
}, typeof identity.limitAdTracking === "boolean" ? {
|
|
495
|
+
limitAdTracking: identity.limitAdTracking
|
|
496
|
+
} : {});
|
|
497
|
+
if (changed) {
|
|
498
|
+
removeStored(SESSION_ID_KEY);
|
|
499
|
+
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function getHostAdIdentity() {
|
|
503
|
+
return hostIdentity ? _object_spread({}, hostIdentity) : void 0;
|
|
504
|
+
}
|
|
505
|
+
function resetAdIdentity() {
|
|
506
|
+
removeStored(SESSION_ID_KEY);
|
|
507
|
+
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
508
|
+
}
|
|
509
|
+
function readSamsungTifa() {
|
|
510
|
+
try {
|
|
511
|
+
var _window_webapis;
|
|
512
|
+
var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
|
|
513
|
+
if (!adinfo) return void 0;
|
|
514
|
+
var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
|
|
515
|
+
var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
|
|
516
|
+
if (isZeroedAdId(tifa)) return {
|
|
517
|
+
deviceIdType: "tifa",
|
|
518
|
+
limitAdTracking: true
|
|
519
|
+
};
|
|
520
|
+
if (!isUsableAdId(tifa)) return void 0;
|
|
521
|
+
return _object_spread({
|
|
522
|
+
deviceId: tifa.trim(),
|
|
523
|
+
deviceIdType: "tifa"
|
|
524
|
+
}, typeof lat === "boolean" ? {
|
|
525
|
+
limitAdTracking: lat
|
|
526
|
+
} : {});
|
|
527
|
+
} catch (unused) {
|
|
528
|
+
return void 0;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
function primeLgUdid() {
|
|
532
|
+
var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_LGUDID_TIMEOUT_MS;
|
|
533
|
+
if (lgUdidResult || lgUdidPromise) return lgUdidPromise !== null && lgUdidPromise !== void 0 ? lgUdidPromise : Promise.resolve();
|
|
534
|
+
var dev = typeof window !== "undefined" ? window.webOSDev : void 0;
|
|
535
|
+
if (!dev) return Promise.resolve();
|
|
536
|
+
if (typeof dev.LGUDID !== "function") {
|
|
537
|
+
var _dev_lgudid;
|
|
538
|
+
var direct = (_dev_lgudid = dev.lgudid) !== null && _dev_lgudid !== void 0 ? _dev_lgudid : dev.LGUDID;
|
|
539
|
+
if (isZeroedAdId(direct)) lgUdidResult = {
|
|
540
|
+
deviceIdType: "lgudid",
|
|
541
|
+
limitAdTracking: true
|
|
542
|
+
};
|
|
543
|
+
else if (isUsableAdId(direct)) {
|
|
544
|
+
lgUdidResult = {
|
|
545
|
+
deviceId: direct.trim(),
|
|
546
|
+
deviceIdType: "lgudid",
|
|
547
|
+
limitAdTracking: false
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
return Promise.resolve();
|
|
551
|
+
}
|
|
552
|
+
lgUdidPromise = new Promise(function(resolve) {
|
|
553
|
+
var settled = false;
|
|
554
|
+
var finish = function finish() {
|
|
555
|
+
if (settled) return;
|
|
556
|
+
settled = true;
|
|
557
|
+
clearTimeout(timer);
|
|
558
|
+
resolve();
|
|
559
|
+
};
|
|
560
|
+
var timer = setTimeout(finish, Math.max(0, timeoutMs));
|
|
561
|
+
try {
|
|
562
|
+
dev.LGUDID({
|
|
563
|
+
onSuccess: function onSuccess(res) {
|
|
564
|
+
var id = res === null || res === void 0 ? void 0 : res.id;
|
|
565
|
+
if (isZeroedAdId(id)) {
|
|
566
|
+
lgUdidResult = {
|
|
567
|
+
deviceIdType: "lgudid",
|
|
568
|
+
limitAdTracking: true
|
|
569
|
+
};
|
|
570
|
+
} else if (isUsableAdId(id)) {
|
|
571
|
+
lgUdidResult = {
|
|
572
|
+
deviceId: id.trim(),
|
|
573
|
+
deviceIdType: "lgudid",
|
|
574
|
+
limitAdTracking: false
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
finish();
|
|
578
|
+
},
|
|
579
|
+
onFailure: function onFailure() {
|
|
580
|
+
return finish();
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
} catch (unused) {
|
|
584
|
+
finish();
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
return lgUdidPromise;
|
|
588
|
+
}
|
|
589
|
+
function readCachedLgUdid() {
|
|
590
|
+
return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
|
|
591
|
+
}
|
|
592
|
+
function getOrRotateFallbackDeviceId() {
|
|
593
|
+
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();
|
|
594
|
+
clearLegacyIdsOnce();
|
|
595
|
+
var age = clampAge(maxAgeMs, DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS);
|
|
596
|
+
var stored = readStored(FALLBACK_DEVICE_ID_KEY);
|
|
597
|
+
if (stored && isUsableAdId(stored.id) && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
|
|
598
|
+
return stored.id;
|
|
599
|
+
}
|
|
600
|
+
var id = createUuid();
|
|
601
|
+
writeStored(FALLBACK_DEVICE_ID_KEY, {
|
|
602
|
+
id: id,
|
|
603
|
+
createdAt: now
|
|
604
|
+
});
|
|
605
|
+
return id;
|
|
606
|
+
}
|
|
607
|
+
function getOrRotateSessionId() {
|
|
608
|
+
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();
|
|
609
|
+
clearLegacyIdsOnce();
|
|
610
|
+
var age = clampAge(maxAgeMs, DEFAULT_SESSION_ID_MAX_AGE_MS, MAX_SESSION_ID_AGE_MS);
|
|
611
|
+
var stored = readStored(SESSION_ID_KEY);
|
|
612
|
+
if (stored && isUsableAdId(stored.id) && stored.id !== avoidValue && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
|
|
613
|
+
return stored.id;
|
|
614
|
+
}
|
|
615
|
+
var id = createUuid();
|
|
616
|
+
while(id === avoidValue)id = createUuid();
|
|
617
|
+
writeStored(SESSION_ID_KEY, {
|
|
618
|
+
id: id,
|
|
619
|
+
createdAt: now
|
|
620
|
+
});
|
|
621
|
+
return id;
|
|
622
|
+
}
|
|
366
623
|
// src/utils/vastEnvironmentSignals.ts
|
|
367
|
-
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
368
624
|
var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
|
|
369
625
|
var DEVICE_ID_STORAGE_KEYS = [
|
|
370
626
|
"rdid",
|
|
@@ -383,49 +639,96 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
|
|
|
383
639
|
"adid"
|
|
384
640
|
]);
|
|
385
641
|
function resolveVastEnvironmentSignals(isCtv) {
|
|
386
|
-
var
|
|
387
|
-
var platformDevice = readPlatformNativeDeviceId();
|
|
388
|
-
var bridgeDeviceId = validDeviceId(bridgeSignals.deviceId);
|
|
389
|
-
var realDeviceId = bridgeDeviceId || (isCtv ? validDeviceId(readStoredDeviceId()) : void 0) || validDeviceId(platformDevice.deviceId);
|
|
390
|
-
var deviceId = realDeviceId;
|
|
391
|
-
var deviceIdType = (bridgeDeviceId ? bridgeSignals.deviceIdType : void 0) || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
|
|
392
|
-
var platformLat = bridgeDeviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
|
|
393
|
-
var limitAdTracking = deviceId != null ? platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking() : void 0;
|
|
394
|
-
if (!deviceId && isCtv) {
|
|
395
|
-
var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
|
|
396
|
-
if (dpid) {
|
|
397
|
-
deviceId = dpid;
|
|
398
|
-
deviceIdType = "dpid";
|
|
399
|
-
limitAdTracking = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking();
|
|
400
|
-
}
|
|
401
|
-
}
|
|
642
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
402
643
|
var deviceTypeHint = resolveDeviceTypeHint(isCtv);
|
|
644
|
+
var identity = resolveDeviceIdentity(isCtv, options);
|
|
645
|
+
var identityFields = _object_spread({}, identity.deviceId ? {
|
|
646
|
+
deviceId: identity.deviceId
|
|
647
|
+
} : {}, identity.deviceId && identity.deviceIdType ? {
|
|
648
|
+
deviceIdType: identity.deviceIdType
|
|
649
|
+
} : {}, identity.deviceId && identity.limitAdTracking != null ? {
|
|
650
|
+
limitAdTracking: identity.limitAdTracking
|
|
651
|
+
} : {}, identity.source ? {
|
|
652
|
+
deviceIdSource: identity.source
|
|
653
|
+
} : {});
|
|
403
654
|
if (isCtv) {
|
|
404
655
|
return _object_spread_props(_object_spread({
|
|
405
656
|
isCtv: true,
|
|
406
|
-
sessionId:
|
|
407
|
-
},
|
|
408
|
-
deviceId: deviceId
|
|
409
|
-
} : {}, deviceId && deviceIdType ? {
|
|
410
|
-
deviceIdType: deviceIdType
|
|
411
|
-
} : {}, deviceId && limitAdTracking != null ? {
|
|
412
|
-
limitAdTracking: limitAdTracking
|
|
413
|
-
} : {}), {
|
|
657
|
+
sessionId: getOrRotateSessionId(options.sessionIdMaxAgeMs, identity.deviceId)
|
|
658
|
+
}, identityFields), {
|
|
414
659
|
deviceTypeHint: deviceTypeHint
|
|
415
660
|
});
|
|
416
661
|
}
|
|
417
662
|
return _object_spread_props(_object_spread({
|
|
418
663
|
isCtv: false
|
|
419
|
-
},
|
|
420
|
-
deviceId: deviceId
|
|
421
|
-
} : {}, deviceId && deviceIdType ? {
|
|
422
|
-
deviceIdType: deviceIdType
|
|
423
|
-
} : {}, deviceId && limitAdTracking != null ? {
|
|
424
|
-
limitAdTracking: limitAdTracking
|
|
425
|
-
} : {}), {
|
|
664
|
+
}, identityFields), {
|
|
426
665
|
deviceTypeHint: deviceTypeHint
|
|
427
666
|
});
|
|
428
667
|
}
|
|
668
|
+
function resolveDeviceIdentity(isCtv, options) {
|
|
669
|
+
var _platform_limitAdTracking;
|
|
670
|
+
var host = getHostAdIdentity();
|
|
671
|
+
if (host) {
|
|
672
|
+
var _host_deviceIdType;
|
|
673
|
+
return _object_spread_props(_object_spread({
|
|
674
|
+
deviceId: host.deviceId,
|
|
675
|
+
deviceIdType: (_host_deviceIdType = host.deviceIdType) !== null && _host_deviceIdType !== void 0 ? _host_deviceIdType : "dpid"
|
|
676
|
+
}, host.limitAdTracking != null ? {
|
|
677
|
+
limitAdTracking: host.limitAdTracking
|
|
678
|
+
} : {}), {
|
|
679
|
+
source: "host"
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
var bridge = readNativeBridgeSignals();
|
|
683
|
+
var bridgeDeviceId = validDeviceId(bridge.deviceId);
|
|
684
|
+
if (bridgeDeviceId) {
|
|
685
|
+
var _normalizeIdType;
|
|
686
|
+
return _object_spread_props(_object_spread({
|
|
687
|
+
deviceId: bridgeDeviceId,
|
|
688
|
+
deviceIdType: (_normalizeIdType = normalizeIdType(bridge.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
689
|
+
}, bridge.limitAdTracking != null ? {
|
|
690
|
+
limitAdTracking: bridge.limitAdTracking
|
|
691
|
+
} : {}), {
|
|
692
|
+
source: "bridge"
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
var platform = readPlatformNativeDeviceId();
|
|
696
|
+
var platformDeviceId = validDeviceId(platform.deviceId);
|
|
697
|
+
if (platformDeviceId) {
|
|
698
|
+
var _platform_deviceIdType;
|
|
699
|
+
return _object_spread_props(_object_spread({
|
|
700
|
+
deviceId: platformDeviceId,
|
|
701
|
+
deviceIdType: (_platform_deviceIdType = platform.deviceIdType) !== null && _platform_deviceIdType !== void 0 ? _platform_deviceIdType : "dpid"
|
|
702
|
+
}, platform.limitAdTracking != null ? {
|
|
703
|
+
limitAdTracking: platform.limitAdTracking
|
|
704
|
+
} : {}), {
|
|
705
|
+
source: "platform"
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
if (!isCtv) return {};
|
|
709
|
+
var storedDeviceId = validDeviceId(readStoredDeviceId());
|
|
710
|
+
if (storedDeviceId) {
|
|
711
|
+
var _normalizeIdType1;
|
|
712
|
+
var storedLat = readStoredLimitAdTracking();
|
|
713
|
+
return _object_spread_props(_object_spread({
|
|
714
|
+
deviceId: storedDeviceId,
|
|
715
|
+
deviceIdType: (_normalizeIdType1 = normalizeIdType(readStoredString("deviceIdType") || readStoredString("idtype"))) !== null && _normalizeIdType1 !== void 0 ? _normalizeIdType1 : "dpid"
|
|
716
|
+
}, storedLat != null ? {
|
|
717
|
+
limitAdTracking: storedLat
|
|
718
|
+
} : {}), {
|
|
719
|
+
source: "stored"
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
var fallbackLat = (_platform_limitAdTracking = platform.limitAdTracking) !== null && _platform_limitAdTracking !== void 0 ? _platform_limitAdTracking : readStoredLimitAdTracking();
|
|
723
|
+
return _object_spread_props(_object_spread({
|
|
724
|
+
deviceId: getOrRotateFallbackDeviceId(options.fallbackDeviceIdMaxAgeMs),
|
|
725
|
+
deviceIdType: "dpid"
|
|
726
|
+
}, fallbackLat != null ? {
|
|
727
|
+
limitAdTracking: fallbackLat
|
|
728
|
+
} : {}), {
|
|
729
|
+
source: "generated"
|
|
730
|
+
});
|
|
731
|
+
}
|
|
429
732
|
var DEVICE_TYPE_HINT = {
|
|
430
733
|
FEATURE_PHONE: 1,
|
|
431
734
|
SMARTPHONE: 2,
|
|
@@ -586,7 +889,7 @@ function resolveNativeDeviceId() {
|
|
|
586
889
|
var bridgeSignals = readNativeBridgeSignals();
|
|
587
890
|
var platformDevice = readPlatformNativeDeviceId();
|
|
588
891
|
var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
|
|
589
|
-
if (!deviceId || isMacroPlaceholder(deviceId) ||
|
|
892
|
+
if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
|
|
590
893
|
return void 0;
|
|
591
894
|
}
|
|
592
895
|
return deviceId;
|
|
@@ -600,20 +903,10 @@ function getOrCreateStoredUuid(storageKey) {
|
|
|
600
903
|
writePersistentId(storageKey, existing);
|
|
601
904
|
return existing;
|
|
602
905
|
}
|
|
603
|
-
var id =
|
|
906
|
+
var id = createUuid2();
|
|
604
907
|
writePersistentId(storageKey, id);
|
|
605
908
|
return id;
|
|
606
909
|
}
|
|
607
|
-
function getOrCreateCtvSessionId() {
|
|
608
|
-
var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
|
|
609
|
-
if (existing) {
|
|
610
|
-
writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
|
|
611
|
-
return existing;
|
|
612
|
-
}
|
|
613
|
-
var sessionId = createUuid();
|
|
614
|
-
writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
615
|
-
return sessionId;
|
|
616
|
-
}
|
|
617
910
|
function readPersistentId(storageKey) {
|
|
618
911
|
return readStoredString(storageKey) || readCookie(storageKey);
|
|
619
912
|
}
|
|
@@ -666,7 +959,7 @@ function writeCookie(name, value) {
|
|
|
666
959
|
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
|
|
667
960
|
} catch (unused) {}
|
|
668
961
|
}
|
|
669
|
-
function
|
|
962
|
+
function createUuid2() {
|
|
670
963
|
var _bytes_, _bytes_1;
|
|
671
964
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
672
965
|
return crypto.randomUUID();
|
|
@@ -700,44 +993,10 @@ function performanceNow() {
|
|
|
700
993
|
}
|
|
701
994
|
function readPlatformNativeDeviceId() {
|
|
702
995
|
if (typeof window === "undefined") return {};
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
|
|
708
|
-
if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
|
|
709
|
-
var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
|
|
710
|
-
return _object_spread({
|
|
711
|
-
deviceId: tifa,
|
|
712
|
-
deviceIdType: "tifa"
|
|
713
|
-
}, typeof lat === "boolean" ? {
|
|
714
|
-
limitAdTracking: lat
|
|
715
|
-
} : {});
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
} catch (unused) {}
|
|
719
|
-
try {
|
|
720
|
-
var webOSDev = window.webOSDev;
|
|
721
|
-
if (webOSDev) {
|
|
722
|
-
var _webOSDev_lgudid;
|
|
723
|
-
var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
|
|
724
|
-
if (typeof lgudid === "string" && lgudid) {
|
|
725
|
-
if (isZeroedAdId(lgudid)) {
|
|
726
|
-
return {
|
|
727
|
-
deviceIdType: "lgudid",
|
|
728
|
-
limitAdTracking: true
|
|
729
|
-
};
|
|
730
|
-
}
|
|
731
|
-
if (!isMacroPlaceholder(lgudid)) {
|
|
732
|
-
return {
|
|
733
|
-
deviceId: lgudid,
|
|
734
|
-
deviceIdType: "lgudid",
|
|
735
|
-
limitAdTracking: false
|
|
736
|
-
};
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
} catch (unused) {}
|
|
996
|
+
var tifa = readSamsungTifa();
|
|
997
|
+
if (tifa) return tifa;
|
|
998
|
+
var lgudid = readCachedLgUdid();
|
|
999
|
+
if (lgudid) return lgudid;
|
|
741
1000
|
try {
|
|
742
1001
|
var roku = window.Roku;
|
|
743
1002
|
if (roku) {
|
|
@@ -764,7 +1023,7 @@ function isMacroPlaceholder(value) {
|
|
|
764
1023
|
function validDeviceId(value) {
|
|
765
1024
|
return value && !isMacroPlaceholder(value) ? value : void 0;
|
|
766
1025
|
}
|
|
767
|
-
function
|
|
1026
|
+
function isZeroedAdId2(value) {
|
|
768
1027
|
return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
|
|
769
1028
|
}
|
|
770
1029
|
function readNativeBridgeSignals() {
|
|
@@ -808,7 +1067,7 @@ function readNativeBridgeSignals() {
|
|
|
808
1067
|
"deviceIdType",
|
|
809
1068
|
"advertisingIdType",
|
|
810
1069
|
"idType"
|
|
811
|
-
]) ||
|
|
1070
|
+
]) || void 0;
|
|
812
1071
|
var limitAdTracking = readBridgeBoolean(source, [
|
|
813
1072
|
"is_lat",
|
|
814
1073
|
"limitAdTracking",
|
|
@@ -1356,6 +1615,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1356
1615
|
set("GIVN", ctx.palNonce);
|
|
1357
1616
|
set("CT-TI", ctx.programTitle);
|
|
1358
1617
|
set("CT-CH", ctx.channelName);
|
|
1618
|
+
set("CT-NE", ctx.contentNetwork);
|
|
1359
1619
|
set("POD", ctx.pod);
|
|
1360
1620
|
set("CORRELATOR", ctx.correlator);
|
|
1361
1621
|
set("SCOR", ctx.streamCorrelator);
|
|
@@ -1584,6 +1844,9 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
1584
1844
|
if (ctx.channelName) {
|
|
1585
1845
|
params.set("ct_ch", ctx.channelName);
|
|
1586
1846
|
}
|
|
1847
|
+
if (ctx.contentNetwork) {
|
|
1848
|
+
params.set("ct_ne", ctx.contentNetwork);
|
|
1849
|
+
}
|
|
1587
1850
|
var staleKeys = [];
|
|
1588
1851
|
params.forEach(function(value, key) {
|
|
1589
1852
|
if (isMacroPlaceholder2(value)) {
|
|
@@ -2248,8 +2511,17 @@ function detectBrowser() {
|
|
|
2248
2511
|
chromeVersion: chromeVersionNum
|
|
2249
2512
|
};
|
|
2250
2513
|
}
|
|
2514
|
+
var singleDecoderOverride;
|
|
2515
|
+
function setSingleDecoderOverride(value) {
|
|
2516
|
+
singleDecoderOverride = value;
|
|
2517
|
+
}
|
|
2251
2518
|
function requiresMediaPipelineResetAfterAds() {
|
|
2252
2519
|
var _browser_tizenVersion;
|
|
2520
|
+
if (singleDecoderOverride != null) return singleDecoderOverride;
|
|
2521
|
+
try {
|
|
2522
|
+
var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
|
|
2523
|
+
if (typeof globalOverride === "boolean") return globalOverride;
|
|
2524
|
+
} catch (unused) {}
|
|
2253
2525
|
var browser = detectBrowser();
|
|
2254
2526
|
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
2255
2527
|
}
|
|
@@ -2409,7 +2681,7 @@ function substituteVastTrackingMacros(url) {
|
|
|
2409
2681
|
});
|
|
2410
2682
|
}
|
|
2411
2683
|
// src/player/OptimizedPodRequest.ts
|
|
2412
|
-
var DEFAULT_REQUEST_SAFETY_MS =
|
|
2684
|
+
var DEFAULT_REQUEST_SAFETY_MS = 2500;
|
|
2413
2685
|
var GAM_AD_OPPORTUNITY_DURATION_MS = 3e4;
|
|
2414
2686
|
var POD_PARAM_KEYS = [
|
|
2415
2687
|
"pmnd",
|
|
@@ -2833,6 +3105,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2833
3105
|
var mediaCandidateIndex = 0;
|
|
2834
3106
|
var mediaStartTimerId;
|
|
2835
3107
|
var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
|
|
3108
|
+
var MAX_MEDIA_START_ATTEMPTS = 2;
|
|
3109
|
+
var MEDIA_START_TOTAL_BUDGET_MS = Math.max(MEDIA_START_TIMEOUT_MS, 1e4);
|
|
3110
|
+
var mediaStartBudgetStartedAt = 0;
|
|
2836
3111
|
var VAST_ERROR_MEDIA_TIMEOUT = 402;
|
|
2837
3112
|
var pendingVastRequests = /* @__PURE__ */ new Set();
|
|
2838
3113
|
var pendingRequestAbortReason;
|
|
@@ -4847,12 +5122,14 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
4847
5122
|
clearMediaStartTimer();
|
|
4848
5123
|
if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
|
|
4849
5124
|
var startedAt = Date.now();
|
|
5125
|
+
var budgetLeftMs = mediaStartBudgetStartedAt > 0 ? MEDIA_START_TOTAL_BUDGET_MS - (startedAt - mediaStartBudgetStartedAt) : MEDIA_START_TIMEOUT_MS;
|
|
5126
|
+
var timeoutMs = Math.max(1e3, Math.min(MEDIA_START_TIMEOUT_MS, budgetLeftMs));
|
|
4850
5127
|
mediaStartTimerId = setTimeout(function() {
|
|
4851
5128
|
mediaStartTimerId = void 0;
|
|
4852
5129
|
if (!adPlaying || trackingFired.impression) return;
|
|
4853
|
-
console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(
|
|
5130
|
+
console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(timeoutMs, "ms"));
|
|
4854
5131
|
logFunnel("play_resolved_but_never_started", {
|
|
4855
|
-
timeoutMs:
|
|
5132
|
+
timeoutMs: timeoutMs,
|
|
4856
5133
|
elapsedMs: Date.now() - startedAt,
|
|
4857
5134
|
readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
|
|
4858
5135
|
networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
|
|
@@ -4861,7 +5138,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
4861
5138
|
vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
|
|
4862
5139
|
});
|
|
4863
5140
|
recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
|
|
4864
|
-
},
|
|
5141
|
+
}, timeoutMs);
|
|
4865
5142
|
}
|
|
4866
5143
|
function resetVideoElementForNextSource() {
|
|
4867
5144
|
clearStallWatchdog();
|
|
@@ -4876,6 +5153,20 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
4876
5153
|
function tryNextMediaCandidate() {
|
|
4877
5154
|
if (!currentAd || trackingFired.impression) return false;
|
|
4878
5155
|
if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
|
|
5156
|
+
if (mediaCandidateIndex + 1 >= MAX_MEDIA_START_ATTEMPTS) {
|
|
5157
|
+
logFunnel("media_fallback_capped", {
|
|
5158
|
+
reason: "max_attempts",
|
|
5159
|
+
attempts: mediaCandidateIndex + 1
|
|
5160
|
+
});
|
|
5161
|
+
return false;
|
|
5162
|
+
}
|
|
5163
|
+
if (mediaStartBudgetStartedAt > 0 && Date.now() - mediaStartBudgetStartedAt >= MEDIA_START_TOTAL_BUDGET_MS) {
|
|
5164
|
+
logFunnel("media_fallback_capped", {
|
|
5165
|
+
reason: "time_budget",
|
|
5166
|
+
elapsedMs: Date.now() - mediaStartBudgetStartedAt
|
|
5167
|
+
});
|
|
5168
|
+
return false;
|
|
5169
|
+
}
|
|
4879
5170
|
var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
|
|
4880
5171
|
mediaCandidateIndex++;
|
|
4881
5172
|
var next = mediaCandidates[mediaCandidateIndex];
|
|
@@ -4909,6 +5200,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
4909
5200
|
}
|
|
4910
5201
|
mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
|
|
4911
5202
|
mediaCandidateIndex = 0;
|
|
5203
|
+
mediaStartBudgetStartedAt = Date.now();
|
|
4912
5204
|
var mediaFile = mediaCandidates[0];
|
|
4913
5205
|
if (!mediaFile) {
|
|
4914
5206
|
logFunnel("media_unsupported", {
|
|
@@ -5848,6 +6140,7 @@ function getOrCreateNonceLoader(allowStorage) {
|
|
|
5848
6140
|
}
|
|
5849
6141
|
function createPalNonceManager() {
|
|
5850
6142
|
var currentNonce = "";
|
|
6143
|
+
var currentNonceCreatedAt = 0;
|
|
5851
6144
|
var currentNonceManager;
|
|
5852
6145
|
var pendingNonce;
|
|
5853
6146
|
return {
|
|
@@ -5864,6 +6157,9 @@ function createPalNonceManager() {
|
|
|
5864
6157
|
getCurrentNonce: function getCurrentNonce() {
|
|
5865
6158
|
return currentNonce;
|
|
5866
6159
|
},
|
|
6160
|
+
getNonceAgeMs: function getNonceAgeMs() {
|
|
6161
|
+
return currentNonce ? Date.now() - currentNonceCreatedAt : void 0;
|
|
6162
|
+
},
|
|
5867
6163
|
waitForNonce: function waitForNonce(maxWaitMs) {
|
|
5868
6164
|
if (currentNonce) return Promise.resolve(currentNonce);
|
|
5869
6165
|
var pending = pendingNonce;
|
|
@@ -5916,13 +6212,14 @@ function createPalNonceManager() {
|
|
|
5916
6212
|
},
|
|
5917
6213
|
reset: function reset() {
|
|
5918
6214
|
currentNonce = "";
|
|
6215
|
+
currentNonceCreatedAt = 0;
|
|
5919
6216
|
currentNonceManager = void 0;
|
|
5920
6217
|
pendingNonce = void 0;
|
|
5921
6218
|
}
|
|
5922
6219
|
};
|
|
5923
6220
|
function generate(options) {
|
|
5924
6221
|
return _async_to_generator(function() {
|
|
5925
|
-
var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
|
|
6222
|
+
var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, _options_iconsSupported, _options_supportedApiFrameworks, loader, goog, request, apiFrameworks, manager, error;
|
|
5926
6223
|
return _ts_generator(this, function(_state) {
|
|
5927
6224
|
switch(_state.label){
|
|
5928
6225
|
case 0:
|
|
@@ -5946,10 +6243,11 @@ function createPalNonceManager() {
|
|
|
5946
6243
|
request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
|
|
5947
6244
|
request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
|
|
5948
6245
|
request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
|
|
5949
|
-
request.iconsSupported =
|
|
6246
|
+
request.iconsSupported = (_options_iconsSupported = options.iconsSupported) !== null && _options_iconsSupported !== void 0 ? _options_iconsSupported : false;
|
|
5950
6247
|
request.playerType = "StormcloudVideoPlayer";
|
|
5951
6248
|
request.playerVersion = "1.0";
|
|
5952
|
-
|
|
6249
|
+
apiFrameworks = ((_options_supportedApiFrameworks = options.supportedApiFrameworks) !== null && _options_supportedApiFrameworks !== void 0 ? _options_supportedApiFrameworks : "").trim();
|
|
6250
|
+
if (apiFrameworks) request.supportedApiFrameworks = apiFrameworks;
|
|
5953
6251
|
request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
|
|
5954
6252
|
request.videoWidth = options.videoWidth || 640;
|
|
5955
6253
|
request.videoHeight = options.videoHeight || 480;
|
|
@@ -5979,6 +6277,7 @@ function createPalNonceManager() {
|
|
|
5979
6277
|
manager = _state.sent();
|
|
5980
6278
|
currentNonceManager = manager;
|
|
5981
6279
|
currentNonce = manager.getNonce();
|
|
6280
|
+
currentNonceCreatedAt = Date.now();
|
|
5982
6281
|
console.log("[PAL] Nonce generated successfully");
|
|
5983
6282
|
return [
|
|
5984
6283
|
2,
|
|
@@ -6002,6 +6301,549 @@ function createPalNonceManager() {
|
|
|
6002
6301
|
})();
|
|
6003
6302
|
}
|
|
6004
6303
|
}
|
|
6304
|
+
// src/utils/deviceInfo.ts
|
|
6305
|
+
var CATEGORY_CODES = {
|
|
6306
|
+
"LG TV": "lg_tv",
|
|
6307
|
+
"LG Set-Top Box": "lg_stb",
|
|
6308
|
+
"Samsung TV": "samsung_tv",
|
|
6309
|
+
Other: "other"
|
|
6310
|
+
};
|
|
6311
|
+
var DEVICE_CATEGORIES = [
|
|
6312
|
+
"LG TV",
|
|
6313
|
+
"LG Set-Top Box",
|
|
6314
|
+
"Samsung TV",
|
|
6315
|
+
"Other"
|
|
6316
|
+
];
|
|
6317
|
+
var hostDeviceInfo;
|
|
6318
|
+
var lgDeviceInfo;
|
|
6319
|
+
var platformCache;
|
|
6320
|
+
var primePromise;
|
|
6321
|
+
function cleanString(value) {
|
|
6322
|
+
var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
|
|
6323
|
+
if (typeof value !== "string") return void 0;
|
|
6324
|
+
var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
6325
|
+
if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
|
|
6326
|
+
return t.length > maxLength ? t.slice(0, maxLength) : t;
|
|
6327
|
+
}
|
|
6328
|
+
function safeCall2(fn, thisArg) {
|
|
6329
|
+
if (typeof fn !== "function") return void 0;
|
|
6330
|
+
try {
|
|
6331
|
+
return fn.call(thisArg);
|
|
6332
|
+
} catch (unused) {
|
|
6333
|
+
return void 0;
|
|
6334
|
+
}
|
|
6335
|
+
}
|
|
6336
|
+
function userAgent() {
|
|
6337
|
+
return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
|
|
6338
|
+
}
|
|
6339
|
+
function bridgeSources() {
|
|
6340
|
+
if (typeof window === "undefined") return [];
|
|
6341
|
+
var w = window;
|
|
6342
|
+
return [
|
|
6343
|
+
w.__STORMCLOUD_CTV__,
|
|
6344
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
6345
|
+
w.stormcloudCtv
|
|
6346
|
+
].filter(Boolean);
|
|
6347
|
+
}
|
|
6348
|
+
function readBridge(keys) {
|
|
6349
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6350
|
+
try {
|
|
6351
|
+
for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6352
|
+
var source = _step.value;
|
|
6353
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
6354
|
+
try {
|
|
6355
|
+
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
6356
|
+
var key = _step1.value;
|
|
6357
|
+
var value = void 0;
|
|
6358
|
+
try {
|
|
6359
|
+
value = source === null || source === void 0 ? void 0 : source[key];
|
|
6360
|
+
if (typeof value === "function") value = value.call(source);
|
|
6361
|
+
} catch (unused) {
|
|
6362
|
+
value = void 0;
|
|
6363
|
+
}
|
|
6364
|
+
var clean = cleanString(value);
|
|
6365
|
+
if (clean) return clean;
|
|
6366
|
+
}
|
|
6367
|
+
} catch (err) {
|
|
6368
|
+
_didIteratorError1 = true;
|
|
6369
|
+
_iteratorError1 = err;
|
|
6370
|
+
} finally{
|
|
6371
|
+
try {
|
|
6372
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
6373
|
+
_iterator1.return();
|
|
6374
|
+
}
|
|
6375
|
+
} finally{
|
|
6376
|
+
if (_didIteratorError1) {
|
|
6377
|
+
throw _iteratorError1;
|
|
6378
|
+
}
|
|
6379
|
+
}
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
} catch (err) {
|
|
6383
|
+
_didIteratorError = true;
|
|
6384
|
+
_iteratorError = err;
|
|
6385
|
+
} finally{
|
|
6386
|
+
try {
|
|
6387
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
6388
|
+
_iterator.return();
|
|
6389
|
+
}
|
|
6390
|
+
} finally{
|
|
6391
|
+
if (_didIteratorError) {
|
|
6392
|
+
throw _iteratorError;
|
|
6393
|
+
}
|
|
6394
|
+
}
|
|
6395
|
+
}
|
|
6396
|
+
return void 0;
|
|
6397
|
+
}
|
|
6398
|
+
function normalizeCategory(value) {
|
|
6399
|
+
var v = cleanString(value);
|
|
6400
|
+
if (!v) return void 0;
|
|
6401
|
+
var exact = DEVICE_CATEGORIES.find(function(c) {
|
|
6402
|
+
return c.toLowerCase() === v.toLowerCase();
|
|
6403
|
+
});
|
|
6404
|
+
if (exact) return exact;
|
|
6405
|
+
var code = v.toLowerCase().replace(/[\s-]+/g, "_");
|
|
6406
|
+
var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
|
|
6407
|
+
return CATEGORY_CODES[c] === code;
|
|
6408
|
+
});
|
|
6409
|
+
return byCode;
|
|
6410
|
+
}
|
|
6411
|
+
function parseUserAgentDeviceInfo(ua) {
|
|
6412
|
+
var sources = [];
|
|
6413
|
+
var out = {
|
|
6414
|
+
platform: "other",
|
|
6415
|
+
sources: sources
|
|
6416
|
+
};
|
|
6417
|
+
var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
|
|
6418
|
+
if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
|
|
6419
|
+
if (/Web0S|webOS/i.test(ua)) {
|
|
6420
|
+
out.platform = "webos";
|
|
6421
|
+
var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
|
|
6422
|
+
if (lg && lg[1] && lg[2]) {
|
|
6423
|
+
out.model = lg[1];
|
|
6424
|
+
out.firmware = lg[2];
|
|
6425
|
+
sources.push("user_agent");
|
|
6426
|
+
}
|
|
6427
|
+
} else if (/Tizen/i.test(ua)) {
|
|
6428
|
+
out.platform = "tizen";
|
|
6429
|
+
var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
|
|
6430
|
+
if (tizen && tizen[1]) {
|
|
6431
|
+
out.osVersion = "Tizen ".concat(tizen[1]);
|
|
6432
|
+
sources.push("user_agent");
|
|
6433
|
+
}
|
|
6434
|
+
}
|
|
6435
|
+
return out;
|
|
6436
|
+
}
|
|
6437
|
+
function readSamsungProductInfo() {
|
|
6438
|
+
var _cleanString;
|
|
6439
|
+
var _window_webapis;
|
|
6440
|
+
if (typeof window === "undefined") return void 0;
|
|
6441
|
+
var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
|
|
6442
|
+
if (!productinfo) return void 0;
|
|
6443
|
+
var model = (_cleanString = cleanString(safeCall2(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall2(productinfo.getModel, productinfo), 40);
|
|
6444
|
+
var firmware = cleanString(safeCall2(productinfo.getFirmware, productinfo), 64);
|
|
6445
|
+
var duid = cleanString(safeCall2(productinfo.getDuid, productinfo), 128);
|
|
6446
|
+
if (!model && !firmware && !duid) return void 0;
|
|
6447
|
+
return _object_spread({}, model ? {
|
|
6448
|
+
model: model
|
|
6449
|
+
} : {}, firmware ? {
|
|
6450
|
+
firmware: firmware
|
|
6451
|
+
} : {}, duid ? {
|
|
6452
|
+
internalDeviceId: duid,
|
|
6453
|
+
internalDeviceIdSource: "samsung_duid"
|
|
6454
|
+
} : {});
|
|
6455
|
+
}
|
|
6456
|
+
function readLgDeviceInfo(timeoutMs) {
|
|
6457
|
+
var webOS = typeof window !== "undefined" ? window.webOS : void 0;
|
|
6458
|
+
if (lgDeviceInfo || !webOS || typeof webOS.deviceInfo !== "function") return Promise.resolve();
|
|
6459
|
+
return new Promise(function(resolve) {
|
|
6460
|
+
var settled = false;
|
|
6461
|
+
var finish = function finish() {
|
|
6462
|
+
if (settled) return;
|
|
6463
|
+
settled = true;
|
|
6464
|
+
clearTimeout(timer);
|
|
6465
|
+
resolve();
|
|
6466
|
+
};
|
|
6467
|
+
var timer = setTimeout(finish, Math.max(0, timeoutMs));
|
|
6468
|
+
try {
|
|
6469
|
+
webOS.deviceInfo(function(info) {
|
|
6470
|
+
var model = cleanString(info === null || info === void 0 ? void 0 : info.modelName, 40);
|
|
6471
|
+
var firmware = cleanString(info === null || info === void 0 ? void 0 : info.version, 64);
|
|
6472
|
+
var sdkVersion = cleanString(info === null || info === void 0 ? void 0 : info.sdkVersion, 32);
|
|
6473
|
+
lgDeviceInfo = _object_spread({}, model ? {
|
|
6474
|
+
model: model
|
|
6475
|
+
} : {}, firmware ? {
|
|
6476
|
+
firmware: firmware
|
|
6477
|
+
} : {}, sdkVersion ? {
|
|
6478
|
+
sdkVersion: sdkVersion
|
|
6479
|
+
} : {});
|
|
6480
|
+
finish();
|
|
6481
|
+
});
|
|
6482
|
+
} catch (unused) {
|
|
6483
|
+
finish();
|
|
6484
|
+
}
|
|
6485
|
+
});
|
|
6486
|
+
}
|
|
6487
|
+
function computePlatformInfo() {
|
|
6488
|
+
var info = parseUserAgentDeviceInfo(userAgent());
|
|
6489
|
+
var sources = _to_consumable_array(info.sources);
|
|
6490
|
+
var samsung = readSamsungProductInfo();
|
|
6491
|
+
if (samsung) {
|
|
6492
|
+
info.platform = "tizen";
|
|
6493
|
+
if (samsung.model) info.model = samsung.model;
|
|
6494
|
+
if (samsung.firmware) info.firmware = samsung.firmware;
|
|
6495
|
+
if (samsung.internalDeviceId) {
|
|
6496
|
+
info.internalDeviceId = samsung.internalDeviceId;
|
|
6497
|
+
info.internalDeviceIdSource = "samsung_duid";
|
|
6498
|
+
}
|
|
6499
|
+
sources.push("samsung_productinfo");
|
|
6500
|
+
}
|
|
6501
|
+
if (lgDeviceInfo) {
|
|
6502
|
+
info.platform = "webos";
|
|
6503
|
+
if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
|
|
6504
|
+
if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
|
|
6505
|
+
if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
|
|
6506
|
+
sources.push("lg_deviceinfo");
|
|
6507
|
+
}
|
|
6508
|
+
var lgUdid = readCachedLgUdid();
|
|
6509
|
+
if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
|
|
6510
|
+
info.internalDeviceId = lgUdid.deviceId;
|
|
6511
|
+
info.internalDeviceIdSource = "lg_udid";
|
|
6512
|
+
sources.push("lg_udid");
|
|
6513
|
+
}
|
|
6514
|
+
info.sources = sources;
|
|
6515
|
+
return info;
|
|
6516
|
+
}
|
|
6517
|
+
function categorize(platform, model) {
|
|
6518
|
+
if (platform === "tizen") return "Samsung TV";
|
|
6519
|
+
if (platform === "webos") {
|
|
6520
|
+
var ua = userAgent();
|
|
6521
|
+
if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
|
|
6522
|
+
return "LG TV";
|
|
6523
|
+
}
|
|
6524
|
+
return "Other";
|
|
6525
|
+
}
|
|
6526
|
+
function setHostDeviceInfo(info) {
|
|
6527
|
+
hostDeviceInfo = info ? _object_spread({}, info) : void 0;
|
|
6528
|
+
}
|
|
6529
|
+
function primeDeviceInfo() {
|
|
6530
|
+
var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1500;
|
|
6531
|
+
if (!primePromise) {
|
|
6532
|
+
primePromise = Promise.all([
|
|
6533
|
+
readLgDeviceInfo(timeoutMs),
|
|
6534
|
+
primeLgUdid(timeoutMs)
|
|
6535
|
+
]).catch(function() {
|
|
6536
|
+
return void 0;
|
|
6537
|
+
}).then(function() {
|
|
6538
|
+
platformCache = computePlatformInfo();
|
|
6539
|
+
return getDeviceInfo();
|
|
6540
|
+
});
|
|
6541
|
+
}
|
|
6542
|
+
return primePromise;
|
|
6543
|
+
}
|
|
6544
|
+
function getDeviceInfo() {
|
|
6545
|
+
var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
|
|
6546
|
+
var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
|
|
6547
|
+
if (primePromise && !platformCache) {} else {
|
|
6548
|
+
platformCache = platform;
|
|
6549
|
+
}
|
|
6550
|
+
var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
|
|
6551
|
+
var bridge = {
|
|
6552
|
+
terminalId: readBridge([
|
|
6553
|
+
"terminalId",
|
|
6554
|
+
"terminal_id"
|
|
6555
|
+
]),
|
|
6556
|
+
internalDeviceId: readBridge([
|
|
6557
|
+
"internalDeviceId",
|
|
6558
|
+
"internal_device_id"
|
|
6559
|
+
]),
|
|
6560
|
+
model: readBridge([
|
|
6561
|
+
"deviceModel"
|
|
6562
|
+
]),
|
|
6563
|
+
firmware: readBridge([
|
|
6564
|
+
"firmwareVersion"
|
|
6565
|
+
]),
|
|
6566
|
+
category: normalizeCategory(readBridge([
|
|
6567
|
+
"deviceCategory"
|
|
6568
|
+
]))
|
|
6569
|
+
};
|
|
6570
|
+
var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
|
|
6571
|
+
var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
|
|
6572
|
+
var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
|
|
6573
|
+
var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
|
|
6574
|
+
var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
|
|
6575
|
+
var sources = _to_consumable_array(platform.sources);
|
|
6576
|
+
var bridgeValues = [
|
|
6577
|
+
bridge.terminalId,
|
|
6578
|
+
bridge.internalDeviceId,
|
|
6579
|
+
bridge.model,
|
|
6580
|
+
bridge.firmware,
|
|
6581
|
+
bridge.category
|
|
6582
|
+
];
|
|
6583
|
+
if (bridgeValues.some(function(v) {
|
|
6584
|
+
return v !== void 0;
|
|
6585
|
+
})) sources.unshift("bridge");
|
|
6586
|
+
if (hostDeviceInfo) sources.unshift("host");
|
|
6587
|
+
var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
|
|
6588
|
+
var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
|
|
6589
|
+
var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
|
|
6590
|
+
return _object_spread_props(_object_spread({
|
|
6591
|
+
category: category,
|
|
6592
|
+
categoryCode: CATEGORY_CODES[category]
|
|
6593
|
+
}, model ? {
|
|
6594
|
+
model: model
|
|
6595
|
+
} : {}, sonifiModel ? {
|
|
6596
|
+
sonifiModel: sonifiModel
|
|
6597
|
+
} : {}, firmware ? {
|
|
6598
|
+
firmware: firmware
|
|
6599
|
+
} : {}, platform.osVersion ? {
|
|
6600
|
+
osVersion: platform.osVersion
|
|
6601
|
+
} : {}, platform.browserMajorVersion != null ? {
|
|
6602
|
+
browserMajorVersion: platform.browserMajorVersion
|
|
6603
|
+
} : {}, internalDeviceId ? {
|
|
6604
|
+
internalDeviceId: internalDeviceId
|
|
6605
|
+
} : {}, internalDeviceId && internalDeviceIdSource ? {
|
|
6606
|
+
internalDeviceIdSource: internalDeviceIdSource
|
|
6607
|
+
} : {}, terminalId ? {
|
|
6608
|
+
terminalId: terminalId
|
|
6609
|
+
} : {}), {
|
|
6610
|
+
sources: sources
|
|
6611
|
+
});
|
|
6612
|
+
}
|
|
6613
|
+
var DEVICE_KEY_VALUE_KEYS = {
|
|
6614
|
+
category: "sc_dev",
|
|
6615
|
+
model: "sc_model",
|
|
6616
|
+
firmware: "sc_fw"
|
|
6617
|
+
};
|
|
6618
|
+
function sanitizeKeyValue(value) {
|
|
6619
|
+
if (typeof value !== "string") return void 0;
|
|
6620
|
+
var v = value.trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
|
|
6621
|
+
return v ? v.slice(0, 40) : void 0;
|
|
6622
|
+
}
|
|
6623
|
+
function deviceKeyValuePairs(info) {
|
|
6624
|
+
var pairs = [
|
|
6625
|
+
[
|
|
6626
|
+
DEVICE_KEY_VALUE_KEYS.category,
|
|
6627
|
+
info.categoryCode
|
|
6628
|
+
]
|
|
6629
|
+
];
|
|
6630
|
+
var model = sanitizeKeyValue(info.model);
|
|
6631
|
+
var firmware = sanitizeKeyValue(info.firmware);
|
|
6632
|
+
if (model) pairs.push([
|
|
6633
|
+
DEVICE_KEY_VALUE_KEYS.model,
|
|
6634
|
+
model
|
|
6635
|
+
]);
|
|
6636
|
+
if (firmware) pairs.push([
|
|
6637
|
+
DEVICE_KEY_VALUE_KEYS.firmware,
|
|
6638
|
+
firmware
|
|
6639
|
+
]);
|
|
6640
|
+
return pairs;
|
|
6641
|
+
}
|
|
6642
|
+
function applyDeviceKeyValues(url, info) {
|
|
6643
|
+
try {
|
|
6644
|
+
var parsed = new URL(url);
|
|
6645
|
+
var pairs = deviceKeyValuePairs(info);
|
|
6646
|
+
var ours = new Set(pairs.map(function(param) {
|
|
6647
|
+
var _param = _sliced_to_array(param, 1), k = _param[0];
|
|
6648
|
+
return k;
|
|
6649
|
+
}));
|
|
6650
|
+
var existing = (parsed.searchParams.get("cust_params") || "").split("&").filter(function(p) {
|
|
6651
|
+
var _p_split_;
|
|
6652
|
+
return p !== "" && !ours.has((_p_split_ = p.split("=")[0]) !== null && _p_split_ !== void 0 ? _p_split_ : "");
|
|
6653
|
+
});
|
|
6654
|
+
var merged = existing.concat(pairs.map(function(param) {
|
|
6655
|
+
var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
|
|
6656
|
+
return "".concat(k, "=").concat(v);
|
|
6657
|
+
})).join("&");
|
|
6658
|
+
parsed.searchParams.set("cust_params", merged);
|
|
6659
|
+
return parsed.toString();
|
|
6660
|
+
} catch (unused) {
|
|
6661
|
+
return url;
|
|
6662
|
+
}
|
|
6663
|
+
}
|
|
6664
|
+
function deviceInfoAnalyticsFields(info) {
|
|
6665
|
+
return _object_spread({
|
|
6666
|
+
device_category: info.category
|
|
6667
|
+
}, info.model ? {
|
|
6668
|
+
device_model: info.model
|
|
6669
|
+
} : {}, info.sonifiModel ? {
|
|
6670
|
+
sonifi_model: info.sonifiModel
|
|
6671
|
+
} : {}, info.firmware ? {
|
|
6672
|
+
firmware_version: info.firmware
|
|
6673
|
+
} : {}, info.osVersion ? {
|
|
6674
|
+
os_version: info.osVersion
|
|
6675
|
+
} : {}, info.browserMajorVersion != null ? {
|
|
6676
|
+
browser_major_version: info.browserMajorVersion
|
|
6677
|
+
} : {}, info.internalDeviceId ? {
|
|
6678
|
+
internal_device_id: info.internalDeviceId
|
|
6679
|
+
} : {}, info.internalDeviceIdSource ? {
|
|
6680
|
+
internal_device_id_source: info.internalDeviceIdSource
|
|
6681
|
+
} : {}, info.terminalId ? {
|
|
6682
|
+
terminal_id: info.terminalId
|
|
6683
|
+
} : {});
|
|
6684
|
+
}
|
|
6685
|
+
// src/utils/contentMetadata.ts
|
|
6686
|
+
var MAX_CONTENT_VALUE_LENGTH = 128;
|
|
6687
|
+
var BRIDGE_KEYS = {
|
|
6688
|
+
channelName: [
|
|
6689
|
+
"channelName",
|
|
6690
|
+
"ct_ch"
|
|
6691
|
+
],
|
|
6692
|
+
programTitle: [
|
|
6693
|
+
"programTitle",
|
|
6694
|
+
"ct_ti"
|
|
6695
|
+
],
|
|
6696
|
+
contentNetwork: [
|
|
6697
|
+
"contentNetwork",
|
|
6698
|
+
"ct_ne"
|
|
6699
|
+
]
|
|
6700
|
+
};
|
|
6701
|
+
function sanitizeContentValue(value) {
|
|
6702
|
+
if (typeof value !== "string") return void 0;
|
|
6703
|
+
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
6704
|
+
if (!cleaned) return void 0;
|
|
6705
|
+
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
6706
|
+
if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
|
|
6707
|
+
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
6708
|
+
}
|
|
6709
|
+
function bridgeSources2() {
|
|
6710
|
+
if (typeof window === "undefined") return [];
|
|
6711
|
+
var w = window;
|
|
6712
|
+
return [
|
|
6713
|
+
w.__STORMCLOUD_CTV__,
|
|
6714
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
6715
|
+
w.stormcloudCtv
|
|
6716
|
+
].filter(Boolean);
|
|
6717
|
+
}
|
|
6718
|
+
function readBridgeContentValue(keys) {
|
|
6719
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6720
|
+
try {
|
|
6721
|
+
for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6722
|
+
var source = _step.value;
|
|
6723
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
6724
|
+
try {
|
|
6725
|
+
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
6726
|
+
var key = _step1.value;
|
|
6727
|
+
var value = void 0;
|
|
6728
|
+
try {
|
|
6729
|
+
value = source === null || source === void 0 ? void 0 : source[key];
|
|
6730
|
+
if (typeof value === "function") value = value.call(source);
|
|
6731
|
+
} catch (unused) {
|
|
6732
|
+
value = void 0;
|
|
6733
|
+
}
|
|
6734
|
+
var sanitized = sanitizeContentValue(value);
|
|
6735
|
+
if (sanitized) return sanitized;
|
|
6736
|
+
}
|
|
6737
|
+
} catch (err) {
|
|
6738
|
+
_didIteratorError1 = true;
|
|
6739
|
+
_iteratorError1 = err;
|
|
6740
|
+
} finally{
|
|
6741
|
+
try {
|
|
6742
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
6743
|
+
_iterator1.return();
|
|
6744
|
+
}
|
|
6745
|
+
} finally{
|
|
6746
|
+
if (_didIteratorError1) {
|
|
6747
|
+
throw _iteratorError1;
|
|
6748
|
+
}
|
|
6749
|
+
}
|
|
6750
|
+
}
|
|
6751
|
+
}
|
|
6752
|
+
} catch (err) {
|
|
6753
|
+
_didIteratorError = true;
|
|
6754
|
+
_iteratorError = err;
|
|
6755
|
+
} finally{
|
|
6756
|
+
try {
|
|
6757
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
6758
|
+
_iterator.return();
|
|
6759
|
+
}
|
|
6760
|
+
} finally{
|
|
6761
|
+
if (_didIteratorError) {
|
|
6762
|
+
throw _iteratorError;
|
|
6763
|
+
}
|
|
6764
|
+
}
|
|
6765
|
+
}
|
|
6766
|
+
return void 0;
|
|
6767
|
+
}
|
|
6768
|
+
function resolveContentMetadata(config) {
|
|
6769
|
+
var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2;
|
|
6770
|
+
var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
|
|
6771
|
+
var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
|
|
6772
|
+
var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
|
|
6773
|
+
return _object_spread({}, channelName ? {
|
|
6774
|
+
channelName: channelName
|
|
6775
|
+
} : {}, programTitle ? {
|
|
6776
|
+
programTitle: programTitle
|
|
6777
|
+
} : {}, contentNetwork ? {
|
|
6778
|
+
contentNetwork: contentNetwork
|
|
6779
|
+
} : {});
|
|
6780
|
+
}
|
|
6781
|
+
function appendMissingContentParams(url, meta) {
|
|
6782
|
+
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
6783
|
+
try {
|
|
6784
|
+
var parsed = new URL(url);
|
|
6785
|
+
var add = function add(key, value) {
|
|
6786
|
+
if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
|
|
6787
|
+
};
|
|
6788
|
+
add("ct_ch", meta.channelName);
|
|
6789
|
+
add("ct_ti", meta.programTitle);
|
|
6790
|
+
add("ct_ne", meta.contentNetwork);
|
|
6791
|
+
return parsed.toString();
|
|
6792
|
+
} catch (unused) {
|
|
6793
|
+
return url;
|
|
6794
|
+
}
|
|
6795
|
+
}
|
|
6796
|
+
// src/utils/screenActivity.ts
|
|
6797
|
+
var hostStandby = false;
|
|
6798
|
+
function setHostStandby(standby) {
|
|
6799
|
+
hostStandby = !!standby;
|
|
6800
|
+
}
|
|
6801
|
+
function toBoolean(value) {
|
|
6802
|
+
if (typeof value === "boolean") return value;
|
|
6803
|
+
if (typeof value === "number") return value === 1;
|
|
6804
|
+
if (typeof value === "string") {
|
|
6805
|
+
var v = value.trim().toLowerCase();
|
|
6806
|
+
if (v === "true" || v === "1" || v === "yes") return true;
|
|
6807
|
+
if (v === "false" || v === "0" || v === "no") return false;
|
|
6808
|
+
}
|
|
6809
|
+
return void 0;
|
|
6810
|
+
}
|
|
6811
|
+
function bridgeSaysStandby() {
|
|
6812
|
+
if (typeof window === "undefined") return false;
|
|
6813
|
+
var w = window;
|
|
6814
|
+
for(var _i = 0, _iter = [
|
|
6815
|
+
w.__STORMCLOUD_CTV__,
|
|
6816
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
6817
|
+
w.stormcloudCtv
|
|
6818
|
+
]; _i < _iter.length; _i++){
|
|
6819
|
+
var source = _iter[_i];
|
|
6820
|
+
if (!source) continue;
|
|
6821
|
+
for(var _i1 = 0, _iter1 = [
|
|
6822
|
+
"standby",
|
|
6823
|
+
"isStandby",
|
|
6824
|
+
"screenOff"
|
|
6825
|
+
]; _i1 < _iter1.length; _i1++){
|
|
6826
|
+
var key = _iter1[_i1];
|
|
6827
|
+
var value = void 0;
|
|
6828
|
+
try {
|
|
6829
|
+
value = source[key];
|
|
6830
|
+
if (typeof value === "function") value = value.call(source);
|
|
6831
|
+
} catch (unused) {
|
|
6832
|
+
value = void 0;
|
|
6833
|
+
}
|
|
6834
|
+
if (toBoolean(value) === true) return true;
|
|
6835
|
+
}
|
|
6836
|
+
}
|
|
6837
|
+
return false;
|
|
6838
|
+
}
|
|
6839
|
+
function getScreenInactiveReason() {
|
|
6840
|
+
if (hostStandby) return "host_standby";
|
|
6841
|
+
if (typeof document !== "undefined" && document.visibilityState === "hidden") {
|
|
6842
|
+
return "document_hidden";
|
|
6843
|
+
}
|
|
6844
|
+
if (bridgeSaysStandby()) return "bridge_standby";
|
|
6845
|
+
return void 0;
|
|
6846
|
+
}
|
|
6005
6847
|
// src/utils/trackingIngest.ts
|
|
6006
6848
|
var DEFAULT_TRACKING_INGEST_CONFIG = {
|
|
6007
6849
|
enabled: true,
|
|
@@ -6099,6 +6941,9 @@ function buildAnalyticsContext(config) {
|
|
|
6099
6941
|
if (config.isLiveStream !== void 0) {
|
|
6100
6942
|
context.inputStreamType = config.isLiveStream ? "live" : "vod";
|
|
6101
6943
|
}
|
|
6944
|
+
if (config.sendDeviceInfoToAnalytics) {
|
|
6945
|
+
context.includeDeviceInfo = true;
|
|
6946
|
+
}
|
|
6102
6947
|
return context;
|
|
6103
6948
|
}
|
|
6104
6949
|
function getClientInfo() {
|
|
@@ -6394,7 +7239,7 @@ function buildPlayerMetricEvent() {
|
|
|
6394
7239
|
capture_at: captureAt
|
|
6395
7240
|
}, context.inputStreamType ? {
|
|
6396
7241
|
input_stream_type: context.inputStreamType
|
|
6397
|
-
} : {})
|
|
7242
|
+
} : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
|
|
6398
7243
|
];
|
|
6399
7244
|
}
|
|
6400
7245
|
});
|
|
@@ -8422,7 +9267,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
8422
9267
|
key: "generatePodVastUrl",
|
|
8423
9268
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
8424
9269
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
8425
|
-
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest
|
|
9270
|
+
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9271
|
+
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9272
|
+
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
9273
|
+
});
|
|
9274
|
+
var content = resolveContentMetadata(this.config);
|
|
8426
9275
|
var macroContext = _object_spread_props(_object_spread({
|
|
8427
9276
|
correlator: this.viewCorrelator,
|
|
8428
9277
|
streamCorrelator: this.streamCorrelator,
|
|
@@ -8437,10 +9286,12 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
8437
9286
|
limitAdTracking: envSignals.limitAdTracking,
|
|
8438
9287
|
deviceTypeHint: envSignals.deviceTypeHint,
|
|
8439
9288
|
adTest: this.config.adTest
|
|
8440
|
-
},
|
|
8441
|
-
programTitle:
|
|
8442
|
-
} : {},
|
|
8443
|
-
channelName:
|
|
9289
|
+
}, content.programTitle ? {
|
|
9290
|
+
programTitle: content.programTitle
|
|
9291
|
+
} : {}, content.channelName ? {
|
|
9292
|
+
channelName: content.channelName
|
|
9293
|
+
} : {}, content.contentNetwork ? {
|
|
9294
|
+
contentNetwork: content.contentNetwork
|
|
8444
9295
|
} : {}), {
|
|
8445
9296
|
consent: this.consentSignals,
|
|
8446
9297
|
palNonce: palNonce.getCurrentNonce() || void 0
|
|
@@ -8458,6 +9309,24 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
8458
9309
|
} else {
|
|
8459
9310
|
finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
|
|
8460
9311
|
}
|
|
9312
|
+
finalUrl = appendMissingContentParams(finalUrl, content);
|
|
9313
|
+
if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
|
|
9314
|
+
finalUrl = applyDeviceKeyValues(finalUrl, getDeviceInfo());
|
|
9315
|
+
}
|
|
9316
|
+
if (this.debug) {
|
|
9317
|
+
var id = envSignals.deviceId;
|
|
9318
|
+
console.log("[AD-IDENTITY]", {
|
|
9319
|
+
source: envSignals.deviceIdSource,
|
|
9320
|
+
idtype: envSignals.deviceIdType,
|
|
9321
|
+
rdidTail: id ? id.slice(-4) : void 0,
|
|
9322
|
+
isLat: envSignals.limitAdTracking,
|
|
9323
|
+
dth: envSignals.deviceTypeHint,
|
|
9324
|
+
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9325
|
+
ct_ch: content.channelName,
|
|
9326
|
+
ct_ti: content.programTitle,
|
|
9327
|
+
ct_ne: content.contentNetwork
|
|
9328
|
+
});
|
|
9329
|
+
}
|
|
8461
9330
|
console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
|
|
8462
9331
|
return finalUrl;
|
|
8463
9332
|
}
|
|
@@ -8509,7 +9378,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
8509
9378
|
}
|
|
8510
9379
|
},
|
|
8511
9380
|
{
|
|
8512
|
-
// --- Tracking ---
|
|
8513
9381
|
key: "initializeTracking",
|
|
8514
9382
|
value: function initializeTracking() {
|
|
8515
9383
|
var _this = this;
|
|
@@ -8601,7 +9469,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
8601
9469
|
}
|
|
8602
9470
|
},
|
|
8603
9471
|
{
|
|
8604
|
-
// --- Ad stop timer ---
|
|
8605
9472
|
key: "scheduleAdStopCountdown",
|
|
8606
9473
|
value: function scheduleAdStopCountdown(remainingMs) {
|
|
8607
9474
|
var _this = this;
|
|
@@ -8633,7 +9500,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
8633
9500
|
}
|
|
8634
9501
|
},
|
|
8635
9502
|
{
|
|
8636
|
-
// --- Ad start timer ---
|
|
8637
9503
|
key: "scheduleAdStartIn",
|
|
8638
9504
|
value: function scheduleAdStartIn(delayMs) {
|
|
8639
9505
|
var _this = this;
|
|
@@ -8661,7 +9527,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
8661
9527
|
}
|
|
8662
9528
|
},
|
|
8663
9529
|
{
|
|
8664
|
-
// --- PTS drift ---
|
|
8665
9530
|
key: "updatePtsDrift",
|
|
8666
9531
|
value: function updatePtsDrift(ptsSecondsSample) {
|
|
8667
9532
|
var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
|
|
@@ -8687,7 +9552,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
8687
9552
|
}
|
|
8688
9553
|
},
|
|
8689
9554
|
{
|
|
8690
|
-
// --- Duration boundary ---
|
|
8691
9555
|
key: "beginBreakTiming",
|
|
8692
9556
|
value: function beginBreakTiming(startWallClockMs) {
|
|
8693
9557
|
this.currentAdBreakStartWallClockMs = startWallClockMs;
|
|
@@ -8735,7 +9599,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
8735
9599
|
}
|
|
8736
9600
|
},
|
|
8737
9601
|
{
|
|
8738
|
-
// --- Duration budget ---
|
|
8739
9602
|
key: "getWallClockRemainingAdMs",
|
|
8740
9603
|
value: function getWallClockRemainingAdMs() {
|
|
8741
9604
|
var endWallClockMs = this.getAdBreakEndWallClockMs();
|
|
@@ -8884,7 +9747,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
8884
9747
|
}
|
|
8885
9748
|
},
|
|
8886
9749
|
{
|
|
8887
|
-
// --- Circuit breaker ---
|
|
8888
9750
|
key: "isTemporaryAdError",
|
|
8889
9751
|
value: function isTemporaryAdError(error) {
|
|
8890
9752
|
var _error_message;
|
|
@@ -9018,7 +9880,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
9018
9880
|
}
|
|
9019
9881
|
},
|
|
9020
9882
|
{
|
|
9021
|
-
// --- Watchdog ---
|
|
9022
9883
|
key: "startAdRequestWatchdog",
|
|
9023
9884
|
value: function startAdRequestWatchdog(token) {
|
|
9024
9885
|
var _this = this;
|
|
@@ -9063,7 +9924,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
9063
9924
|
}
|
|
9064
9925
|
},
|
|
9065
9926
|
{
|
|
9066
|
-
// --- Failsafe ---
|
|
9067
9927
|
key: "startAdFailsafeTimer",
|
|
9068
9928
|
value: function startAdFailsafeTimer(token) {
|
|
9069
9929
|
var _this = this;
|
|
@@ -9125,7 +9985,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
9125
9985
|
}
|
|
9126
9986
|
},
|
|
9127
9987
|
{
|
|
9128
|
-
// --- Reset for ad break end ---
|
|
9129
9988
|
key: "resetForBreakEnd",
|
|
9130
9989
|
value: function resetForBreakEnd() {
|
|
9131
9990
|
this.clearAdStopTimer();
|
|
@@ -9324,7 +10183,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
9324
10183
|
adBehavior: adBehavior
|
|
9325
10184
|
});
|
|
9326
10185
|
}
|
|
9327
|
-
if (!this.config.autoplay) return [
|
|
10186
|
+
if (!(this.config.autoplay && !this.callbacks.shouldHoldContentForAds())) return [
|
|
9328
10187
|
3,
|
|
9329
10188
|
2
|
|
9330
10189
|
];
|
|
@@ -9515,6 +10374,12 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
9515
10374
|
2
|
|
9516
10375
|
];
|
|
9517
10376
|
this.hasInitialBufferCompleted = true;
|
|
10377
|
+
if (this.shouldAutoplayAfterBuffering && this.callbacks.shouldHoldContentForAds()) {
|
|
10378
|
+
this.shouldAutoplayAfterBuffering = false;
|
|
10379
|
+
if (this.debug) {
|
|
10380
|
+
console.log("[StormcloudVideoPlayer] Buffer ready during an ad break; content stays paused until the break ends");
|
|
10381
|
+
}
|
|
10382
|
+
}
|
|
9518
10383
|
if (!this.shouldAutoplayAfterBuffering) return [
|
|
9519
10384
|
3,
|
|
9520
10385
|
2
|
|
@@ -10172,9 +11037,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10172
11037
|
}
|
|
10173
11038
|
},
|
|
10174
11039
|
{
|
|
10175
|
-
// ───────────────────────────────────────────────────────────────
|
|
10176
|
-
// IMA event listeners
|
|
10177
|
-
// ───────────────────────────────────────────────────────────────
|
|
10178
11040
|
key: "nextAdRequestUrl",
|
|
10179
11041
|
value: function nextAdRequestUrl(baseVastUrl) {
|
|
10180
11042
|
return this.host.generatePodVastUrl(baseVastUrl);
|
|
@@ -10410,9 +11272,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10410
11272
|
}
|
|
10411
11273
|
},
|
|
10412
11274
|
{
|
|
10413
|
-
// ───────────────────────────────────────────────────────────────
|
|
10414
|
-
// Ad break start
|
|
10415
|
-
// ───────────────────────────────────────────────────────────────
|
|
10416
11275
|
key: "isBreakActive",
|
|
10417
11276
|
value: function isBreakActive() {
|
|
10418
11277
|
return this.slotState !== "IDLE";
|
|
@@ -10440,7 +11299,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10440
11299
|
key: "handleAdStart",
|
|
10441
11300
|
value: function handleAdStart(marker) {
|
|
10442
11301
|
return _async_to_generator(function() {
|
|
10443
|
-
var baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
|
|
11302
|
+
var screenInactiveReason, baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
|
|
10444
11303
|
return _ts_generator(this, function(_state) {
|
|
10445
11304
|
switch(_state.label){
|
|
10446
11305
|
case 0:
|
|
@@ -10453,6 +11312,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10453
11312
|
2
|
|
10454
11313
|
];
|
|
10455
11314
|
}
|
|
11315
|
+
screenInactiveReason = getScreenInactiveReason();
|
|
11316
|
+
if (screenInactiveReason) {
|
|
11317
|
+
this.logOrchestratorFunnel("break_skipped_screen_inactive", {
|
|
11318
|
+
reason: screenInactiveReason
|
|
11319
|
+
});
|
|
11320
|
+
this.clearPendingAdBreak();
|
|
11321
|
+
return [
|
|
11322
|
+
2
|
|
11323
|
+
];
|
|
11324
|
+
}
|
|
10456
11325
|
baseVastUrl = this.adConfig.apiVastTagUrl;
|
|
10457
11326
|
edgeConfigured = !!this.host.getEdgePodBaseUrl();
|
|
10458
11327
|
if (!baseVastUrl && !edgeConfigured) {
|
|
@@ -10613,12 +11482,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10613
11482
|
},
|
|
10614
11483
|
{
|
|
10615
11484
|
key: "startOptimizedPod",
|
|
10616
|
-
value:
|
|
10617
|
-
// Optimized pod (single multi-ad request)
|
|
10618
|
-
// ───────────────────────────────────────────────────────────────
|
|
10619
|
-
function startOptimizedPod(baseVastUrl) {
|
|
11485
|
+
value: function startOptimizedPod(baseVastUrl) {
|
|
10620
11486
|
return _async_to_generator(function() {
|
|
10621
|
-
var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, error;
|
|
11487
|
+
var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, _this_host_config_maxAdBreakExtensionMs, remainingMs, overrunAllowanceMs, maxAdsCap, maxAds, error;
|
|
10622
11488
|
return _ts_generator(this, function(_state) {
|
|
10623
11489
|
switch(_state.label){
|
|
10624
11490
|
case 0:
|
|
@@ -10726,6 +11592,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10726
11592
|
false
|
|
10727
11593
|
];
|
|
10728
11594
|
}
|
|
11595
|
+
if (this.isBreakTimeBounded() && adPlayer.limitPodToBudget) {
|
|
11596
|
+
;
|
|
11597
|
+
remainingMs = this.timing.getRemainingAdMs();
|
|
11598
|
+
overrunAllowanceMs = Math.max(0, (_this_host_config_maxAdBreakExtensionMs = this.host.config.maxAdBreakExtensionMs) !== null && _this_host_config_maxAdBreakExtensionMs !== void 0 ? _this_host_config_maxAdBreakExtensionMs : 0);
|
|
11599
|
+
maxAdsCap = this.adConfig.resolveAdPodConfig().maxAdsPerBreak;
|
|
11600
|
+
maxAds = maxAdsCap != null ? Math.max(1, maxAdsCap - this.timing.totalAdsInBreak) : Number.MAX_SAFE_INTEGER;
|
|
11601
|
+
if (Number.isFinite(remainingMs)) {
|
|
11602
|
+
podCount = adPlayer.limitPodToBudget(remainingMs + overrunAllowanceMs, maxAds);
|
|
11603
|
+
if (podCount < 1) {
|
|
11604
|
+
if (this.timing.activeAdRequestToken === requestToken) {
|
|
11605
|
+
this.timing.activeAdRequestToken = null;
|
|
11606
|
+
}
|
|
11607
|
+
this.recordRequestFailure(new Error("No GAM ad fits the ".concat(Math.round(remainingMs), "ms left in the break")), podUrl);
|
|
11608
|
+
return [
|
|
11609
|
+
2,
|
|
11610
|
+
false
|
|
11611
|
+
];
|
|
11612
|
+
}
|
|
11613
|
+
}
|
|
11614
|
+
}
|
|
10729
11615
|
this.setSlotState("READY", "vast_ready");
|
|
10730
11616
|
if (this.debug) {
|
|
10731
11617
|
console.log(podCount === 1 ? "[POD] Response contained a single ad; playing it and enabling pod top-up" : "[POD] Optimized pod returned ".concat(podCount, " ads; playing pod in one controller"));
|
|
@@ -10795,9 +11681,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10795
11681
|
}
|
|
10796
11682
|
},
|
|
10797
11683
|
{
|
|
10798
|
-
// ───────────────────────────────────────────────────────────────
|
|
10799
|
-
// Edge-first pods (live SCTE-35 only, GAM fallback)
|
|
10800
|
-
// ───────────────────────────────────────────────────────────────
|
|
10801
11684
|
key: "resetEdgeStateForBreak",
|
|
10802
11685
|
value: function resetEdgeStateForBreak() {
|
|
10803
11686
|
this.edgeExhaustedForBreak = false;
|
|
@@ -11015,9 +11898,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11015
11898
|
}
|
|
11016
11899
|
},
|
|
11017
11900
|
{
|
|
11018
|
-
// ───────────────────────────────────────────────────────────────
|
|
11019
|
-
// Next-ad scheduling (single flight)
|
|
11020
|
-
// ───────────────────────────────────────────────────────────────
|
|
11021
11901
|
key: "setSlotState",
|
|
11022
11902
|
value: function setSlotState(next, reason) {
|
|
11023
11903
|
if (this.slotState === next) return;
|
|
@@ -11067,6 +11947,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11067
11947
|
{
|
|
11068
11948
|
key: "getStopRequestingReason",
|
|
11069
11949
|
value: function getStopRequestingReason(remainingMs) {
|
|
11950
|
+
var screenInactiveReason = getScreenInactiveReason();
|
|
11951
|
+
if (screenInactiveReason) return "screen_inactive:".concat(screenInactiveReason);
|
|
11070
11952
|
if (this.breakSource === "vmap") {
|
|
11071
11953
|
if (this.adPodQueue.length === 0) return "vmap_queue_empty";
|
|
11072
11954
|
} else if (this.breakSource !== "scte35" || !this.followUpBaseVastUrl && !this.canRequestEdge()) {
|
|
@@ -11340,9 +12222,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11340
12222
|
}
|
|
11341
12223
|
},
|
|
11342
12224
|
{
|
|
11343
|
-
// ───────────────────────────────────────────────────────────────
|
|
11344
|
-
// Per-request diagnostics
|
|
11345
|
-
// ───────────────────────────────────────────────────────────────
|
|
11346
12225
|
key: "recordRequestDiagnostic",
|
|
11347
12226
|
value: function recordRequestDiagnostic(payload) {
|
|
11348
12227
|
var requestId = payload.requestId;
|
|
@@ -11416,9 +12295,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11416
12295
|
}
|
|
11417
12296
|
},
|
|
11418
12297
|
{
|
|
11419
|
-
// ───────────────────────────────────────────────────────────────
|
|
11420
|
-
// Single ad playback
|
|
11421
|
-
// ───────────────────────────────────────────────────────────────
|
|
11422
12298
|
key: "createGamDispatchFinalizer",
|
|
11423
12299
|
value: function createGamDispatchFinalizer(requestToken) {
|
|
11424
12300
|
var _this = this;
|
|
@@ -11881,9 +12757,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11881
12757
|
}
|
|
11882
12758
|
},
|
|
11883
12759
|
{
|
|
11884
|
-
// ───────────────────────────────────────────────────────────────
|
|
11885
|
-
// Ad break completion
|
|
11886
|
-
// ───────────────────────────────────────────────────────────────
|
|
11887
12760
|
key: "logBreakFunnel",
|
|
11888
12761
|
value: function logBreakFunnel(endReason) {
|
|
11889
12762
|
var funnel = this.breakFunnel;
|
|
@@ -12529,6 +13402,8 @@ var ContentHealthWatchdog = /*#__PURE__*/ function() {
|
|
|
12529
13402
|
return ContentHealthWatchdog;
|
|
12530
13403
|
}();
|
|
12531
13404
|
// src/player/StormcloudVideoPlayer.ts
|
|
13405
|
+
var DEFAULT_PAL_NONCE_MAX_AGE_MS = 5.5 * 60 * 60 * 1e3;
|
|
13406
|
+
var PAL_NONCE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
12532
13407
|
var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
12533
13408
|
function StormcloudVideoPlayer(config) {
|
|
12534
13409
|
var _this = this;
|
|
@@ -12539,6 +13414,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
12539
13414
|
var browserOverrides = getBrowserConfigOverrides();
|
|
12540
13415
|
this.config = _object_spread({}, browserOverrides, config);
|
|
12541
13416
|
this.video = config.videoElement;
|
|
13417
|
+
if (this.config.forceSingleDecoderMode != null) {
|
|
13418
|
+
setSingleDecoderOverride(this.config.forceSingleDecoderMode);
|
|
13419
|
+
}
|
|
13420
|
+
if (this.config.adDeviceId) {
|
|
13421
|
+
setHostAdIdentity({
|
|
13422
|
+
deviceId: this.config.adDeviceId,
|
|
13423
|
+
deviceIdType: this.config.adDeviceIdType,
|
|
13424
|
+
limitAdTracking: this.config.adLimitAdTracking
|
|
13425
|
+
});
|
|
13426
|
+
}
|
|
13427
|
+
if (this.config.deviceInfo) {
|
|
13428
|
+
setHostDeviceInfo(this.config.deviceInfo);
|
|
13429
|
+
}
|
|
12542
13430
|
logBrowserInfo(config.debugAdTiming);
|
|
12543
13431
|
this.floorLadder = new FloorLadderController();
|
|
12544
13432
|
this.adPlayer = this.createAdPlayer(false);
|
|
@@ -12602,6 +13490,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
12602
13490
|
},
|
|
12603
13491
|
hasPendingAdBreak: function hasPendingAdBreak() {
|
|
12604
13492
|
return _this.adBreak.pendingAdBreak !== null;
|
|
13493
|
+
},
|
|
13494
|
+
shouldHoldContentForAds: function shouldHoldContentForAds() {
|
|
13495
|
+
return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
|
|
12605
13496
|
}
|
|
12606
13497
|
});
|
|
12607
13498
|
this.adBreak = new AdBreakOrchestrator({
|
|
@@ -12797,10 +13688,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
12797
13688
|
},
|
|
12798
13689
|
{
|
|
12799
13690
|
key: "load",
|
|
12800
|
-
value:
|
|
12801
|
-
// Lifecycle
|
|
12802
|
-
// ───────────────────────────────────────────────────────────────
|
|
12803
|
-
function load() {
|
|
13691
|
+
value: function load() {
|
|
12804
13692
|
return _async_to_generator(function() {
|
|
12805
13693
|
var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
|
|
12806
13694
|
return _ts_generator(this, function(_state) {
|
|
@@ -12810,6 +13698,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
12810
13698
|
if (!this.attached) {
|
|
12811
13699
|
this.attach();
|
|
12812
13700
|
}
|
|
13701
|
+
primeDeviceInfo().then(function(info) {
|
|
13702
|
+
if (_this.debug) {
|
|
13703
|
+
console.log("[DEVICE-INFO]", _object_spread_props(_object_spread({}, info), {
|
|
13704
|
+
internalDeviceId: info.internalDeviceId ? "...".concat(info.internalDeviceId.slice(-4)) : void 0
|
|
13705
|
+
}));
|
|
13706
|
+
}
|
|
13707
|
+
}).catch(function() {});
|
|
12813
13708
|
_state.label = 1;
|
|
12814
13709
|
case 1:
|
|
12815
13710
|
_state.trys.push([
|
|
@@ -12844,21 +13739,30 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
12844
13739
|
fetchConsentSignals().catch(function() {
|
|
12845
13740
|
return {};
|
|
12846
13741
|
}).then(function(signals) {
|
|
12847
|
-
var _this_config_lowLatencyMode;
|
|
13742
|
+
var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
|
|
12848
13743
|
_this.adConfig.consentSignals = signals;
|
|
12849
13744
|
var muted = _this.video.muted;
|
|
12850
|
-
|
|
13745
|
+
var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
|
|
13746
|
+
var palOptions = _object_spread({
|
|
12851
13747
|
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
12852
13748
|
videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
|
|
12853
13749
|
adWillAutoPlay: !!_this.config.autoplay,
|
|
12854
13750
|
adWillPlayMuted: muted,
|
|
12855
13751
|
playerVolume: muted ? 0 : _this.video.volume,
|
|
12856
|
-
continuousPlayback: (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
|
|
13752
|
+
continuousPlayback: (_this_config_palContinuousPlayback = _this.config.palContinuousPlayback) !== null && _this_config_palContinuousPlayback !== void 0 ? _this_config_palContinuousPlayback : _this.config.ctvAdRequest ? true : (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false,
|
|
13753
|
+
iconsSupported: (_this_config_palIconsSupported = _this.config.palIconsSupported) !== null && _this_config_palIconsSupported !== void 0 ? _this_config_palIconsSupported : false,
|
|
13754
|
+
supportedApiFrameworks: (_this_config_palSupportedApiFrameworks = _this.config.palSupportedApiFrameworks) !== null && _this_config_palSupportedApiFrameworks !== void 0 ? _this_config_palSupportedApiFrameworks : ""
|
|
12857
13755
|
}, palDescriptionUrl ? {
|
|
12858
13756
|
descriptionUrl: palDescriptionUrl
|
|
12859
13757
|
} : {}, signals.storageAllowed != null ? {
|
|
12860
13758
|
allowStorage: signals.storageAllowed
|
|
12861
|
-
} : {}
|
|
13759
|
+
} : {}, palSessionId ? {
|
|
13760
|
+
sessionId: palSessionId
|
|
13761
|
+
} : {});
|
|
13762
|
+
_this.lastPalOptions = palOptions;
|
|
13763
|
+
_this.palSessionId = palSessionId;
|
|
13764
|
+
_this.startPalNonceRefresh();
|
|
13765
|
+
return _this.palNonce.generateNonce(palOptions);
|
|
12862
13766
|
}).catch(function() {});
|
|
12863
13767
|
this.adConfig.initializeTracking();
|
|
12864
13768
|
if (!this.hlsEngine.shouldUseNativeHls(function() {
|
|
@@ -12896,6 +13800,92 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
12896
13800
|
}).call(this);
|
|
12897
13801
|
}
|
|
12898
13802
|
},
|
|
13803
|
+
{
|
|
13804
|
+
key: "startPalNonceRefresh",
|
|
13805
|
+
value: function startPalNonceRefresh() {
|
|
13806
|
+
var _this = this;
|
|
13807
|
+
if (this.palRefreshTimer != null || typeof window === "undefined") return;
|
|
13808
|
+
this.palRefreshTimer = window.setInterval(function() {
|
|
13809
|
+
return _this.refreshPalNonceIfStale();
|
|
13810
|
+
}, PAL_NONCE_CHECK_INTERVAL_MS);
|
|
13811
|
+
}
|
|
13812
|
+
},
|
|
13813
|
+
{
|
|
13814
|
+
key: "refreshPalNonceIfStale",
|
|
13815
|
+
value: function refreshPalNonceIfStale() {
|
|
13816
|
+
var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
13817
|
+
var _this_config_palNonceMaxAgeMs;
|
|
13818
|
+
var options = this.lastPalOptions;
|
|
13819
|
+
if (!options) return;
|
|
13820
|
+
var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
|
|
13821
|
+
var ageMs = this.palNonce.getNonceAgeMs();
|
|
13822
|
+
var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
|
|
13823
|
+
var sessionChanged = sessionId !== this.palSessionId;
|
|
13824
|
+
var stale = ageMs === void 0 || ageMs >= maxAgeMs;
|
|
13825
|
+
if (!force && !stale && !sessionChanged) return;
|
|
13826
|
+
var next = _object_spread({}, options);
|
|
13827
|
+
if (sessionId) next.sessionId = sessionId;
|
|
13828
|
+
else delete next.sessionId;
|
|
13829
|
+
this.lastPalOptions = next;
|
|
13830
|
+
this.palSessionId = sessionId;
|
|
13831
|
+
if (this.debug) {
|
|
13832
|
+
console.log("[PAL] Regenerating nonce", {
|
|
13833
|
+
force: force,
|
|
13834
|
+
stale: stale,
|
|
13835
|
+
sessionChanged: sessionChanged,
|
|
13836
|
+
ageMs: ageMs
|
|
13837
|
+
});
|
|
13838
|
+
}
|
|
13839
|
+
this.palNonce.generateNonce(next).catch(function() {});
|
|
13840
|
+
}
|
|
13841
|
+
},
|
|
13842
|
+
{
|
|
13843
|
+
key: "setAdIdentity",
|
|
13844
|
+
value: function setAdIdentity(identity) {
|
|
13845
|
+
setHostAdIdentity(identity);
|
|
13846
|
+
this.refreshPalNonceIfStale();
|
|
13847
|
+
}
|
|
13848
|
+
},
|
|
13849
|
+
{
|
|
13850
|
+
key: "resetAdIdentity",
|
|
13851
|
+
value: function resetAdIdentity1() {
|
|
13852
|
+
resetAdIdentity();
|
|
13853
|
+
this.refreshPalNonceIfStale(true);
|
|
13854
|
+
}
|
|
13855
|
+
},
|
|
13856
|
+
{
|
|
13857
|
+
key: "setContentMetadata",
|
|
13858
|
+
value: function setContentMetadata(meta) {
|
|
13859
|
+
var _this = this;
|
|
13860
|
+
var apply = function apply(key, value) {
|
|
13861
|
+
if (value === void 0) return;
|
|
13862
|
+
var clean = value === null ? void 0 : sanitizeContentValue(value);
|
|
13863
|
+
if (clean) _this.config[key] = clean;
|
|
13864
|
+
else delete _this.config[key];
|
|
13865
|
+
};
|
|
13866
|
+
apply("channelName", meta.channelName);
|
|
13867
|
+
apply("programTitle", meta.programTitle);
|
|
13868
|
+
apply("contentNetwork", meta.contentNetwork);
|
|
13869
|
+
}
|
|
13870
|
+
},
|
|
13871
|
+
{
|
|
13872
|
+
key: "setScreenStandby",
|
|
13873
|
+
value: function setScreenStandby(standby) {
|
|
13874
|
+
setHostStandby(standby);
|
|
13875
|
+
}
|
|
13876
|
+
},
|
|
13877
|
+
{
|
|
13878
|
+
key: "getDeviceInfo",
|
|
13879
|
+
value: function getDeviceInfo1() {
|
|
13880
|
+
return getDeviceInfo();
|
|
13881
|
+
}
|
|
13882
|
+
},
|
|
13883
|
+
{
|
|
13884
|
+
key: "setDeviceInfo",
|
|
13885
|
+
value: function setDeviceInfo(info) {
|
|
13886
|
+
setHostDeviceInfo(info);
|
|
13887
|
+
}
|
|
13888
|
+
},
|
|
12899
13889
|
{
|
|
12900
13890
|
key: "onManifestParsed",
|
|
12901
13891
|
value: function onManifestParsed(isLive) {
|
|
@@ -13030,9 +14020,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13030
14020
|
}
|
|
13031
14021
|
},
|
|
13032
14022
|
{
|
|
13033
|
-
// ───────────────────────────────────────────────────────────────
|
|
13034
|
-
// SCTE-35 marker orchestration
|
|
13035
|
-
// ───────────────────────────────────────────────────────────────
|
|
13036
14023
|
key: "onScte35Marker",
|
|
13037
14024
|
value: function onScte35Marker(marker, cueKey) {
|
|
13038
14025
|
if (this.debug) {
|
|
@@ -13211,9 +14198,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13211
14198
|
}
|
|
13212
14199
|
},
|
|
13213
14200
|
{
|
|
13214
|
-
// ───────────────────────────────────────────────────────────────
|
|
13215
|
-
// Ad prefetch
|
|
13216
|
-
// ───────────────────────────────────────────────────────────────
|
|
13217
14201
|
key: "startAdPrefetch",
|
|
13218
14202
|
value: function startAdPrefetch(marker, fragmentSn, cueKey) {
|
|
13219
14203
|
if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
|
|
@@ -13252,9 +14236,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13252
14236
|
}
|
|
13253
14237
|
},
|
|
13254
14238
|
{
|
|
13255
|
-
// ───────────────────────────────────────────────────────────────
|
|
13256
|
-
// VMAP time-based ad breaks
|
|
13257
|
-
// ───────────────────────────────────────────────────────────────
|
|
13258
14239
|
key: "onTimeUpdate",
|
|
13259
14240
|
value: function onTimeUpdate(currentTimeSec) {
|
|
13260
14241
|
var _this = this;
|
|
@@ -13368,9 +14349,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13368
14349
|
}
|
|
13369
14350
|
},
|
|
13370
14351
|
{
|
|
13371
|
-
// ───────────────────────────────────────────────────────────────
|
|
13372
|
-
// Public API
|
|
13373
|
-
// ───────────────────────────────────────────────────────────────
|
|
13374
14352
|
key: "getCurrentAdIndex",
|
|
13375
14353
|
value: function getCurrentAdIndex() {
|
|
13376
14354
|
return this.timing.currentAdIndex;
|
|
@@ -13489,12 +14467,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13489
14467
|
}
|
|
13490
14468
|
},
|
|
13491
14469
|
{
|
|
13492
|
-
// ───────────────────────────────────────────────────────────────
|
|
13493
|
-
// Destroy
|
|
13494
|
-
// ───────────────────────────────────────────────────────────────
|
|
13495
14470
|
key: "destroy",
|
|
13496
14471
|
value: function destroy() {
|
|
13497
14472
|
var _this_adPlayer;
|
|
14473
|
+
if (this.palRefreshTimer != null) {
|
|
14474
|
+
clearInterval(this.palRefreshTimer);
|
|
14475
|
+
this.palRefreshTimer = void 0;
|
|
14476
|
+
}
|
|
13498
14477
|
this.contentWatchdog.stop();
|
|
13499
14478
|
this.adBreak.cancelScheduledRequest();
|
|
13500
14479
|
this.timing.destroy();
|
|
@@ -13602,7 +14581,7 @@ var CRITICAL_PROPS = [
|
|
|
13602
14581
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
13603
14582
|
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
13604
14583
|
var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
13605
|
-
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, isLiveStream = props.isLiveStream, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastTagUrl = props.vastTagUrl, isVmap = props.isVmap, vmapUrl = props.vmapUrl, minSegmentsBeforePlay = props.minSegmentsBeforePlay, ctvAdRequest = props.ctvAdRequest, programTitle = props.programTitle, channelName = props.channelName, contentNetwork = props.contentNetwork, minRemainingMsToStartAd = props.minRemainingMsToStartAd, minRemainingMsToRequestAd = props.minRemainingMsToRequestAd, maxNoFillsPerBreak = props.maxNoFillsPerBreak, maxAdBreakExtensionMs = props.maxAdBreakExtensionMs, restVideoAttrs = _object_without_properties(props, [
|
|
14584
|
+
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, isLiveStream = props.isLiveStream, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastTagUrl = props.vastTagUrl, isVmap = props.isVmap, vmapUrl = props.vmapUrl, minSegmentsBeforePlay = props.minSegmentsBeforePlay, ctvAdRequest = props.ctvAdRequest, programTitle = props.programTitle, channelName = props.channelName, contentNetwork = props.contentNetwork, minRemainingMsToStartAd = props.minRemainingMsToStartAd, minRemainingMsToRequestAd = props.minRemainingMsToRequestAd, maxNoFillsPerBreak = props.maxNoFillsPerBreak, maxAdBreakExtensionMs = props.maxAdBreakExtensionMs, adDeviceId = props.adDeviceId, adDeviceIdType = props.adDeviceIdType, adLimitAdTracking = props.adLimitAdTracking, fallbackDeviceIdMaxAgeMs = props.fallbackDeviceIdMaxAgeMs, sessionIdMaxAgeMs = props.sessionIdMaxAgeMs, palIconsSupported = props.palIconsSupported, palSupportedApiFrameworks = props.palSupportedApiFrameworks, palContinuousPlayback = props.palContinuousPlayback, palNonceMaxAgeMs = props.palNonceMaxAgeMs, forceSingleDecoderMode = props.forceSingleDecoderMode, deviceInfo = props.deviceInfo, sendDeviceKeyValues = props.sendDeviceKeyValues, sendDeviceInfoToAnalytics = props.sendDeviceInfoToAnalytics, restVideoAttrs = _object_without_properties(props, [
|
|
13606
14585
|
"src",
|
|
13607
14586
|
"autoplay",
|
|
13608
14587
|
"muted",
|
|
@@ -13639,7 +14618,20 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
13639
14618
|
"minRemainingMsToStartAd",
|
|
13640
14619
|
"minRemainingMsToRequestAd",
|
|
13641
14620
|
"maxNoFillsPerBreak",
|
|
13642
|
-
"maxAdBreakExtensionMs"
|
|
14621
|
+
"maxAdBreakExtensionMs",
|
|
14622
|
+
"adDeviceId",
|
|
14623
|
+
"adDeviceIdType",
|
|
14624
|
+
"adLimitAdTracking",
|
|
14625
|
+
"fallbackDeviceIdMaxAgeMs",
|
|
14626
|
+
"sessionIdMaxAgeMs",
|
|
14627
|
+
"palIconsSupported",
|
|
14628
|
+
"palSupportedApiFrameworks",
|
|
14629
|
+
"palContinuousPlayback",
|
|
14630
|
+
"palNonceMaxAgeMs",
|
|
14631
|
+
"forceSingleDecoderMode",
|
|
14632
|
+
"deviceInfo",
|
|
14633
|
+
"sendDeviceKeyValues",
|
|
14634
|
+
"sendDeviceInfoToAnalytics"
|
|
13643
14635
|
]);
|
|
13644
14636
|
var videoRef = (0, import_react.useRef)(null);
|
|
13645
14637
|
var playerRef = (0, import_react.useRef)(null);
|
|
@@ -13835,6 +14827,19 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
13835
14827
|
if (minRemainingMsToRequestAd !== void 0) cfg.minRemainingMsToRequestAd = minRemainingMsToRequestAd;
|
|
13836
14828
|
if (maxNoFillsPerBreak !== void 0) cfg.maxNoFillsPerBreak = maxNoFillsPerBreak;
|
|
13837
14829
|
if (maxAdBreakExtensionMs !== void 0) cfg.maxAdBreakExtensionMs = maxAdBreakExtensionMs;
|
|
14830
|
+
if (adDeviceId !== void 0) cfg.adDeviceId = adDeviceId;
|
|
14831
|
+
if (adDeviceIdType !== void 0) cfg.adDeviceIdType = adDeviceIdType;
|
|
14832
|
+
if (adLimitAdTracking !== void 0) cfg.adLimitAdTracking = adLimitAdTracking;
|
|
14833
|
+
if (fallbackDeviceIdMaxAgeMs !== void 0) cfg.fallbackDeviceIdMaxAgeMs = fallbackDeviceIdMaxAgeMs;
|
|
14834
|
+
if (sessionIdMaxAgeMs !== void 0) cfg.sessionIdMaxAgeMs = sessionIdMaxAgeMs;
|
|
14835
|
+
if (palIconsSupported !== void 0) cfg.palIconsSupported = palIconsSupported;
|
|
14836
|
+
if (palSupportedApiFrameworks !== void 0) cfg.palSupportedApiFrameworks = palSupportedApiFrameworks;
|
|
14837
|
+
if (palContinuousPlayback !== void 0) cfg.palContinuousPlayback = palContinuousPlayback;
|
|
14838
|
+
if (palNonceMaxAgeMs !== void 0) cfg.palNonceMaxAgeMs = palNonceMaxAgeMs;
|
|
14839
|
+
if (forceSingleDecoderMode !== void 0) cfg.forceSingleDecoderMode = forceSingleDecoderMode;
|
|
14840
|
+
if (deviceInfo !== void 0) cfg.deviceInfo = deviceInfo;
|
|
14841
|
+
if (sendDeviceKeyValues !== void 0) cfg.sendDeviceKeyValues = sendDeviceKeyValues;
|
|
14842
|
+
if (sendDeviceInfoToAnalytics !== void 0) cfg.sendDeviceInfoToAnalytics = sendDeviceInfoToAnalytics;
|
|
13838
14843
|
var player = new StormcloudVideoPlayer(cfg);
|
|
13839
14844
|
playerRef.current = player;
|
|
13840
14845
|
player.load().then(function() {
|
|
@@ -13874,6 +14879,41 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
13874
14879
|
autoplay,
|
|
13875
14880
|
muted
|
|
13876
14881
|
]);
|
|
14882
|
+
(0, import_react.useEffect)(function() {
|
|
14883
|
+
var _playerRef_current;
|
|
14884
|
+
(_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.setContentMetadata({
|
|
14885
|
+
channelName: channelName !== null && channelName !== void 0 ? channelName : null,
|
|
14886
|
+
programTitle: programTitle !== null && programTitle !== void 0 ? programTitle : null,
|
|
14887
|
+
contentNetwork: contentNetwork !== null && contentNetwork !== void 0 ? contentNetwork : null
|
|
14888
|
+
});
|
|
14889
|
+
}, [
|
|
14890
|
+
channelName,
|
|
14891
|
+
programTitle,
|
|
14892
|
+
contentNetwork
|
|
14893
|
+
]);
|
|
14894
|
+
var lastAdDeviceIdRef = (0, import_react.useRef)(void 0);
|
|
14895
|
+
(0, import_react.useEffect)(function() {
|
|
14896
|
+
var player = playerRef.current;
|
|
14897
|
+
if (!player) return;
|
|
14898
|
+
if (adDeviceId === void 0 && lastAdDeviceIdRef.current === void 0) return;
|
|
14899
|
+
lastAdDeviceIdRef.current = adDeviceId;
|
|
14900
|
+
player.setAdIdentity(adDeviceId ? {
|
|
14901
|
+
deviceId: adDeviceId,
|
|
14902
|
+
deviceIdType: adDeviceIdType,
|
|
14903
|
+
limitAdTracking: adLimitAdTracking
|
|
14904
|
+
} : null);
|
|
14905
|
+
}, [
|
|
14906
|
+
adDeviceId,
|
|
14907
|
+
adDeviceIdType,
|
|
14908
|
+
adLimitAdTracking
|
|
14909
|
+
]);
|
|
14910
|
+
var deviceInfoKey = deviceInfo ? JSON.stringify(deviceInfo) : "";
|
|
14911
|
+
(0, import_react.useEffect)(function() {
|
|
14912
|
+
if (!playerRef.current || !deviceInfoKey) return;
|
|
14913
|
+
playerRef.current.setDeviceInfo(JSON.parse(deviceInfoKey));
|
|
14914
|
+
}, [
|
|
14915
|
+
deviceInfoKey
|
|
14916
|
+
]);
|
|
13877
14917
|
(0, import_react.useEffect)(function() {
|
|
13878
14918
|
if (!playerRef.current) return;
|
|
13879
14919
|
var checkAdStatus = function checkAdStatus() {
|