stormcloud-video-player 0.8.78 → 0.8.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/stormcloud-vp.min.js +2 -2
  2. package/lib/Player.cjs +6 -0
  3. package/lib/Player.cjs.map +1 -1
  4. package/lib/Player.d.cts +2 -0
  5. package/lib/StormcloudPlayer.cjs +1143 -160
  6. package/lib/StormcloudPlayer.cjs.map +1 -1
  7. package/lib/StormcloudPlayer.d.cts +2 -0
  8. package/lib/index.cjs +1206 -162
  9. package/lib/index.cjs.map +1 -1
  10. package/lib/index.d.cts +2 -0
  11. package/lib/index.d.ts +64 -2
  12. package/lib/index.js +1206 -162
  13. package/lib/index.js.map +1 -1
  14. package/lib/player/AdBreakOrchestrator.cjs +424 -84
  15. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  16. package/lib/player/AdConfigManager.cjs +738 -94
  17. package/lib/player/AdConfigManager.cjs.map +1 -1
  18. package/lib/player/AdTimingService.cjs +0 -9
  19. package/lib/player/AdTimingService.cjs.map +1 -1
  20. package/lib/player/FloorLadder.cjs +3 -0
  21. package/lib/player/FloorLadder.cjs.map +1 -1
  22. package/lib/player/HlsEngine.cjs +7 -1
  23. package/lib/player/HlsEngine.cjs.map +1 -1
  24. package/lib/player/HlsEngine.d.cts +1 -0
  25. package/lib/player/OptimizedPodRequest.cjs +4 -1
  26. package/lib/player/OptimizedPodRequest.cjs.map +1 -1
  27. package/lib/player/OptimizedPodRequest.d.cts +1 -1
  28. package/lib/player/StormcloudVideoPlayer.cjs +1143 -160
  29. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  30. package/lib/player/StormcloudVideoPlayer.d.cts +18 -1
  31. package/lib/players/HlsPlayer.cjs +1143 -160
  32. package/lib/players/HlsPlayer.cjs.map +1 -1
  33. package/lib/players/index.cjs +1143 -160
  34. package/lib/players/index.cjs.map +1 -1
  35. package/lib/props.cjs +6 -0
  36. package/lib/props.cjs.map +1 -1
  37. package/lib/props.d.cts +2 -0
  38. package/lib/sdk/hlsAdPlayer.cjs +32 -3
  39. package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
  40. package/lib/sdk/pal.cjs +10 -3
  41. package/lib/sdk/pal.cjs.map +1 -1
  42. package/lib/sdk/pal.d.cts +3 -0
  43. package/lib/types.d.cts +24 -1
  44. package/lib/ui/StormcloudVideoPlayer.cjs +1206 -162
  45. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  46. package/lib/ui/StormcloudVideoPlayer.d.cts +2 -0
  47. package/lib/utils/__tests__/adSignals.test.cjs +25662 -0
  48. package/lib/utils/__tests__/adSignals.test.cjs.map +1 -0
  49. package/lib/utils/__tests__/adSignals.test.d.cts +2 -0
  50. package/lib/utils/adIdentity.cjs +421 -0
  51. package/lib/utils/adIdentity.cjs.map +1 -0
  52. package/lib/utils/adIdentity.d.cts +30 -0
  53. package/lib/utils/browserCompat.cjs +13 -0
  54. package/lib/utils/browserCompat.cjs.map +1 -1
  55. package/lib/utils/browserCompat.d.cts +2 -1
  56. package/lib/utils/contentMetadata.cjs +208 -0
  57. package/lib/utils/contentMetadata.cjs.map +1 -0
  58. package/lib/utils/contentMetadata.d.cts +15 -0
  59. package/lib/utils/ctvVastSignals.cjs +250 -181
  60. package/lib/utils/ctvVastSignals.cjs.map +1 -1
  61. package/lib/utils/deviceInfo.cjs +678 -0
  62. package/lib/utils/deviceInfo.cjs.map +1 -0
  63. package/lib/utils/deviceInfo.d.cts +43 -0
  64. package/lib/utils/screenActivity.cjs +125 -0
  65. package/lib/utils/screenActivity.cjs.map +1 -0
  66. package/lib/utils/screenActivity.d.cts +5 -0
  67. package/lib/utils/tracking.cjs +391 -57
  68. package/lib/utils/tracking.cjs.map +1 -1
  69. package/lib/utils/tracking.d.cts +1 -1
  70. package/lib/utils/vastEnvironmentSignals.cjs +255 -85
  71. package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
  72. package/lib/utils/vastEnvironmentSignals.d.cts +8 -2
  73. package/lib/utils/vastMacros.cjs +7 -0
  74. package/lib/utils/vastMacros.cjs.map +1 -1
  75. package/lib/utils/vastMacros.d.cts +1 -0
  76. package/package.json +1 -1
@@ -412,8 +412,264 @@ __export(StormcloudPlayer_exports, {
412
412
  });
413
413
  module.exports = __toCommonJS(StormcloudPlayer_exports);
414
414
  var import_react5 = __toESM(require("react"), 1);
415
+ // src/utils/adIdentity.ts
416
+ var GOOGLE_ID_TYPES = [
417
+ "aaid",
418
+ "adid",
419
+ "afai",
420
+ "idfa",
421
+ "lgudid",
422
+ "msai",
423
+ "rida",
424
+ "tifa",
425
+ "tvOS",
426
+ "vaid",
427
+ "vida",
428
+ "dpid"
429
+ ];
430
+ var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
431
+ var DEFAULT_SESSION_ID_MAX_AGE_MS = MAX_SESSION_ID_AGE_MS;
432
+ var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
433
+ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
434
+ var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
435
+ var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
436
+ var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
437
+ var ZEROED_IDS = /* @__PURE__ */ new Set([
438
+ "00000000-0000-0000-0000-000000000000",
439
+ "38400000-8cf0-11bd-b23e-10b96e40000d"
440
+ ]);
441
+ var hostIdentity;
442
+ var memoryStore = {};
443
+ var lgUdidResult;
444
+ var lgUdidPromise;
445
+ var legacyCleared = false;
446
+ function isUsableAdId(value) {
447
+ if (typeof value !== "string") return false;
448
+ var t = value.trim();
449
+ if (!t) return false;
450
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
451
+ if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
452
+ return !ZEROED_IDS.has(t.toLowerCase());
453
+ }
454
+ function isZeroedAdId(value) {
455
+ return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
456
+ }
457
+ function normalizeIdType(value) {
458
+ if (typeof value !== "string") return void 0;
459
+ var lower = value.trim().toLowerCase();
460
+ if (!lower) return void 0;
461
+ var match = GOOGLE_ID_TYPES.find(function(t) {
462
+ return t.toLowerCase() === lower;
463
+ });
464
+ return match !== null && match !== void 0 ? match : "dpid";
465
+ }
466
+ function createUuid() {
467
+ var _bytes_, _bytes_1, _bytes_i;
468
+ var c = typeof crypto !== "undefined" ? crypto : void 0;
469
+ if (c && typeof c.randomUUID === "function") return c.randomUUID();
470
+ var bytes = new Uint8Array(16);
471
+ if (c && typeof c.getRandomValues === "function") {
472
+ c.getRandomValues(bytes);
473
+ } else {
474
+ for(var i = 0; i < 16; i++)bytes[i] = Math.floor(Math.random() * 256);
475
+ }
476
+ bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
477
+ bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
478
+ var hex = "";
479
+ 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");
480
+ 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));
481
+ }
482
+ function readStored(key) {
483
+ try {
484
+ var _window_localStorage;
485
+ var raw = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
486
+ if (raw) {
487
+ var parsed = JSON.parse(raw);
488
+ if (parsed && typeof parsed.id === "string" && typeof parsed.createdAt === "number" && isFinite(parsed.createdAt)) {
489
+ return {
490
+ id: parsed.id,
491
+ createdAt: parsed.createdAt
492
+ };
493
+ }
494
+ }
495
+ } catch (unused) {}
496
+ return memoryStore[key];
497
+ }
498
+ function writeStored(key, value) {
499
+ memoryStore[key] = value;
500
+ try {
501
+ if (typeof window !== "undefined") {
502
+ var _window_localStorage;
503
+ (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(key, JSON.stringify(value));
504
+ }
505
+ } catch (unused) {}
506
+ }
507
+ function removeStored(key) {
508
+ delete memoryStore[key];
509
+ try {
510
+ var _window_localStorage;
511
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(key);
512
+ } catch (unused) {}
513
+ }
514
+ function clearLegacyIdsOnce() {
515
+ if (legacyCleared) return;
516
+ legacyCleared = true;
517
+ try {
518
+ var _window_localStorage;
519
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(LEGACY_SESSION_KEY);
520
+ } catch (unused) {}
521
+ try {
522
+ if (typeof document !== "undefined") {
523
+ document.cookie = "".concat(encodeURIComponent(LEGACY_SESSION_KEY), "=;path=/;max-age=0;SameSite=Lax");
524
+ }
525
+ } catch (unused) {}
526
+ }
527
+ function clampAge(value, fallback, max) {
528
+ var v = typeof value === "number" && isFinite(value) && value > 0 ? value : fallback;
529
+ if (max != null) v = Math.min(v, max);
530
+ return v;
531
+ }
532
+ function setHostAdIdentity(identity) {
533
+ var _normalizeIdType;
534
+ if (!identity || !isUsableAdId(identity.deviceId)) {
535
+ hostIdentity = void 0;
536
+ return;
537
+ }
538
+ var deviceId = identity.deviceId.trim();
539
+ var changed = !hostIdentity || hostIdentity.deviceId !== deviceId;
540
+ hostIdentity = _object_spread({
541
+ deviceId: deviceId,
542
+ deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
543
+ }, typeof identity.limitAdTracking === "boolean" ? {
544
+ limitAdTracking: identity.limitAdTracking
545
+ } : {});
546
+ if (changed) {
547
+ removeStored(SESSION_ID_KEY);
548
+ removeStored(FALLBACK_DEVICE_ID_KEY);
549
+ }
550
+ }
551
+ function getHostAdIdentity() {
552
+ return hostIdentity ? _object_spread({}, hostIdentity) : void 0;
553
+ }
554
+ function resetAdIdentity() {
555
+ removeStored(SESSION_ID_KEY);
556
+ removeStored(FALLBACK_DEVICE_ID_KEY);
557
+ }
558
+ function readSamsungTifa() {
559
+ try {
560
+ var _window_webapis;
561
+ var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
562
+ if (!adinfo) return void 0;
563
+ var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
564
+ var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
565
+ if (isZeroedAdId(tifa)) return {
566
+ deviceIdType: "tifa",
567
+ limitAdTracking: true
568
+ };
569
+ if (!isUsableAdId(tifa)) return void 0;
570
+ return _object_spread({
571
+ deviceId: tifa.trim(),
572
+ deviceIdType: "tifa"
573
+ }, typeof lat === "boolean" ? {
574
+ limitAdTracking: lat
575
+ } : {});
576
+ } catch (unused) {
577
+ return void 0;
578
+ }
579
+ }
580
+ function primeLgUdid() {
581
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_LGUDID_TIMEOUT_MS;
582
+ if (lgUdidResult || lgUdidPromise) return lgUdidPromise !== null && lgUdidPromise !== void 0 ? lgUdidPromise : Promise.resolve();
583
+ var dev = typeof window !== "undefined" ? window.webOSDev : void 0;
584
+ if (!dev) return Promise.resolve();
585
+ if (typeof dev.LGUDID !== "function") {
586
+ var _dev_lgudid;
587
+ var direct = (_dev_lgudid = dev.lgudid) !== null && _dev_lgudid !== void 0 ? _dev_lgudid : dev.LGUDID;
588
+ if (isZeroedAdId(direct)) lgUdidResult = {
589
+ deviceIdType: "lgudid",
590
+ limitAdTracking: true
591
+ };
592
+ else if (isUsableAdId(direct)) {
593
+ lgUdidResult = {
594
+ deviceId: direct.trim(),
595
+ deviceIdType: "lgudid",
596
+ limitAdTracking: false
597
+ };
598
+ }
599
+ return Promise.resolve();
600
+ }
601
+ lgUdidPromise = new Promise(function(resolve) {
602
+ var settled = false;
603
+ var finish = function finish() {
604
+ if (settled) return;
605
+ settled = true;
606
+ clearTimeout(timer);
607
+ resolve();
608
+ };
609
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
610
+ try {
611
+ dev.LGUDID({
612
+ onSuccess: function onSuccess(res) {
613
+ var id = res === null || res === void 0 ? void 0 : res.id;
614
+ if (isZeroedAdId(id)) {
615
+ lgUdidResult = {
616
+ deviceIdType: "lgudid",
617
+ limitAdTracking: true
618
+ };
619
+ } else if (isUsableAdId(id)) {
620
+ lgUdidResult = {
621
+ deviceId: id.trim(),
622
+ deviceIdType: "lgudid",
623
+ limitAdTracking: false
624
+ };
625
+ }
626
+ finish();
627
+ },
628
+ onFailure: function onFailure() {
629
+ return finish();
630
+ }
631
+ });
632
+ } catch (unused) {
633
+ finish();
634
+ }
635
+ });
636
+ return lgUdidPromise;
637
+ }
638
+ function readCachedLgUdid() {
639
+ return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
640
+ }
641
+ function getOrRotateFallbackDeviceId() {
642
+ 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();
643
+ clearLegacyIdsOnce();
644
+ var age = clampAge(maxAgeMs, DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS);
645
+ var stored = readStored(FALLBACK_DEVICE_ID_KEY);
646
+ if (stored && isUsableAdId(stored.id) && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
647
+ return stored.id;
648
+ }
649
+ var id = createUuid();
650
+ writeStored(FALLBACK_DEVICE_ID_KEY, {
651
+ id: id,
652
+ createdAt: now
653
+ });
654
+ return id;
655
+ }
656
+ function getOrRotateSessionId() {
657
+ 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();
658
+ clearLegacyIdsOnce();
659
+ var age = clampAge(maxAgeMs, DEFAULT_SESSION_ID_MAX_AGE_MS, MAX_SESSION_ID_AGE_MS);
660
+ var stored = readStored(SESSION_ID_KEY);
661
+ if (stored && isUsableAdId(stored.id) && stored.id !== avoidValue && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
662
+ return stored.id;
663
+ }
664
+ var id = createUuid();
665
+ while(id === avoidValue)id = createUuid();
666
+ writeStored(SESSION_ID_KEY, {
667
+ id: id,
668
+ createdAt: now
669
+ });
670
+ return id;
671
+ }
415
672
  // src/utils/vastEnvironmentSignals.ts
416
- var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
417
673
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
418
674
  var DEVICE_ID_STORAGE_KEYS = [
419
675
  "rdid",
@@ -432,49 +688,96 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
432
688
  "adid"
433
689
  ]);
434
690
  function resolveVastEnvironmentSignals(isCtv) {
435
- var bridgeSignals = readNativeBridgeSignals();
436
- var platformDevice = readPlatformNativeDeviceId();
437
- var bridgeDeviceId = validDeviceId(bridgeSignals.deviceId);
438
- var realDeviceId = bridgeDeviceId || (isCtv ? validDeviceId(readStoredDeviceId()) : void 0) || validDeviceId(platformDevice.deviceId);
439
- var deviceId = realDeviceId;
440
- var deviceIdType = (bridgeDeviceId ? bridgeSignals.deviceIdType : void 0) || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
441
- var platformLat = bridgeDeviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
442
- var limitAdTracking = deviceId != null ? platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking() : void 0;
443
- if (!deviceId && isCtv) {
444
- var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
445
- if (dpid) {
446
- deviceId = dpid;
447
- deviceIdType = "dpid";
448
- limitAdTracking = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking();
449
- }
450
- }
691
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
451
692
  var deviceTypeHint = resolveDeviceTypeHint(isCtv);
693
+ var identity = resolveDeviceIdentity(isCtv, options);
694
+ var identityFields = _object_spread({}, identity.deviceId ? {
695
+ deviceId: identity.deviceId
696
+ } : {}, identity.deviceId && identity.deviceIdType ? {
697
+ deviceIdType: identity.deviceIdType
698
+ } : {}, identity.deviceId && identity.limitAdTracking != null ? {
699
+ limitAdTracking: identity.limitAdTracking
700
+ } : {}, identity.source ? {
701
+ deviceIdSource: identity.source
702
+ } : {});
452
703
  if (isCtv) {
453
704
  return _object_spread_props(_object_spread({
454
705
  isCtv: true,
455
- sessionId: getOrCreateCtvSessionId()
456
- }, deviceId ? {
457
- deviceId: deviceId
458
- } : {}, deviceId && deviceIdType ? {
459
- deviceIdType: deviceIdType
460
- } : {}, deviceId && limitAdTracking != null ? {
461
- limitAdTracking: limitAdTracking
462
- } : {}), {
706
+ sessionId: getOrRotateSessionId(options.sessionIdMaxAgeMs, identity.deviceId)
707
+ }, identityFields), {
463
708
  deviceTypeHint: deviceTypeHint
464
709
  });
465
710
  }
466
711
  return _object_spread_props(_object_spread({
467
712
  isCtv: false
468
- }, deviceId ? {
469
- deviceId: deviceId
470
- } : {}, deviceId && deviceIdType ? {
471
- deviceIdType: deviceIdType
472
- } : {}, deviceId && limitAdTracking != null ? {
473
- limitAdTracking: limitAdTracking
474
- } : {}), {
713
+ }, identityFields), {
475
714
  deviceTypeHint: deviceTypeHint
476
715
  });
477
716
  }
717
+ function resolveDeviceIdentity(isCtv, options) {
718
+ var _platform_limitAdTracking;
719
+ var host = getHostAdIdentity();
720
+ if (host) {
721
+ var _host_deviceIdType;
722
+ return _object_spread_props(_object_spread({
723
+ deviceId: host.deviceId,
724
+ deviceIdType: (_host_deviceIdType = host.deviceIdType) !== null && _host_deviceIdType !== void 0 ? _host_deviceIdType : "dpid"
725
+ }, host.limitAdTracking != null ? {
726
+ limitAdTracking: host.limitAdTracking
727
+ } : {}), {
728
+ source: "host"
729
+ });
730
+ }
731
+ var bridge = readNativeBridgeSignals();
732
+ var bridgeDeviceId = validDeviceId(bridge.deviceId);
733
+ if (bridgeDeviceId) {
734
+ var _normalizeIdType;
735
+ return _object_spread_props(_object_spread({
736
+ deviceId: bridgeDeviceId,
737
+ deviceIdType: (_normalizeIdType = normalizeIdType(bridge.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
738
+ }, bridge.limitAdTracking != null ? {
739
+ limitAdTracking: bridge.limitAdTracking
740
+ } : {}), {
741
+ source: "bridge"
742
+ });
743
+ }
744
+ var platform = readPlatformNativeDeviceId();
745
+ var platformDeviceId = validDeviceId(platform.deviceId);
746
+ if (platformDeviceId) {
747
+ var _platform_deviceIdType;
748
+ return _object_spread_props(_object_spread({
749
+ deviceId: platformDeviceId,
750
+ deviceIdType: (_platform_deviceIdType = platform.deviceIdType) !== null && _platform_deviceIdType !== void 0 ? _platform_deviceIdType : "dpid"
751
+ }, platform.limitAdTracking != null ? {
752
+ limitAdTracking: platform.limitAdTracking
753
+ } : {}), {
754
+ source: "platform"
755
+ });
756
+ }
757
+ if (!isCtv) return {};
758
+ var storedDeviceId = validDeviceId(readStoredDeviceId());
759
+ if (storedDeviceId) {
760
+ var _normalizeIdType1;
761
+ var storedLat = readStoredLimitAdTracking();
762
+ return _object_spread_props(_object_spread({
763
+ deviceId: storedDeviceId,
764
+ deviceIdType: (_normalizeIdType1 = normalizeIdType(readStoredString("deviceIdType") || readStoredString("idtype"))) !== null && _normalizeIdType1 !== void 0 ? _normalizeIdType1 : "dpid"
765
+ }, storedLat != null ? {
766
+ limitAdTracking: storedLat
767
+ } : {}), {
768
+ source: "stored"
769
+ });
770
+ }
771
+ var fallbackLat = (_platform_limitAdTracking = platform.limitAdTracking) !== null && _platform_limitAdTracking !== void 0 ? _platform_limitAdTracking : readStoredLimitAdTracking();
772
+ return _object_spread_props(_object_spread({
773
+ deviceId: getOrRotateFallbackDeviceId(options.fallbackDeviceIdMaxAgeMs),
774
+ deviceIdType: "dpid"
775
+ }, fallbackLat != null ? {
776
+ limitAdTracking: fallbackLat
777
+ } : {}), {
778
+ source: "generated"
779
+ });
780
+ }
478
781
  var DEVICE_TYPE_HINT = {
479
782
  FEATURE_PHONE: 1,
480
783
  SMARTPHONE: 2,
@@ -635,7 +938,7 @@ function resolveNativeDeviceId() {
635
938
  var bridgeSignals = readNativeBridgeSignals();
636
939
  var platformDevice = readPlatformNativeDeviceId();
637
940
  var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
638
- if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
941
+ if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
639
942
  return void 0;
640
943
  }
641
944
  return deviceId;
@@ -649,20 +952,10 @@ function getOrCreateStoredUuid(storageKey) {
649
952
  writePersistentId(storageKey, existing);
650
953
  return existing;
651
954
  }
652
- var id = createUuid();
955
+ var id = createUuid2();
653
956
  writePersistentId(storageKey, id);
654
957
  return id;
655
958
  }
656
- function getOrCreateCtvSessionId() {
657
- var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
658
- if (existing) {
659
- writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
660
- return existing;
661
- }
662
- var sessionId = createUuid();
663
- writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
664
- return sessionId;
665
- }
666
959
  function readPersistentId(storageKey) {
667
960
  return readStoredString(storageKey) || readCookie(storageKey);
668
961
  }
@@ -715,7 +1008,7 @@ function writeCookie(name, value) {
715
1008
  document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
716
1009
  } catch (unused) {}
717
1010
  }
718
- function createUuid() {
1011
+ function createUuid2() {
719
1012
  var _bytes_, _bytes_1;
720
1013
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
721
1014
  return crypto.randomUUID();
@@ -749,44 +1042,10 @@ function performanceNow() {
749
1042
  }
750
1043
  function readPlatformNativeDeviceId() {
751
1044
  if (typeof window === "undefined") return {};
752
- try {
753
- var _window_webapis;
754
- var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
755
- if (adinfo) {
756
- var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
757
- if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
758
- var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
759
- return _object_spread({
760
- deviceId: tifa,
761
- deviceIdType: "tifa"
762
- }, typeof lat === "boolean" ? {
763
- limitAdTracking: lat
764
- } : {});
765
- }
766
- }
767
- } catch (unused) {}
768
- try {
769
- var webOSDev = window.webOSDev;
770
- if (webOSDev) {
771
- var _webOSDev_lgudid;
772
- var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
773
- if (typeof lgudid === "string" && lgudid) {
774
- if (isZeroedAdId(lgudid)) {
775
- return {
776
- deviceIdType: "lgudid",
777
- limitAdTracking: true
778
- };
779
- }
780
- if (!isMacroPlaceholder(lgudid)) {
781
- return {
782
- deviceId: lgudid,
783
- deviceIdType: "lgudid",
784
- limitAdTracking: false
785
- };
786
- }
787
- }
788
- }
789
- } catch (unused) {}
1045
+ var tifa = readSamsungTifa();
1046
+ if (tifa) return tifa;
1047
+ var lgudid = readCachedLgUdid();
1048
+ if (lgudid) return lgudid;
790
1049
  try {
791
1050
  var roku = window.Roku;
792
1051
  if (roku) {
@@ -813,7 +1072,7 @@ function isMacroPlaceholder(value) {
813
1072
  function validDeviceId(value) {
814
1073
  return value && !isMacroPlaceholder(value) ? value : void 0;
815
1074
  }
816
- function isZeroedAdId(value) {
1075
+ function isZeroedAdId2(value) {
817
1076
  return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
818
1077
  }
819
1078
  function readNativeBridgeSignals() {
@@ -857,7 +1116,7 @@ function readNativeBridgeSignals() {
857
1116
  "deviceIdType",
858
1117
  "advertisingIdType",
859
1118
  "idType"
860
- ]) || inferDeviceIdType();
1119
+ ]) || void 0;
861
1120
  var limitAdTracking = readBridgeBoolean(source, [
862
1121
  "is_lat",
863
1122
  "limitAdTracking",
@@ -1405,6 +1664,7 @@ function resolveScvpMacroValues(ctx) {
1405
1664
  set("GIVN", ctx.palNonce);
1406
1665
  set("CT-TI", ctx.programTitle);
1407
1666
  set("CT-CH", ctx.channelName);
1667
+ set("CT-NE", ctx.contentNetwork);
1408
1668
  set("POD", ctx.pod);
1409
1669
  set("CORRELATOR", ctx.correlator);
1410
1670
  set("SCOR", ctx.streamCorrelator);
@@ -1633,6 +1893,9 @@ function applyVastMacros(baseUrl, ctx) {
1633
1893
  if (ctx.channelName) {
1634
1894
  params.set("ct_ch", ctx.channelName);
1635
1895
  }
1896
+ if (ctx.contentNetwork) {
1897
+ params.set("ct_ne", ctx.contentNetwork);
1898
+ }
1636
1899
  var staleKeys = [];
1637
1900
  params.forEach(function(value, key) {
1638
1901
  if (isMacroPlaceholder2(value)) {
@@ -2297,8 +2560,17 @@ function detectBrowser() {
2297
2560
  chromeVersion: chromeVersionNum
2298
2561
  };
2299
2562
  }
2563
+ var singleDecoderOverride;
2564
+ function setSingleDecoderOverride(value) {
2565
+ singleDecoderOverride = value;
2566
+ }
2300
2567
  function requiresMediaPipelineResetAfterAds() {
2301
2568
  var _browser_tizenVersion;
2569
+ if (singleDecoderOverride != null) return singleDecoderOverride;
2570
+ try {
2571
+ var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
2572
+ if (typeof globalOverride === "boolean") return globalOverride;
2573
+ } catch (unused) {}
2302
2574
  var browser = detectBrowser();
2303
2575
  return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
2304
2576
  }
@@ -2458,7 +2730,7 @@ function substituteVastTrackingMacros(url) {
2458
2730
  });
2459
2731
  }
2460
2732
  // src/player/OptimizedPodRequest.ts
2461
- var DEFAULT_REQUEST_SAFETY_MS = 1500;
2733
+ var DEFAULT_REQUEST_SAFETY_MS = 2500;
2462
2734
  var GAM_AD_OPPORTUNITY_DURATION_MS = 3e4;
2463
2735
  var POD_PARAM_KEYS = [
2464
2736
  "pmnd",
@@ -2882,6 +3154,9 @@ function createHlsAdPlayer(contentVideo, options) {
2882
3154
  var mediaCandidateIndex = 0;
2883
3155
  var mediaStartTimerId;
2884
3156
  var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
3157
+ var MAX_MEDIA_START_ATTEMPTS = 2;
3158
+ var MEDIA_START_TOTAL_BUDGET_MS = Math.max(MEDIA_START_TIMEOUT_MS, 1e4);
3159
+ var mediaStartBudgetStartedAt = 0;
2885
3160
  var VAST_ERROR_MEDIA_TIMEOUT = 402;
2886
3161
  var pendingVastRequests = /* @__PURE__ */ new Set();
2887
3162
  var pendingRequestAbortReason;
@@ -4896,12 +5171,14 @@ function createHlsAdPlayer(contentVideo, options) {
4896
5171
  clearMediaStartTimer();
4897
5172
  if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
4898
5173
  var startedAt = Date.now();
5174
+ var budgetLeftMs = mediaStartBudgetStartedAt > 0 ? MEDIA_START_TOTAL_BUDGET_MS - (startedAt - mediaStartBudgetStartedAt) : MEDIA_START_TIMEOUT_MS;
5175
+ var timeoutMs = Math.max(1e3, Math.min(MEDIA_START_TIMEOUT_MS, budgetLeftMs));
4899
5176
  mediaStartTimerId = setTimeout(function() {
4900
5177
  mediaStartTimerId = void 0;
4901
5178
  if (!adPlaying || trackingFired.impression) return;
4902
- console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(MEDIA_START_TIMEOUT_MS, "ms"));
5179
+ console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(timeoutMs, "ms"));
4903
5180
  logFunnel("play_resolved_but_never_started", {
4904
- timeoutMs: MEDIA_START_TIMEOUT_MS,
5181
+ timeoutMs: timeoutMs,
4905
5182
  elapsedMs: Date.now() - startedAt,
4906
5183
  readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
4907
5184
  networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
@@ -4910,7 +5187,7 @@ function createHlsAdPlayer(contentVideo, options) {
4910
5187
  vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
4911
5188
  });
4912
5189
  recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
4913
- }, MEDIA_START_TIMEOUT_MS);
5190
+ }, timeoutMs);
4914
5191
  }
4915
5192
  function resetVideoElementForNextSource() {
4916
5193
  clearStallWatchdog();
@@ -4925,6 +5202,20 @@ function createHlsAdPlayer(contentVideo, options) {
4925
5202
  function tryNextMediaCandidate() {
4926
5203
  if (!currentAd || trackingFired.impression) return false;
4927
5204
  if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
5205
+ if (mediaCandidateIndex + 1 >= MAX_MEDIA_START_ATTEMPTS) {
5206
+ logFunnel("media_fallback_capped", {
5207
+ reason: "max_attempts",
5208
+ attempts: mediaCandidateIndex + 1
5209
+ });
5210
+ return false;
5211
+ }
5212
+ if (mediaStartBudgetStartedAt > 0 && Date.now() - mediaStartBudgetStartedAt >= MEDIA_START_TOTAL_BUDGET_MS) {
5213
+ logFunnel("media_fallback_capped", {
5214
+ reason: "time_budget",
5215
+ elapsedMs: Date.now() - mediaStartBudgetStartedAt
5216
+ });
5217
+ return false;
5218
+ }
4928
5219
  var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
4929
5220
  mediaCandidateIndex++;
4930
5221
  var next = mediaCandidates[mediaCandidateIndex];
@@ -4958,6 +5249,7 @@ function createHlsAdPlayer(contentVideo, options) {
4958
5249
  }
4959
5250
  mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
4960
5251
  mediaCandidateIndex = 0;
5252
+ mediaStartBudgetStartedAt = Date.now();
4961
5253
  var mediaFile = mediaCandidates[0];
4962
5254
  if (!mediaFile) {
4963
5255
  logFunnel("media_unsupported", {
@@ -5897,6 +6189,7 @@ function getOrCreateNonceLoader(allowStorage) {
5897
6189
  }
5898
6190
  function createPalNonceManager() {
5899
6191
  var currentNonce = "";
6192
+ var currentNonceCreatedAt = 0;
5900
6193
  var currentNonceManager;
5901
6194
  var pendingNonce;
5902
6195
  return {
@@ -5913,6 +6206,9 @@ function createPalNonceManager() {
5913
6206
  getCurrentNonce: function getCurrentNonce() {
5914
6207
  return currentNonce;
5915
6208
  },
6209
+ getNonceAgeMs: function getNonceAgeMs() {
6210
+ return currentNonce ? Date.now() - currentNonceCreatedAt : void 0;
6211
+ },
5916
6212
  waitForNonce: function waitForNonce(maxWaitMs) {
5917
6213
  if (currentNonce) return Promise.resolve(currentNonce);
5918
6214
  var pending = pendingNonce;
@@ -5965,13 +6261,14 @@ function createPalNonceManager() {
5965
6261
  },
5966
6262
  reset: function reset() {
5967
6263
  currentNonce = "";
6264
+ currentNonceCreatedAt = 0;
5968
6265
  currentNonceManager = void 0;
5969
6266
  pendingNonce = void 0;
5970
6267
  }
5971
6268
  };
5972
6269
  function generate(options) {
5973
6270
  return _async_to_generator(function() {
5974
- var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
6271
+ var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, _options_iconsSupported, _options_supportedApiFrameworks, loader, goog, request, apiFrameworks, manager, error;
5975
6272
  return _ts_generator(this, function(_state) {
5976
6273
  switch(_state.label){
5977
6274
  case 0:
@@ -5995,10 +6292,11 @@ function createPalNonceManager() {
5995
6292
  request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
5996
6293
  request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
5997
6294
  request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
5998
- request.iconsSupported = true;
6295
+ request.iconsSupported = (_options_iconsSupported = options.iconsSupported) !== null && _options_iconsSupported !== void 0 ? _options_iconsSupported : false;
5999
6296
  request.playerType = "StormcloudVideoPlayer";
6000
6297
  request.playerVersion = "1.0";
6001
- request.supportedApiFrameworks = "2,7,9";
6298
+ apiFrameworks = ((_options_supportedApiFrameworks = options.supportedApiFrameworks) !== null && _options_supportedApiFrameworks !== void 0 ? _options_supportedApiFrameworks : "").trim();
6299
+ if (apiFrameworks) request.supportedApiFrameworks = apiFrameworks;
6002
6300
  request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
6003
6301
  request.videoWidth = options.videoWidth || 640;
6004
6302
  request.videoHeight = options.videoHeight || 480;
@@ -6028,6 +6326,7 @@ function createPalNonceManager() {
6028
6326
  manager = _state.sent();
6029
6327
  currentNonceManager = manager;
6030
6328
  currentNonce = manager.getNonce();
6329
+ currentNonceCreatedAt = Date.now();
6031
6330
  console.log("[PAL] Nonce generated successfully");
6032
6331
  return [
6033
6332
  2,
@@ -6051,6 +6350,549 @@ function createPalNonceManager() {
6051
6350
  })();
6052
6351
  }
6053
6352
  }
6353
+ // src/utils/deviceInfo.ts
6354
+ var CATEGORY_CODES = {
6355
+ "LG TV": "lg_tv",
6356
+ "LG Set-Top Box": "lg_stb",
6357
+ "Samsung TV": "samsung_tv",
6358
+ Other: "other"
6359
+ };
6360
+ var DEVICE_CATEGORIES = [
6361
+ "LG TV",
6362
+ "LG Set-Top Box",
6363
+ "Samsung TV",
6364
+ "Other"
6365
+ ];
6366
+ var hostDeviceInfo;
6367
+ var lgDeviceInfo;
6368
+ var platformCache;
6369
+ var primePromise;
6370
+ function cleanString(value) {
6371
+ var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
6372
+ if (typeof value !== "string") return void 0;
6373
+ var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
6374
+ if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
6375
+ return t.length > maxLength ? t.slice(0, maxLength) : t;
6376
+ }
6377
+ function safeCall2(fn, thisArg) {
6378
+ if (typeof fn !== "function") return void 0;
6379
+ try {
6380
+ return fn.call(thisArg);
6381
+ } catch (unused) {
6382
+ return void 0;
6383
+ }
6384
+ }
6385
+ function userAgent() {
6386
+ return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
6387
+ }
6388
+ function bridgeSources() {
6389
+ if (typeof window === "undefined") return [];
6390
+ var w = window;
6391
+ return [
6392
+ w.__STORMCLOUD_CTV__,
6393
+ w.__STORMCLOUD_CTV_AD_INFO__,
6394
+ w.stormcloudCtv
6395
+ ].filter(Boolean);
6396
+ }
6397
+ function readBridge(keys) {
6398
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6399
+ try {
6400
+ for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6401
+ var source = _step.value;
6402
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6403
+ try {
6404
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6405
+ var key = _step1.value;
6406
+ var value = void 0;
6407
+ try {
6408
+ value = source === null || source === void 0 ? void 0 : source[key];
6409
+ if (typeof value === "function") value = value.call(source);
6410
+ } catch (unused) {
6411
+ value = void 0;
6412
+ }
6413
+ var clean = cleanString(value);
6414
+ if (clean) return clean;
6415
+ }
6416
+ } catch (err) {
6417
+ _didIteratorError1 = true;
6418
+ _iteratorError1 = err;
6419
+ } finally{
6420
+ try {
6421
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6422
+ _iterator1.return();
6423
+ }
6424
+ } finally{
6425
+ if (_didIteratorError1) {
6426
+ throw _iteratorError1;
6427
+ }
6428
+ }
6429
+ }
6430
+ }
6431
+ } catch (err) {
6432
+ _didIteratorError = true;
6433
+ _iteratorError = err;
6434
+ } finally{
6435
+ try {
6436
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6437
+ _iterator.return();
6438
+ }
6439
+ } finally{
6440
+ if (_didIteratorError) {
6441
+ throw _iteratorError;
6442
+ }
6443
+ }
6444
+ }
6445
+ return void 0;
6446
+ }
6447
+ function normalizeCategory(value) {
6448
+ var v = cleanString(value);
6449
+ if (!v) return void 0;
6450
+ var exact = DEVICE_CATEGORIES.find(function(c) {
6451
+ return c.toLowerCase() === v.toLowerCase();
6452
+ });
6453
+ if (exact) return exact;
6454
+ var code = v.toLowerCase().replace(/[\s-]+/g, "_");
6455
+ var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
6456
+ return CATEGORY_CODES[c] === code;
6457
+ });
6458
+ return byCode;
6459
+ }
6460
+ function parseUserAgentDeviceInfo(ua) {
6461
+ var sources = [];
6462
+ var out = {
6463
+ platform: "other",
6464
+ sources: sources
6465
+ };
6466
+ var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
6467
+ if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
6468
+ if (/Web0S|webOS/i.test(ua)) {
6469
+ out.platform = "webos";
6470
+ var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
6471
+ if (lg && lg[1] && lg[2]) {
6472
+ out.model = lg[1];
6473
+ out.firmware = lg[2];
6474
+ sources.push("user_agent");
6475
+ }
6476
+ } else if (/Tizen/i.test(ua)) {
6477
+ out.platform = "tizen";
6478
+ var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
6479
+ if (tizen && tizen[1]) {
6480
+ out.osVersion = "Tizen ".concat(tizen[1]);
6481
+ sources.push("user_agent");
6482
+ }
6483
+ }
6484
+ return out;
6485
+ }
6486
+ function readSamsungProductInfo() {
6487
+ var _cleanString;
6488
+ var _window_webapis;
6489
+ if (typeof window === "undefined") return void 0;
6490
+ var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
6491
+ if (!productinfo) return void 0;
6492
+ var model = (_cleanString = cleanString(safeCall2(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall2(productinfo.getModel, productinfo), 40);
6493
+ var firmware = cleanString(safeCall2(productinfo.getFirmware, productinfo), 64);
6494
+ var duid = cleanString(safeCall2(productinfo.getDuid, productinfo), 128);
6495
+ if (!model && !firmware && !duid) return void 0;
6496
+ return _object_spread({}, model ? {
6497
+ model: model
6498
+ } : {}, firmware ? {
6499
+ firmware: firmware
6500
+ } : {}, duid ? {
6501
+ internalDeviceId: duid,
6502
+ internalDeviceIdSource: "samsung_duid"
6503
+ } : {});
6504
+ }
6505
+ function readLgDeviceInfo(timeoutMs) {
6506
+ var webOS = typeof window !== "undefined" ? window.webOS : void 0;
6507
+ if (lgDeviceInfo || !webOS || typeof webOS.deviceInfo !== "function") return Promise.resolve();
6508
+ return new Promise(function(resolve) {
6509
+ var settled = false;
6510
+ var finish = function finish() {
6511
+ if (settled) return;
6512
+ settled = true;
6513
+ clearTimeout(timer);
6514
+ resolve();
6515
+ };
6516
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
6517
+ try {
6518
+ webOS.deviceInfo(function(info) {
6519
+ var model = cleanString(info === null || info === void 0 ? void 0 : info.modelName, 40);
6520
+ var firmware = cleanString(info === null || info === void 0 ? void 0 : info.version, 64);
6521
+ var sdkVersion = cleanString(info === null || info === void 0 ? void 0 : info.sdkVersion, 32);
6522
+ lgDeviceInfo = _object_spread({}, model ? {
6523
+ model: model
6524
+ } : {}, firmware ? {
6525
+ firmware: firmware
6526
+ } : {}, sdkVersion ? {
6527
+ sdkVersion: sdkVersion
6528
+ } : {});
6529
+ finish();
6530
+ });
6531
+ } catch (unused) {
6532
+ finish();
6533
+ }
6534
+ });
6535
+ }
6536
+ function computePlatformInfo() {
6537
+ var info = parseUserAgentDeviceInfo(userAgent());
6538
+ var sources = _to_consumable_array(info.sources);
6539
+ var samsung = readSamsungProductInfo();
6540
+ if (samsung) {
6541
+ info.platform = "tizen";
6542
+ if (samsung.model) info.model = samsung.model;
6543
+ if (samsung.firmware) info.firmware = samsung.firmware;
6544
+ if (samsung.internalDeviceId) {
6545
+ info.internalDeviceId = samsung.internalDeviceId;
6546
+ info.internalDeviceIdSource = "samsung_duid";
6547
+ }
6548
+ sources.push("samsung_productinfo");
6549
+ }
6550
+ if (lgDeviceInfo) {
6551
+ info.platform = "webos";
6552
+ if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
6553
+ if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
6554
+ if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
6555
+ sources.push("lg_deviceinfo");
6556
+ }
6557
+ var lgUdid = readCachedLgUdid();
6558
+ if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
6559
+ info.internalDeviceId = lgUdid.deviceId;
6560
+ info.internalDeviceIdSource = "lg_udid";
6561
+ sources.push("lg_udid");
6562
+ }
6563
+ info.sources = sources;
6564
+ return info;
6565
+ }
6566
+ function categorize(platform, model) {
6567
+ if (platform === "tizen") return "Samsung TV";
6568
+ if (platform === "webos") {
6569
+ var ua = userAgent();
6570
+ if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
6571
+ return "LG TV";
6572
+ }
6573
+ return "Other";
6574
+ }
6575
+ function setHostDeviceInfo(info) {
6576
+ hostDeviceInfo = info ? _object_spread({}, info) : void 0;
6577
+ }
6578
+ function primeDeviceInfo() {
6579
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1500;
6580
+ if (!primePromise) {
6581
+ primePromise = Promise.all([
6582
+ readLgDeviceInfo(timeoutMs),
6583
+ primeLgUdid(timeoutMs)
6584
+ ]).catch(function() {
6585
+ return void 0;
6586
+ }).then(function() {
6587
+ platformCache = computePlatformInfo();
6588
+ return getDeviceInfo();
6589
+ });
6590
+ }
6591
+ return primePromise;
6592
+ }
6593
+ function getDeviceInfo() {
6594
+ var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
6595
+ var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
6596
+ if (primePromise && !platformCache) {} else {
6597
+ platformCache = platform;
6598
+ }
6599
+ var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
6600
+ var bridge = {
6601
+ terminalId: readBridge([
6602
+ "terminalId",
6603
+ "terminal_id"
6604
+ ]),
6605
+ internalDeviceId: readBridge([
6606
+ "internalDeviceId",
6607
+ "internal_device_id"
6608
+ ]),
6609
+ model: readBridge([
6610
+ "deviceModel"
6611
+ ]),
6612
+ firmware: readBridge([
6613
+ "firmwareVersion"
6614
+ ]),
6615
+ category: normalizeCategory(readBridge([
6616
+ "deviceCategory"
6617
+ ]))
6618
+ };
6619
+ var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
6620
+ var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
6621
+ var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
6622
+ var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
6623
+ var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
6624
+ var sources = _to_consumable_array(platform.sources);
6625
+ var bridgeValues = [
6626
+ bridge.terminalId,
6627
+ bridge.internalDeviceId,
6628
+ bridge.model,
6629
+ bridge.firmware,
6630
+ bridge.category
6631
+ ];
6632
+ if (bridgeValues.some(function(v) {
6633
+ return v !== void 0;
6634
+ })) sources.unshift("bridge");
6635
+ if (hostDeviceInfo) sources.unshift("host");
6636
+ var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
6637
+ var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
6638
+ var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
6639
+ return _object_spread_props(_object_spread({
6640
+ category: category,
6641
+ categoryCode: CATEGORY_CODES[category]
6642
+ }, model ? {
6643
+ model: model
6644
+ } : {}, sonifiModel ? {
6645
+ sonifiModel: sonifiModel
6646
+ } : {}, firmware ? {
6647
+ firmware: firmware
6648
+ } : {}, platform.osVersion ? {
6649
+ osVersion: platform.osVersion
6650
+ } : {}, platform.browserMajorVersion != null ? {
6651
+ browserMajorVersion: platform.browserMajorVersion
6652
+ } : {}, internalDeviceId ? {
6653
+ internalDeviceId: internalDeviceId
6654
+ } : {}, internalDeviceId && internalDeviceIdSource ? {
6655
+ internalDeviceIdSource: internalDeviceIdSource
6656
+ } : {}, terminalId ? {
6657
+ terminalId: terminalId
6658
+ } : {}), {
6659
+ sources: sources
6660
+ });
6661
+ }
6662
+ var DEVICE_KEY_VALUE_KEYS = {
6663
+ category: "sc_dev",
6664
+ model: "sc_model",
6665
+ firmware: "sc_fw"
6666
+ };
6667
+ function sanitizeKeyValue(value) {
6668
+ if (typeof value !== "string") return void 0;
6669
+ var v = value.trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
6670
+ return v ? v.slice(0, 40) : void 0;
6671
+ }
6672
+ function deviceKeyValuePairs(info) {
6673
+ var pairs = [
6674
+ [
6675
+ DEVICE_KEY_VALUE_KEYS.category,
6676
+ info.categoryCode
6677
+ ]
6678
+ ];
6679
+ var model = sanitizeKeyValue(info.model);
6680
+ var firmware = sanitizeKeyValue(info.firmware);
6681
+ if (model) pairs.push([
6682
+ DEVICE_KEY_VALUE_KEYS.model,
6683
+ model
6684
+ ]);
6685
+ if (firmware) pairs.push([
6686
+ DEVICE_KEY_VALUE_KEYS.firmware,
6687
+ firmware
6688
+ ]);
6689
+ return pairs;
6690
+ }
6691
+ function applyDeviceKeyValues(url, info) {
6692
+ try {
6693
+ var parsed = new URL(url);
6694
+ var pairs = deviceKeyValuePairs(info);
6695
+ var ours = new Set(pairs.map(function(param) {
6696
+ var _param = _sliced_to_array(param, 1), k = _param[0];
6697
+ return k;
6698
+ }));
6699
+ var existing = (parsed.searchParams.get("cust_params") || "").split("&").filter(function(p) {
6700
+ var _p_split_;
6701
+ return p !== "" && !ours.has((_p_split_ = p.split("=")[0]) !== null && _p_split_ !== void 0 ? _p_split_ : "");
6702
+ });
6703
+ var merged = existing.concat(pairs.map(function(param) {
6704
+ var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
6705
+ return "".concat(k, "=").concat(v);
6706
+ })).join("&");
6707
+ parsed.searchParams.set("cust_params", merged);
6708
+ return parsed.toString();
6709
+ } catch (unused) {
6710
+ return url;
6711
+ }
6712
+ }
6713
+ function deviceInfoAnalyticsFields(info) {
6714
+ return _object_spread({
6715
+ device_category: info.category
6716
+ }, info.model ? {
6717
+ device_model: info.model
6718
+ } : {}, info.sonifiModel ? {
6719
+ sonifi_model: info.sonifiModel
6720
+ } : {}, info.firmware ? {
6721
+ firmware_version: info.firmware
6722
+ } : {}, info.osVersion ? {
6723
+ os_version: info.osVersion
6724
+ } : {}, info.browserMajorVersion != null ? {
6725
+ browser_major_version: info.browserMajorVersion
6726
+ } : {}, info.internalDeviceId ? {
6727
+ internal_device_id: info.internalDeviceId
6728
+ } : {}, info.internalDeviceIdSource ? {
6729
+ internal_device_id_source: info.internalDeviceIdSource
6730
+ } : {}, info.terminalId ? {
6731
+ terminal_id: info.terminalId
6732
+ } : {});
6733
+ }
6734
+ // src/utils/contentMetadata.ts
6735
+ var MAX_CONTENT_VALUE_LENGTH = 128;
6736
+ var BRIDGE_KEYS = {
6737
+ channelName: [
6738
+ "channelName",
6739
+ "ct_ch"
6740
+ ],
6741
+ programTitle: [
6742
+ "programTitle",
6743
+ "ct_ti"
6744
+ ],
6745
+ contentNetwork: [
6746
+ "contentNetwork",
6747
+ "ct_ne"
6748
+ ]
6749
+ };
6750
+ function sanitizeContentValue(value) {
6751
+ if (typeof value !== "string") return void 0;
6752
+ var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
6753
+ if (!cleaned) return void 0;
6754
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
6755
+ if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
6756
+ return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
6757
+ }
6758
+ function bridgeSources2() {
6759
+ if (typeof window === "undefined") return [];
6760
+ var w = window;
6761
+ return [
6762
+ w.__STORMCLOUD_CTV__,
6763
+ w.__STORMCLOUD_CTV_AD_INFO__,
6764
+ w.stormcloudCtv
6765
+ ].filter(Boolean);
6766
+ }
6767
+ function readBridgeContentValue(keys) {
6768
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6769
+ try {
6770
+ for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6771
+ var source = _step.value;
6772
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6773
+ try {
6774
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6775
+ var key = _step1.value;
6776
+ var value = void 0;
6777
+ try {
6778
+ value = source === null || source === void 0 ? void 0 : source[key];
6779
+ if (typeof value === "function") value = value.call(source);
6780
+ } catch (unused) {
6781
+ value = void 0;
6782
+ }
6783
+ var sanitized = sanitizeContentValue(value);
6784
+ if (sanitized) return sanitized;
6785
+ }
6786
+ } catch (err) {
6787
+ _didIteratorError1 = true;
6788
+ _iteratorError1 = err;
6789
+ } finally{
6790
+ try {
6791
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6792
+ _iterator1.return();
6793
+ }
6794
+ } finally{
6795
+ if (_didIteratorError1) {
6796
+ throw _iteratorError1;
6797
+ }
6798
+ }
6799
+ }
6800
+ }
6801
+ } catch (err) {
6802
+ _didIteratorError = true;
6803
+ _iteratorError = err;
6804
+ } finally{
6805
+ try {
6806
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6807
+ _iterator.return();
6808
+ }
6809
+ } finally{
6810
+ if (_didIteratorError) {
6811
+ throw _iteratorError;
6812
+ }
6813
+ }
6814
+ }
6815
+ return void 0;
6816
+ }
6817
+ function resolveContentMetadata(config) {
6818
+ var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2;
6819
+ var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
6820
+ var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
6821
+ var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
6822
+ return _object_spread({}, channelName ? {
6823
+ channelName: channelName
6824
+ } : {}, programTitle ? {
6825
+ programTitle: programTitle
6826
+ } : {}, contentNetwork ? {
6827
+ contentNetwork: contentNetwork
6828
+ } : {});
6829
+ }
6830
+ function appendMissingContentParams(url, meta) {
6831
+ if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
6832
+ try {
6833
+ var parsed = new URL(url);
6834
+ var add = function add(key, value) {
6835
+ if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
6836
+ };
6837
+ add("ct_ch", meta.channelName);
6838
+ add("ct_ti", meta.programTitle);
6839
+ add("ct_ne", meta.contentNetwork);
6840
+ return parsed.toString();
6841
+ } catch (unused) {
6842
+ return url;
6843
+ }
6844
+ }
6845
+ // src/utils/screenActivity.ts
6846
+ var hostStandby = false;
6847
+ function setHostStandby(standby) {
6848
+ hostStandby = !!standby;
6849
+ }
6850
+ function toBoolean(value) {
6851
+ if (typeof value === "boolean") return value;
6852
+ if (typeof value === "number") return value === 1;
6853
+ if (typeof value === "string") {
6854
+ var v = value.trim().toLowerCase();
6855
+ if (v === "true" || v === "1" || v === "yes") return true;
6856
+ if (v === "false" || v === "0" || v === "no") return false;
6857
+ }
6858
+ return void 0;
6859
+ }
6860
+ function bridgeSaysStandby() {
6861
+ if (typeof window === "undefined") return false;
6862
+ var w = window;
6863
+ for(var _i = 0, _iter = [
6864
+ w.__STORMCLOUD_CTV__,
6865
+ w.__STORMCLOUD_CTV_AD_INFO__,
6866
+ w.stormcloudCtv
6867
+ ]; _i < _iter.length; _i++){
6868
+ var source = _iter[_i];
6869
+ if (!source) continue;
6870
+ for(var _i1 = 0, _iter1 = [
6871
+ "standby",
6872
+ "isStandby",
6873
+ "screenOff"
6874
+ ]; _i1 < _iter1.length; _i1++){
6875
+ var key = _iter1[_i1];
6876
+ var value = void 0;
6877
+ try {
6878
+ value = source[key];
6879
+ if (typeof value === "function") value = value.call(source);
6880
+ } catch (unused) {
6881
+ value = void 0;
6882
+ }
6883
+ if (toBoolean(value) === true) return true;
6884
+ }
6885
+ }
6886
+ return false;
6887
+ }
6888
+ function getScreenInactiveReason() {
6889
+ if (hostStandby) return "host_standby";
6890
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") {
6891
+ return "document_hidden";
6892
+ }
6893
+ if (bridgeSaysStandby()) return "bridge_standby";
6894
+ return void 0;
6895
+ }
6054
6896
  // src/utils/trackingIngest.ts
6055
6897
  var DEFAULT_TRACKING_INGEST_CONFIG = {
6056
6898
  enabled: true,
@@ -6132,20 +6974,25 @@ function ingestPlayerTracking(licenseKey, channel, body) {
6132
6974
  // src/utils/tracking.ts
6133
6975
  var cachedBrowserId = null;
6134
6976
  function buildAnalyticsContext(config) {
6135
- var _config_contentNetwork, _config_channelName, _config_programTitle;
6977
+ var _config_contentNetwork, _config_channelName, _config_programTitle, _config_src;
6136
6978
  var context = {};
6137
6979
  var contentNetwork = (_config_contentNetwork = config.contentNetwork) === null || _config_contentNetwork === void 0 ? void 0 : _config_contentNetwork.trim();
6138
6980
  var contentChannel = (_config_channelName = config.channelName) === null || _config_channelName === void 0 ? void 0 : _config_channelName.trim();
6139
6981
  var contentTitle = (_config_programTitle = config.programTitle) === null || _config_programTitle === void 0 ? void 0 : _config_programTitle.trim();
6982
+ var hlsUrl = (_config_src = config.src) === null || _config_src === void 0 ? void 0 : _config_src.trim();
6140
6983
  if (contentNetwork) context.contentNetwork = contentNetwork;
6141
6984
  if (contentChannel) context.contentChannel = contentChannel;
6142
6985
  if (contentTitle) context.contentTitle = contentTitle;
6986
+ if (hlsUrl) context.hlsUrl = hlsUrl;
6143
6987
  if (config.debugAdTiming) {
6144
6988
  context.debugAdTiming = true;
6145
6989
  }
6146
6990
  if (config.isLiveStream !== void 0) {
6147
6991
  context.inputStreamType = config.isLiveStream ? "live" : "vod";
6148
6992
  }
6993
+ if (config.sendDeviceInfoToAnalytics) {
6994
+ context.includeDeviceInfo = true;
6995
+ }
6149
6996
  return context;
6150
6997
  }
6151
6998
  function getClientInfo() {
@@ -6441,7 +7288,7 @@ function buildPlayerMetricEvent() {
6441
7288
  capture_at: captureAt
6442
7289
  }, context.inputStreamType ? {
6443
7290
  input_stream_type: context.inputStreamType
6444
- } : {})
7291
+ } : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
6445
7292
  ];
6446
7293
  }
6447
7294
  });
@@ -6645,6 +7492,8 @@ function sendAdImpressionTracking(_0, _1) {
6645
7492
  content_channel: context.contentChannel
6646
7493
  } : {}, context.contentTitle ? {
6647
7494
  content_title: context.contentTitle
7495
+ } : {}, context.hlsUrl ? {
7496
+ hls_url: context.hlsUrl
6648
7497
  } : {})
6649
7498
  ]
6650
7499
  })
@@ -8467,7 +9316,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
8467
9316
  key: "generatePodVastUrl",
8468
9317
  value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
8469
9318
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
8470
- var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
9319
+ var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
9320
+ fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
9321
+ sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
9322
+ });
9323
+ var content = resolveContentMetadata(this.config);
8471
9324
  var macroContext = _object_spread_props(_object_spread({
8472
9325
  correlator: this.viewCorrelator,
8473
9326
  streamCorrelator: this.streamCorrelator,
@@ -8482,10 +9335,12 @@ var AdConfigManager = /*#__PURE__*/ function() {
8482
9335
  limitAdTracking: envSignals.limitAdTracking,
8483
9336
  deviceTypeHint: envSignals.deviceTypeHint,
8484
9337
  adTest: this.config.adTest
8485
- }, this.config.programTitle ? {
8486
- programTitle: this.config.programTitle
8487
- } : {}, this.config.channelName ? {
8488
- channelName: this.config.channelName
9338
+ }, content.programTitle ? {
9339
+ programTitle: content.programTitle
9340
+ } : {}, content.channelName ? {
9341
+ channelName: content.channelName
9342
+ } : {}, content.contentNetwork ? {
9343
+ contentNetwork: content.contentNetwork
8489
9344
  } : {}), {
8490
9345
  consent: this.consentSignals,
8491
9346
  palNonce: palNonce.getCurrentNonce() || void 0
@@ -8503,6 +9358,24 @@ var AdConfigManager = /*#__PURE__*/ function() {
8503
9358
  } else {
8504
9359
  finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
8505
9360
  }
9361
+ finalUrl = appendMissingContentParams(finalUrl, content);
9362
+ if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
9363
+ finalUrl = applyDeviceKeyValues(finalUrl, getDeviceInfo());
9364
+ }
9365
+ if (this.debug) {
9366
+ var id = envSignals.deviceId;
9367
+ console.log("[AD-IDENTITY]", {
9368
+ source: envSignals.deviceIdSource,
9369
+ idtype: envSignals.deviceIdType,
9370
+ rdidTail: id ? id.slice(-4) : void 0,
9371
+ isLat: envSignals.limitAdTracking,
9372
+ dth: envSignals.deviceTypeHint,
9373
+ sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
9374
+ ct_ch: content.channelName,
9375
+ ct_ti: content.programTitle,
9376
+ ct_ne: content.contentNetwork
9377
+ });
9378
+ }
8506
9379
  console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
8507
9380
  return finalUrl;
8508
9381
  }
@@ -8554,7 +9427,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
8554
9427
  }
8555
9428
  },
8556
9429
  {
8557
- // --- Tracking ---
8558
9430
  key: "initializeTracking",
8559
9431
  value: function initializeTracking() {
8560
9432
  var _this = this;
@@ -8646,7 +9518,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8646
9518
  }
8647
9519
  },
8648
9520
  {
8649
- // --- Ad stop timer ---
8650
9521
  key: "scheduleAdStopCountdown",
8651
9522
  value: function scheduleAdStopCountdown(remainingMs) {
8652
9523
  var _this = this;
@@ -8678,7 +9549,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8678
9549
  }
8679
9550
  },
8680
9551
  {
8681
- // --- Ad start timer ---
8682
9552
  key: "scheduleAdStartIn",
8683
9553
  value: function scheduleAdStartIn(delayMs) {
8684
9554
  var _this = this;
@@ -8706,7 +9576,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8706
9576
  }
8707
9577
  },
8708
9578
  {
8709
- // --- PTS drift ---
8710
9579
  key: "updatePtsDrift",
8711
9580
  value: function updatePtsDrift(ptsSecondsSample) {
8712
9581
  var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
@@ -8732,7 +9601,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8732
9601
  }
8733
9602
  },
8734
9603
  {
8735
- // --- Duration boundary ---
8736
9604
  key: "beginBreakTiming",
8737
9605
  value: function beginBreakTiming(startWallClockMs) {
8738
9606
  this.currentAdBreakStartWallClockMs = startWallClockMs;
@@ -8780,7 +9648,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8780
9648
  }
8781
9649
  },
8782
9650
  {
8783
- // --- Duration budget ---
8784
9651
  key: "getWallClockRemainingAdMs",
8785
9652
  value: function getWallClockRemainingAdMs() {
8786
9653
  var endWallClockMs = this.getAdBreakEndWallClockMs();
@@ -8929,7 +9796,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8929
9796
  }
8930
9797
  },
8931
9798
  {
8932
- // --- Circuit breaker ---
8933
9799
  key: "isTemporaryAdError",
8934
9800
  value: function isTemporaryAdError(error) {
8935
9801
  var _error_message;
@@ -9063,7 +9929,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9063
9929
  }
9064
9930
  },
9065
9931
  {
9066
- // --- Watchdog ---
9067
9932
  key: "startAdRequestWatchdog",
9068
9933
  value: function startAdRequestWatchdog(token) {
9069
9934
  var _this = this;
@@ -9108,7 +9973,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9108
9973
  }
9109
9974
  },
9110
9975
  {
9111
- // --- Failsafe ---
9112
9976
  key: "startAdFailsafeTimer",
9113
9977
  value: function startAdFailsafeTimer(token) {
9114
9978
  var _this = this;
@@ -9170,7 +10034,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9170
10034
  }
9171
10035
  },
9172
10036
  {
9173
- // --- Reset for ad break end ---
9174
10037
  key: "resetForBreakEnd",
9175
10038
  value: function resetForBreakEnd() {
9176
10039
  this.clearAdStopTimer();
@@ -9369,7 +10232,7 @@ var HlsEngine = /*#__PURE__*/ function() {
9369
10232
  adBehavior: adBehavior
9370
10233
  });
9371
10234
  }
9372
- if (!this.config.autoplay) return [
10235
+ if (!(this.config.autoplay && !this.callbacks.shouldHoldContentForAds())) return [
9373
10236
  3,
9374
10237
  2
9375
10238
  ];
@@ -9560,6 +10423,12 @@ var HlsEngine = /*#__PURE__*/ function() {
9560
10423
  2
9561
10424
  ];
9562
10425
  this.hasInitialBufferCompleted = true;
10426
+ if (this.shouldAutoplayAfterBuffering && this.callbacks.shouldHoldContentForAds()) {
10427
+ this.shouldAutoplayAfterBuffering = false;
10428
+ if (this.debug) {
10429
+ console.log("[StormcloudVideoPlayer] Buffer ready during an ad break; content stays paused until the break ends");
10430
+ }
10431
+ }
9563
10432
  if (!this.shouldAutoplayAfterBuffering) return [
9564
10433
  3,
9565
10434
  2
@@ -10217,9 +11086,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10217
11086
  }
10218
11087
  },
10219
11088
  {
10220
- // ───────────────────────────────────────────────────────────────
10221
- // IMA event listeners
10222
- // ───────────────────────────────────────────────────────────────
10223
11089
  key: "nextAdRequestUrl",
10224
11090
  value: function nextAdRequestUrl(baseVastUrl) {
10225
11091
  return this.host.generatePodVastUrl(baseVastUrl);
@@ -10455,9 +11321,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10455
11321
  }
10456
11322
  },
10457
11323
  {
10458
- // ───────────────────────────────────────────────────────────────
10459
- // Ad break start
10460
- // ───────────────────────────────────────────────────────────────
10461
11324
  key: "isBreakActive",
10462
11325
  value: function isBreakActive() {
10463
11326
  return this.slotState !== "IDLE";
@@ -10485,7 +11348,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10485
11348
  key: "handleAdStart",
10486
11349
  value: function handleAdStart(marker) {
10487
11350
  return _async_to_generator(function() {
10488
- var baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
11351
+ var screenInactiveReason, baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
10489
11352
  return _ts_generator(this, function(_state) {
10490
11353
  switch(_state.label){
10491
11354
  case 0:
@@ -10498,6 +11361,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10498
11361
  2
10499
11362
  ];
10500
11363
  }
11364
+ screenInactiveReason = getScreenInactiveReason();
11365
+ if (screenInactiveReason) {
11366
+ this.logOrchestratorFunnel("break_skipped_screen_inactive", {
11367
+ reason: screenInactiveReason
11368
+ });
11369
+ this.clearPendingAdBreak();
11370
+ return [
11371
+ 2
11372
+ ];
11373
+ }
10501
11374
  baseVastUrl = this.adConfig.apiVastTagUrl;
10502
11375
  edgeConfigured = !!this.host.getEdgePodBaseUrl();
10503
11376
  if (!baseVastUrl && !edgeConfigured) {
@@ -10658,12 +11531,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10658
11531
  },
10659
11532
  {
10660
11533
  key: "startOptimizedPod",
10661
- value: // ───────────────────────────────────────────────────────────────
10662
- // Optimized pod (single multi-ad request)
10663
- // ───────────────────────────────────────────────────────────────
10664
- function startOptimizedPod(baseVastUrl) {
11534
+ value: function startOptimizedPod(baseVastUrl) {
10665
11535
  return _async_to_generator(function() {
10666
- var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, error;
11536
+ var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, _this_host_config_maxAdBreakExtensionMs, remainingMs, overrunAllowanceMs, maxAdsCap, maxAds, error;
10667
11537
  return _ts_generator(this, function(_state) {
10668
11538
  switch(_state.label){
10669
11539
  case 0:
@@ -10771,6 +11641,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10771
11641
  false
10772
11642
  ];
10773
11643
  }
11644
+ if (this.isBreakTimeBounded() && adPlayer.limitPodToBudget) {
11645
+ ;
11646
+ remainingMs = this.timing.getRemainingAdMs();
11647
+ overrunAllowanceMs = Math.max(0, (_this_host_config_maxAdBreakExtensionMs = this.host.config.maxAdBreakExtensionMs) !== null && _this_host_config_maxAdBreakExtensionMs !== void 0 ? _this_host_config_maxAdBreakExtensionMs : 0);
11648
+ maxAdsCap = this.adConfig.resolveAdPodConfig().maxAdsPerBreak;
11649
+ maxAds = maxAdsCap != null ? Math.max(1, maxAdsCap - this.timing.totalAdsInBreak) : Number.MAX_SAFE_INTEGER;
11650
+ if (Number.isFinite(remainingMs)) {
11651
+ podCount = adPlayer.limitPodToBudget(remainingMs + overrunAllowanceMs, maxAds);
11652
+ if (podCount < 1) {
11653
+ if (this.timing.activeAdRequestToken === requestToken) {
11654
+ this.timing.activeAdRequestToken = null;
11655
+ }
11656
+ this.recordRequestFailure(new Error("No GAM ad fits the ".concat(Math.round(remainingMs), "ms left in the break")), podUrl);
11657
+ return [
11658
+ 2,
11659
+ false
11660
+ ];
11661
+ }
11662
+ }
11663
+ }
10774
11664
  this.setSlotState("READY", "vast_ready");
10775
11665
  if (this.debug) {
10776
11666
  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"));
@@ -10840,9 +11730,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10840
11730
  }
10841
11731
  },
10842
11732
  {
10843
- // ───────────────────────────────────────────────────────────────
10844
- // Edge-first pods (live SCTE-35 only, GAM fallback)
10845
- // ───────────────────────────────────────────────────────────────
10846
11733
  key: "resetEdgeStateForBreak",
10847
11734
  value: function resetEdgeStateForBreak() {
10848
11735
  this.edgeExhaustedForBreak = false;
@@ -11060,9 +11947,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11060
11947
  }
11061
11948
  },
11062
11949
  {
11063
- // ───────────────────────────────────────────────────────────────
11064
- // Next-ad scheduling (single flight)
11065
- // ───────────────────────────────────────────────────────────────
11066
11950
  key: "setSlotState",
11067
11951
  value: function setSlotState(next, reason) {
11068
11952
  if (this.slotState === next) return;
@@ -11112,6 +11996,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11112
11996
  {
11113
11997
  key: "getStopRequestingReason",
11114
11998
  value: function getStopRequestingReason(remainingMs) {
11999
+ var screenInactiveReason = getScreenInactiveReason();
12000
+ if (screenInactiveReason) return "screen_inactive:".concat(screenInactiveReason);
11115
12001
  if (this.breakSource === "vmap") {
11116
12002
  if (this.adPodQueue.length === 0) return "vmap_queue_empty";
11117
12003
  } else if (this.breakSource !== "scte35" || !this.followUpBaseVastUrl && !this.canRequestEdge()) {
@@ -11385,9 +12271,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11385
12271
  }
11386
12272
  },
11387
12273
  {
11388
- // ───────────────────────────────────────────────────────────────
11389
- // Per-request diagnostics
11390
- // ───────────────────────────────────────────────────────────────
11391
12274
  key: "recordRequestDiagnostic",
11392
12275
  value: function recordRequestDiagnostic(payload) {
11393
12276
  var requestId = payload.requestId;
@@ -11461,9 +12344,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11461
12344
  }
11462
12345
  },
11463
12346
  {
11464
- // ───────────────────────────────────────────────────────────────
11465
- // Single ad playback
11466
- // ───────────────────────────────────────────────────────────────
11467
12347
  key: "createGamDispatchFinalizer",
11468
12348
  value: function createGamDispatchFinalizer(requestToken) {
11469
12349
  var _this = this;
@@ -11926,9 +12806,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11926
12806
  }
11927
12807
  },
11928
12808
  {
11929
- // ───────────────────────────────────────────────────────────────
11930
- // Ad break completion
11931
- // ───────────────────────────────────────────────────────────────
11932
12809
  key: "logBreakFunnel",
11933
12810
  value: function logBreakFunnel(endReason) {
11934
12811
  var funnel = this.breakFunnel;
@@ -12574,6 +13451,8 @@ var ContentHealthWatchdog = /*#__PURE__*/ function() {
12574
13451
  return ContentHealthWatchdog;
12575
13452
  }();
12576
13453
  // src/player/StormcloudVideoPlayer.ts
13454
+ var DEFAULT_PAL_NONCE_MAX_AGE_MS = 5.5 * 60 * 60 * 1e3;
13455
+ var PAL_NONCE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12577
13456
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12578
13457
  function StormcloudVideoPlayer(config) {
12579
13458
  var _this = this;
@@ -12584,6 +13463,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12584
13463
  var browserOverrides = getBrowserConfigOverrides();
12585
13464
  this.config = _object_spread({}, browserOverrides, config);
12586
13465
  this.video = config.videoElement;
13466
+ if (this.config.forceSingleDecoderMode != null) {
13467
+ setSingleDecoderOverride(this.config.forceSingleDecoderMode);
13468
+ }
13469
+ if (this.config.adDeviceId) {
13470
+ setHostAdIdentity({
13471
+ deviceId: this.config.adDeviceId,
13472
+ deviceIdType: this.config.adDeviceIdType,
13473
+ limitAdTracking: this.config.adLimitAdTracking
13474
+ });
13475
+ }
13476
+ if (this.config.deviceInfo) {
13477
+ setHostDeviceInfo(this.config.deviceInfo);
13478
+ }
12587
13479
  logBrowserInfo(config.debugAdTiming);
12588
13480
  this.floorLadder = new FloorLadderController();
12589
13481
  this.adPlayer = this.createAdPlayer(false);
@@ -12647,6 +13539,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12647
13539
  },
12648
13540
  hasPendingAdBreak: function hasPendingAdBreak() {
12649
13541
  return _this.adBreak.pendingAdBreak !== null;
13542
+ },
13543
+ shouldHoldContentForAds: function shouldHoldContentForAds() {
13544
+ return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
12650
13545
  }
12651
13546
  });
12652
13547
  this.adBreak = new AdBreakOrchestrator({
@@ -12842,10 +13737,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12842
13737
  },
12843
13738
  {
12844
13739
  key: "load",
12845
- value: // ───────────────────────────────────────────────────────────────
12846
- // Lifecycle
12847
- // ───────────────────────────────────────────────────────────────
12848
- function load() {
13740
+ value: function load() {
12849
13741
  return _async_to_generator(function() {
12850
13742
  var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
12851
13743
  return _ts_generator(this, function(_state) {
@@ -12855,6 +13747,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12855
13747
  if (!this.attached) {
12856
13748
  this.attach();
12857
13749
  }
13750
+ primeDeviceInfo().then(function(info) {
13751
+ if (_this.debug) {
13752
+ console.log("[DEVICE-INFO]", _object_spread_props(_object_spread({}, info), {
13753
+ internalDeviceId: info.internalDeviceId ? "...".concat(info.internalDeviceId.slice(-4)) : void 0
13754
+ }));
13755
+ }
13756
+ }).catch(function() {});
12858
13757
  _state.label = 1;
12859
13758
  case 1:
12860
13759
  _state.trys.push([
@@ -12889,21 +13788,30 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12889
13788
  fetchConsentSignals().catch(function() {
12890
13789
  return {};
12891
13790
  }).then(function(signals) {
12892
- var _this_config_lowLatencyMode;
13791
+ var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
12893
13792
  _this.adConfig.consentSignals = signals;
12894
13793
  var muted = _this.video.muted;
12895
- return _this.palNonce.generateNonce(_object_spread({
13794
+ var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
13795
+ var palOptions = _object_spread({
12896
13796
  videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
12897
13797
  videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
12898
13798
  adWillAutoPlay: !!_this.config.autoplay,
12899
13799
  adWillPlayMuted: muted,
12900
13800
  playerVolume: muted ? 0 : _this.video.volume,
12901
- continuousPlayback: (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
13801
+ 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,
13802
+ iconsSupported: (_this_config_palIconsSupported = _this.config.palIconsSupported) !== null && _this_config_palIconsSupported !== void 0 ? _this_config_palIconsSupported : false,
13803
+ supportedApiFrameworks: (_this_config_palSupportedApiFrameworks = _this.config.palSupportedApiFrameworks) !== null && _this_config_palSupportedApiFrameworks !== void 0 ? _this_config_palSupportedApiFrameworks : ""
12902
13804
  }, palDescriptionUrl ? {
12903
13805
  descriptionUrl: palDescriptionUrl
12904
13806
  } : {}, signals.storageAllowed != null ? {
12905
13807
  allowStorage: signals.storageAllowed
12906
- } : {}));
13808
+ } : {}, palSessionId ? {
13809
+ sessionId: palSessionId
13810
+ } : {});
13811
+ _this.lastPalOptions = palOptions;
13812
+ _this.palSessionId = palSessionId;
13813
+ _this.startPalNonceRefresh();
13814
+ return _this.palNonce.generateNonce(palOptions);
12907
13815
  }).catch(function() {});
12908
13816
  this.adConfig.initializeTracking();
12909
13817
  if (!this.hlsEngine.shouldUseNativeHls(function() {
@@ -12941,6 +13849,92 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12941
13849
  }).call(this);
12942
13850
  }
12943
13851
  },
13852
+ {
13853
+ key: "startPalNonceRefresh",
13854
+ value: function startPalNonceRefresh() {
13855
+ var _this = this;
13856
+ if (this.palRefreshTimer != null || typeof window === "undefined") return;
13857
+ this.palRefreshTimer = window.setInterval(function() {
13858
+ return _this.refreshPalNonceIfStale();
13859
+ }, PAL_NONCE_CHECK_INTERVAL_MS);
13860
+ }
13861
+ },
13862
+ {
13863
+ key: "refreshPalNonceIfStale",
13864
+ value: function refreshPalNonceIfStale() {
13865
+ var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
13866
+ var _this_config_palNonceMaxAgeMs;
13867
+ var options = this.lastPalOptions;
13868
+ if (!options) return;
13869
+ var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
13870
+ var ageMs = this.palNonce.getNonceAgeMs();
13871
+ var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
13872
+ var sessionChanged = sessionId !== this.palSessionId;
13873
+ var stale = ageMs === void 0 || ageMs >= maxAgeMs;
13874
+ if (!force && !stale && !sessionChanged) return;
13875
+ var next = _object_spread({}, options);
13876
+ if (sessionId) next.sessionId = sessionId;
13877
+ else delete next.sessionId;
13878
+ this.lastPalOptions = next;
13879
+ this.palSessionId = sessionId;
13880
+ if (this.debug) {
13881
+ console.log("[PAL] Regenerating nonce", {
13882
+ force: force,
13883
+ stale: stale,
13884
+ sessionChanged: sessionChanged,
13885
+ ageMs: ageMs
13886
+ });
13887
+ }
13888
+ this.palNonce.generateNonce(next).catch(function() {});
13889
+ }
13890
+ },
13891
+ {
13892
+ key: "setAdIdentity",
13893
+ value: function setAdIdentity(identity) {
13894
+ setHostAdIdentity(identity);
13895
+ this.refreshPalNonceIfStale();
13896
+ }
13897
+ },
13898
+ {
13899
+ key: "resetAdIdentity",
13900
+ value: function resetAdIdentity1() {
13901
+ resetAdIdentity();
13902
+ this.refreshPalNonceIfStale(true);
13903
+ }
13904
+ },
13905
+ {
13906
+ key: "setContentMetadata",
13907
+ value: function setContentMetadata(meta) {
13908
+ var _this = this;
13909
+ var apply = function apply(key, value) {
13910
+ if (value === void 0) return;
13911
+ var clean = value === null ? void 0 : sanitizeContentValue(value);
13912
+ if (clean) _this.config[key] = clean;
13913
+ else delete _this.config[key];
13914
+ };
13915
+ apply("channelName", meta.channelName);
13916
+ apply("programTitle", meta.programTitle);
13917
+ apply("contentNetwork", meta.contentNetwork);
13918
+ }
13919
+ },
13920
+ {
13921
+ key: "setScreenStandby",
13922
+ value: function setScreenStandby(standby) {
13923
+ setHostStandby(standby);
13924
+ }
13925
+ },
13926
+ {
13927
+ key: "getDeviceInfo",
13928
+ value: function getDeviceInfo1() {
13929
+ return getDeviceInfo();
13930
+ }
13931
+ },
13932
+ {
13933
+ key: "setDeviceInfo",
13934
+ value: function setDeviceInfo(info) {
13935
+ setHostDeviceInfo(info);
13936
+ }
13937
+ },
12944
13938
  {
12945
13939
  key: "onManifestParsed",
12946
13940
  value: function onManifestParsed(isLive) {
@@ -13075,9 +14069,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13075
14069
  }
13076
14070
  },
13077
14071
  {
13078
- // ───────────────────────────────────────────────────────────────
13079
- // SCTE-35 marker orchestration
13080
- // ───────────────────────────────────────────────────────────────
13081
14072
  key: "onScte35Marker",
13082
14073
  value: function onScte35Marker(marker, cueKey) {
13083
14074
  if (this.debug) {
@@ -13256,9 +14247,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13256
14247
  }
13257
14248
  },
13258
14249
  {
13259
- // ───────────────────────────────────────────────────────────────
13260
- // Ad prefetch
13261
- // ───────────────────────────────────────────────────────────────
13262
14250
  key: "startAdPrefetch",
13263
14251
  value: function startAdPrefetch(marker, fragmentSn, cueKey) {
13264
14252
  if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
@@ -13297,9 +14285,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13297
14285
  }
13298
14286
  },
13299
14287
  {
13300
- // ───────────────────────────────────────────────────────────────
13301
- // VMAP time-based ad breaks
13302
- // ───────────────────────────────────────────────────────────────
13303
14288
  key: "onTimeUpdate",
13304
14289
  value: function onTimeUpdate(currentTimeSec) {
13305
14290
  var _this = this;
@@ -13413,9 +14398,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13413
14398
  }
13414
14399
  },
13415
14400
  {
13416
- // ───────────────────────────────────────────────────────────────
13417
- // Public API
13418
- // ───────────────────────────────────────────────────────────────
13419
14401
  key: "getCurrentAdIndex",
13420
14402
  value: function getCurrentAdIndex() {
13421
14403
  return this.timing.currentAdIndex;
@@ -13534,12 +14516,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13534
14516
  }
13535
14517
  },
13536
14518
  {
13537
- // ───────────────────────────────────────────────────────────────
13538
- // Destroy
13539
- // ───────────────────────────────────────────────────────────────
13540
14519
  key: "destroy",
13541
14520
  value: function destroy() {
13542
14521
  var _this_adPlayer;
14522
+ if (this.palRefreshTimer != null) {
14523
+ clearInterval(this.palRefreshTimer);
14524
+ this.palRefreshTimer = void 0;
14525
+ }
13543
14526
  this.contentWatchdog.stop();
13544
14527
  this.adBreak.cancelScheduledRequest();
13545
14528
  this.timing.destroy();