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.
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 +1138 -159
  6. package/lib/StormcloudPlayer.cjs.map +1 -1
  7. package/lib/StormcloudPlayer.d.cts +2 -0
  8. package/lib/index.cjs +1201 -161
  9. package/lib/index.cjs.map +1 -1
  10. package/lib/index.d.cts +2 -0
  11. package/lib/index.d.ts +63 -2
  12. package/lib/index.js +1201 -161
  13. package/lib/index.js.map +1 -1
  14. package/lib/player/AdBreakOrchestrator.cjs +419 -83
  15. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  16. package/lib/player/AdConfigManager.cjs +735 -93
  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 +1138 -159
  29. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  30. package/lib/player/StormcloudVideoPlayer.d.cts +18 -1
  31. package/lib/players/HlsPlayer.cjs +1138 -159
  32. package/lib/players/HlsPlayer.cjs.map +1 -1
  33. package/lib/players/index.cjs +1138 -159
  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 +23 -1
  44. package/lib/ui/StormcloudVideoPlayer.cjs +1201 -161
  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 +386 -56
  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
@@ -445,8 +445,264 @@ var canPlay = {
445
445
  };
446
446
  // src/players/HlsPlayer.tsx
447
447
  var import_react2 = require("react");
448
+ // src/utils/adIdentity.ts
449
+ var GOOGLE_ID_TYPES = [
450
+ "aaid",
451
+ "adid",
452
+ "afai",
453
+ "idfa",
454
+ "lgudid",
455
+ "msai",
456
+ "rida",
457
+ "tifa",
458
+ "tvOS",
459
+ "vaid",
460
+ "vida",
461
+ "dpid"
462
+ ];
463
+ var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
464
+ var DEFAULT_SESSION_ID_MAX_AGE_MS = MAX_SESSION_ID_AGE_MS;
465
+ var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
466
+ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
467
+ var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
468
+ var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
469
+ var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
470
+ var ZEROED_IDS = /* @__PURE__ */ new Set([
471
+ "00000000-0000-0000-0000-000000000000",
472
+ "38400000-8cf0-11bd-b23e-10b96e40000d"
473
+ ]);
474
+ var hostIdentity;
475
+ var memoryStore = {};
476
+ var lgUdidResult;
477
+ var lgUdidPromise;
478
+ var legacyCleared = false;
479
+ function isUsableAdId(value) {
480
+ if (typeof value !== "string") return false;
481
+ var t = value.trim();
482
+ if (!t) return false;
483
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
484
+ if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
485
+ return !ZEROED_IDS.has(t.toLowerCase());
486
+ }
487
+ function isZeroedAdId(value) {
488
+ return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
489
+ }
490
+ function normalizeIdType(value) {
491
+ if (typeof value !== "string") return void 0;
492
+ var lower = value.trim().toLowerCase();
493
+ if (!lower) return void 0;
494
+ var match = GOOGLE_ID_TYPES.find(function(t) {
495
+ return t.toLowerCase() === lower;
496
+ });
497
+ return match !== null && match !== void 0 ? match : "dpid";
498
+ }
499
+ function createUuid() {
500
+ var _bytes_, _bytes_1, _bytes_i;
501
+ var c = typeof crypto !== "undefined" ? crypto : void 0;
502
+ if (c && typeof c.randomUUID === "function") return c.randomUUID();
503
+ var bytes = new Uint8Array(16);
504
+ if (c && typeof c.getRandomValues === "function") {
505
+ c.getRandomValues(bytes);
506
+ } else {
507
+ for(var i = 0; i < 16; i++)bytes[i] = Math.floor(Math.random() * 256);
508
+ }
509
+ bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
510
+ bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
511
+ var hex = "";
512
+ 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");
513
+ 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));
514
+ }
515
+ function readStored(key) {
516
+ try {
517
+ var _window_localStorage;
518
+ var raw = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
519
+ if (raw) {
520
+ var parsed = JSON.parse(raw);
521
+ if (parsed && typeof parsed.id === "string" && typeof parsed.createdAt === "number" && isFinite(parsed.createdAt)) {
522
+ return {
523
+ id: parsed.id,
524
+ createdAt: parsed.createdAt
525
+ };
526
+ }
527
+ }
528
+ } catch (unused) {}
529
+ return memoryStore[key];
530
+ }
531
+ function writeStored(key, value) {
532
+ memoryStore[key] = value;
533
+ try {
534
+ if (typeof window !== "undefined") {
535
+ var _window_localStorage;
536
+ (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(key, JSON.stringify(value));
537
+ }
538
+ } catch (unused) {}
539
+ }
540
+ function removeStored(key) {
541
+ delete memoryStore[key];
542
+ try {
543
+ var _window_localStorage;
544
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(key);
545
+ } catch (unused) {}
546
+ }
547
+ function clearLegacyIdsOnce() {
548
+ if (legacyCleared) return;
549
+ legacyCleared = true;
550
+ try {
551
+ var _window_localStorage;
552
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(LEGACY_SESSION_KEY);
553
+ } catch (unused) {}
554
+ try {
555
+ if (typeof document !== "undefined") {
556
+ document.cookie = "".concat(encodeURIComponent(LEGACY_SESSION_KEY), "=;path=/;max-age=0;SameSite=Lax");
557
+ }
558
+ } catch (unused) {}
559
+ }
560
+ function clampAge(value, fallback, max) {
561
+ var v = typeof value === "number" && isFinite(value) && value > 0 ? value : fallback;
562
+ if (max != null) v = Math.min(v, max);
563
+ return v;
564
+ }
565
+ function setHostAdIdentity(identity) {
566
+ var _normalizeIdType;
567
+ if (!identity || !isUsableAdId(identity.deviceId)) {
568
+ hostIdentity = void 0;
569
+ return;
570
+ }
571
+ var deviceId = identity.deviceId.trim();
572
+ var changed = !hostIdentity || hostIdentity.deviceId !== deviceId;
573
+ hostIdentity = _object_spread({
574
+ deviceId: deviceId,
575
+ deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
576
+ }, typeof identity.limitAdTracking === "boolean" ? {
577
+ limitAdTracking: identity.limitAdTracking
578
+ } : {});
579
+ if (changed) {
580
+ removeStored(SESSION_ID_KEY);
581
+ removeStored(FALLBACK_DEVICE_ID_KEY);
582
+ }
583
+ }
584
+ function getHostAdIdentity() {
585
+ return hostIdentity ? _object_spread({}, hostIdentity) : void 0;
586
+ }
587
+ function resetAdIdentity() {
588
+ removeStored(SESSION_ID_KEY);
589
+ removeStored(FALLBACK_DEVICE_ID_KEY);
590
+ }
591
+ function readSamsungTifa() {
592
+ try {
593
+ var _window_webapis;
594
+ var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
595
+ if (!adinfo) return void 0;
596
+ var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
597
+ var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
598
+ if (isZeroedAdId(tifa)) return {
599
+ deviceIdType: "tifa",
600
+ limitAdTracking: true
601
+ };
602
+ if (!isUsableAdId(tifa)) return void 0;
603
+ return _object_spread({
604
+ deviceId: tifa.trim(),
605
+ deviceIdType: "tifa"
606
+ }, typeof lat === "boolean" ? {
607
+ limitAdTracking: lat
608
+ } : {});
609
+ } catch (unused) {
610
+ return void 0;
611
+ }
612
+ }
613
+ function primeLgUdid() {
614
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_LGUDID_TIMEOUT_MS;
615
+ if (lgUdidResult || lgUdidPromise) return lgUdidPromise !== null && lgUdidPromise !== void 0 ? lgUdidPromise : Promise.resolve();
616
+ var dev = typeof window !== "undefined" ? window.webOSDev : void 0;
617
+ if (!dev) return Promise.resolve();
618
+ if (typeof dev.LGUDID !== "function") {
619
+ var _dev_lgudid;
620
+ var direct = (_dev_lgudid = dev.lgudid) !== null && _dev_lgudid !== void 0 ? _dev_lgudid : dev.LGUDID;
621
+ if (isZeroedAdId(direct)) lgUdidResult = {
622
+ deviceIdType: "lgudid",
623
+ limitAdTracking: true
624
+ };
625
+ else if (isUsableAdId(direct)) {
626
+ lgUdidResult = {
627
+ deviceId: direct.trim(),
628
+ deviceIdType: "lgudid",
629
+ limitAdTracking: false
630
+ };
631
+ }
632
+ return Promise.resolve();
633
+ }
634
+ lgUdidPromise = new Promise(function(resolve) {
635
+ var settled = false;
636
+ var finish = function finish() {
637
+ if (settled) return;
638
+ settled = true;
639
+ clearTimeout(timer);
640
+ resolve();
641
+ };
642
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
643
+ try {
644
+ dev.LGUDID({
645
+ onSuccess: function onSuccess(res) {
646
+ var id = res === null || res === void 0 ? void 0 : res.id;
647
+ if (isZeroedAdId(id)) {
648
+ lgUdidResult = {
649
+ deviceIdType: "lgudid",
650
+ limitAdTracking: true
651
+ };
652
+ } else if (isUsableAdId(id)) {
653
+ lgUdidResult = {
654
+ deviceId: id.trim(),
655
+ deviceIdType: "lgudid",
656
+ limitAdTracking: false
657
+ };
658
+ }
659
+ finish();
660
+ },
661
+ onFailure: function onFailure() {
662
+ return finish();
663
+ }
664
+ });
665
+ } catch (unused) {
666
+ finish();
667
+ }
668
+ });
669
+ return lgUdidPromise;
670
+ }
671
+ function readCachedLgUdid() {
672
+ return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
673
+ }
674
+ function getOrRotateFallbackDeviceId() {
675
+ 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();
676
+ clearLegacyIdsOnce();
677
+ var age = clampAge(maxAgeMs, DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS);
678
+ var stored = readStored(FALLBACK_DEVICE_ID_KEY);
679
+ if (stored && isUsableAdId(stored.id) && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
680
+ return stored.id;
681
+ }
682
+ var id = createUuid();
683
+ writeStored(FALLBACK_DEVICE_ID_KEY, {
684
+ id: id,
685
+ createdAt: now
686
+ });
687
+ return id;
688
+ }
689
+ function getOrRotateSessionId() {
690
+ 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();
691
+ clearLegacyIdsOnce();
692
+ var age = clampAge(maxAgeMs, DEFAULT_SESSION_ID_MAX_AGE_MS, MAX_SESSION_ID_AGE_MS);
693
+ var stored = readStored(SESSION_ID_KEY);
694
+ if (stored && isUsableAdId(stored.id) && stored.id !== avoidValue && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
695
+ return stored.id;
696
+ }
697
+ var id = createUuid();
698
+ while(id === avoidValue)id = createUuid();
699
+ writeStored(SESSION_ID_KEY, {
700
+ id: id,
701
+ createdAt: now
702
+ });
703
+ return id;
704
+ }
448
705
  // src/utils/vastEnvironmentSignals.ts
449
- var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
450
706
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
451
707
  var DEVICE_ID_STORAGE_KEYS = [
452
708
  "rdid",
@@ -465,49 +721,96 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
465
721
  "adid"
466
722
  ]);
467
723
  function resolveVastEnvironmentSignals(isCtv) {
468
- var bridgeSignals = readNativeBridgeSignals();
469
- var platformDevice = readPlatformNativeDeviceId();
470
- var bridgeDeviceId = validDeviceId(bridgeSignals.deviceId);
471
- var realDeviceId = bridgeDeviceId || (isCtv ? validDeviceId(readStoredDeviceId()) : void 0) || validDeviceId(platformDevice.deviceId);
472
- var deviceId = realDeviceId;
473
- var deviceIdType = (bridgeDeviceId ? bridgeSignals.deviceIdType : void 0) || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
474
- var platformLat = bridgeDeviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
475
- var limitAdTracking = deviceId != null ? platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking() : void 0;
476
- if (!deviceId && isCtv) {
477
- var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
478
- if (dpid) {
479
- deviceId = dpid;
480
- deviceIdType = "dpid";
481
- limitAdTracking = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking();
482
- }
483
- }
724
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
484
725
  var deviceTypeHint = resolveDeviceTypeHint(isCtv);
726
+ var identity = resolveDeviceIdentity(isCtv, options);
727
+ var identityFields = _object_spread({}, identity.deviceId ? {
728
+ deviceId: identity.deviceId
729
+ } : {}, identity.deviceId && identity.deviceIdType ? {
730
+ deviceIdType: identity.deviceIdType
731
+ } : {}, identity.deviceId && identity.limitAdTracking != null ? {
732
+ limitAdTracking: identity.limitAdTracking
733
+ } : {}, identity.source ? {
734
+ deviceIdSource: identity.source
735
+ } : {});
485
736
  if (isCtv) {
486
737
  return _object_spread_props(_object_spread({
487
738
  isCtv: true,
488
- sessionId: getOrCreateCtvSessionId()
489
- }, deviceId ? {
490
- deviceId: deviceId
491
- } : {}, deviceId && deviceIdType ? {
492
- deviceIdType: deviceIdType
493
- } : {}, deviceId && limitAdTracking != null ? {
494
- limitAdTracking: limitAdTracking
495
- } : {}), {
739
+ sessionId: getOrRotateSessionId(options.sessionIdMaxAgeMs, identity.deviceId)
740
+ }, identityFields), {
496
741
  deviceTypeHint: deviceTypeHint
497
742
  });
498
743
  }
499
744
  return _object_spread_props(_object_spread({
500
745
  isCtv: false
501
- }, deviceId ? {
502
- deviceId: deviceId
503
- } : {}, deviceId && deviceIdType ? {
504
- deviceIdType: deviceIdType
505
- } : {}, deviceId && limitAdTracking != null ? {
506
- limitAdTracking: limitAdTracking
507
- } : {}), {
746
+ }, identityFields), {
508
747
  deviceTypeHint: deviceTypeHint
509
748
  });
510
749
  }
750
+ function resolveDeviceIdentity(isCtv, options) {
751
+ var _platform_limitAdTracking;
752
+ var host = getHostAdIdentity();
753
+ if (host) {
754
+ var _host_deviceIdType;
755
+ return _object_spread_props(_object_spread({
756
+ deviceId: host.deviceId,
757
+ deviceIdType: (_host_deviceIdType = host.deviceIdType) !== null && _host_deviceIdType !== void 0 ? _host_deviceIdType : "dpid"
758
+ }, host.limitAdTracking != null ? {
759
+ limitAdTracking: host.limitAdTracking
760
+ } : {}), {
761
+ source: "host"
762
+ });
763
+ }
764
+ var bridge = readNativeBridgeSignals();
765
+ var bridgeDeviceId = validDeviceId(bridge.deviceId);
766
+ if (bridgeDeviceId) {
767
+ var _normalizeIdType;
768
+ return _object_spread_props(_object_spread({
769
+ deviceId: bridgeDeviceId,
770
+ deviceIdType: (_normalizeIdType = normalizeIdType(bridge.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
771
+ }, bridge.limitAdTracking != null ? {
772
+ limitAdTracking: bridge.limitAdTracking
773
+ } : {}), {
774
+ source: "bridge"
775
+ });
776
+ }
777
+ var platform = readPlatformNativeDeviceId();
778
+ var platformDeviceId = validDeviceId(platform.deviceId);
779
+ if (platformDeviceId) {
780
+ var _platform_deviceIdType;
781
+ return _object_spread_props(_object_spread({
782
+ deviceId: platformDeviceId,
783
+ deviceIdType: (_platform_deviceIdType = platform.deviceIdType) !== null && _platform_deviceIdType !== void 0 ? _platform_deviceIdType : "dpid"
784
+ }, platform.limitAdTracking != null ? {
785
+ limitAdTracking: platform.limitAdTracking
786
+ } : {}), {
787
+ source: "platform"
788
+ });
789
+ }
790
+ if (!isCtv) return {};
791
+ var storedDeviceId = validDeviceId(readStoredDeviceId());
792
+ if (storedDeviceId) {
793
+ var _normalizeIdType1;
794
+ var storedLat = readStoredLimitAdTracking();
795
+ return _object_spread_props(_object_spread({
796
+ deviceId: storedDeviceId,
797
+ deviceIdType: (_normalizeIdType1 = normalizeIdType(readStoredString("deviceIdType") || readStoredString("idtype"))) !== null && _normalizeIdType1 !== void 0 ? _normalizeIdType1 : "dpid"
798
+ }, storedLat != null ? {
799
+ limitAdTracking: storedLat
800
+ } : {}), {
801
+ source: "stored"
802
+ });
803
+ }
804
+ var fallbackLat = (_platform_limitAdTracking = platform.limitAdTracking) !== null && _platform_limitAdTracking !== void 0 ? _platform_limitAdTracking : readStoredLimitAdTracking();
805
+ return _object_spread_props(_object_spread({
806
+ deviceId: getOrRotateFallbackDeviceId(options.fallbackDeviceIdMaxAgeMs),
807
+ deviceIdType: "dpid"
808
+ }, fallbackLat != null ? {
809
+ limitAdTracking: fallbackLat
810
+ } : {}), {
811
+ source: "generated"
812
+ });
813
+ }
511
814
  var DEVICE_TYPE_HINT = {
512
815
  FEATURE_PHONE: 1,
513
816
  SMARTPHONE: 2,
@@ -668,7 +971,7 @@ function resolveNativeDeviceId() {
668
971
  var bridgeSignals = readNativeBridgeSignals();
669
972
  var platformDevice = readPlatformNativeDeviceId();
670
973
  var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
671
- if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
974
+ if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
672
975
  return void 0;
673
976
  }
674
977
  return deviceId;
@@ -682,20 +985,10 @@ function getOrCreateStoredUuid(storageKey) {
682
985
  writePersistentId(storageKey, existing);
683
986
  return existing;
684
987
  }
685
- var id = createUuid();
988
+ var id = createUuid2();
686
989
  writePersistentId(storageKey, id);
687
990
  return id;
688
991
  }
689
- function getOrCreateCtvSessionId() {
690
- var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
691
- if (existing) {
692
- writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
693
- return existing;
694
- }
695
- var sessionId = createUuid();
696
- writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
697
- return sessionId;
698
- }
699
992
  function readPersistentId(storageKey) {
700
993
  return readStoredString(storageKey) || readCookie(storageKey);
701
994
  }
@@ -748,7 +1041,7 @@ function writeCookie(name, value) {
748
1041
  document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
749
1042
  } catch (unused) {}
750
1043
  }
751
- function createUuid() {
1044
+ function createUuid2() {
752
1045
  var _bytes_, _bytes_1;
753
1046
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
754
1047
  return crypto.randomUUID();
@@ -782,44 +1075,10 @@ function performanceNow() {
782
1075
  }
783
1076
  function readPlatformNativeDeviceId() {
784
1077
  if (typeof window === "undefined") return {};
785
- try {
786
- var _window_webapis;
787
- var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
788
- if (adinfo) {
789
- var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
790
- if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
791
- var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
792
- return _object_spread({
793
- deviceId: tifa,
794
- deviceIdType: "tifa"
795
- }, typeof lat === "boolean" ? {
796
- limitAdTracking: lat
797
- } : {});
798
- }
799
- }
800
- } catch (unused) {}
801
- try {
802
- var webOSDev = window.webOSDev;
803
- if (webOSDev) {
804
- var _webOSDev_lgudid;
805
- var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
806
- if (typeof lgudid === "string" && lgudid) {
807
- if (isZeroedAdId(lgudid)) {
808
- return {
809
- deviceIdType: "lgudid",
810
- limitAdTracking: true
811
- };
812
- }
813
- if (!isMacroPlaceholder(lgudid)) {
814
- return {
815
- deviceId: lgudid,
816
- deviceIdType: "lgudid",
817
- limitAdTracking: false
818
- };
819
- }
820
- }
821
- }
822
- } catch (unused) {}
1078
+ var tifa = readSamsungTifa();
1079
+ if (tifa) return tifa;
1080
+ var lgudid = readCachedLgUdid();
1081
+ if (lgudid) return lgudid;
823
1082
  try {
824
1083
  var roku = window.Roku;
825
1084
  if (roku) {
@@ -846,7 +1105,7 @@ function isMacroPlaceholder(value) {
846
1105
  function validDeviceId(value) {
847
1106
  return value && !isMacroPlaceholder(value) ? value : void 0;
848
1107
  }
849
- function isZeroedAdId(value) {
1108
+ function isZeroedAdId2(value) {
850
1109
  return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
851
1110
  }
852
1111
  function readNativeBridgeSignals() {
@@ -890,7 +1149,7 @@ function readNativeBridgeSignals() {
890
1149
  "deviceIdType",
891
1150
  "advertisingIdType",
892
1151
  "idType"
893
- ]) || inferDeviceIdType();
1152
+ ]) || void 0;
894
1153
  var limitAdTracking = readBridgeBoolean(source, [
895
1154
  "is_lat",
896
1155
  "limitAdTracking",
@@ -1438,6 +1697,7 @@ function resolveScvpMacroValues(ctx) {
1438
1697
  set("GIVN", ctx.palNonce);
1439
1698
  set("CT-TI", ctx.programTitle);
1440
1699
  set("CT-CH", ctx.channelName);
1700
+ set("CT-NE", ctx.contentNetwork);
1441
1701
  set("POD", ctx.pod);
1442
1702
  set("CORRELATOR", ctx.correlator);
1443
1703
  set("SCOR", ctx.streamCorrelator);
@@ -1666,6 +1926,9 @@ function applyVastMacros(baseUrl, ctx) {
1666
1926
  if (ctx.channelName) {
1667
1927
  params.set("ct_ch", ctx.channelName);
1668
1928
  }
1929
+ if (ctx.contentNetwork) {
1930
+ params.set("ct_ne", ctx.contentNetwork);
1931
+ }
1669
1932
  var staleKeys = [];
1670
1933
  params.forEach(function(value, key) {
1671
1934
  if (isMacroPlaceholder2(value)) {
@@ -2330,8 +2593,17 @@ function detectBrowser() {
2330
2593
  chromeVersion: chromeVersionNum
2331
2594
  };
2332
2595
  }
2596
+ var singleDecoderOverride;
2597
+ function setSingleDecoderOverride(value) {
2598
+ singleDecoderOverride = value;
2599
+ }
2333
2600
  function requiresMediaPipelineResetAfterAds() {
2334
2601
  var _browser_tizenVersion;
2602
+ if (singleDecoderOverride != null) return singleDecoderOverride;
2603
+ try {
2604
+ var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
2605
+ if (typeof globalOverride === "boolean") return globalOverride;
2606
+ } catch (unused) {}
2335
2607
  var browser = detectBrowser();
2336
2608
  return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
2337
2609
  }
@@ -2491,7 +2763,7 @@ function substituteVastTrackingMacros(url) {
2491
2763
  });
2492
2764
  }
2493
2765
  // src/player/OptimizedPodRequest.ts
2494
- var DEFAULT_REQUEST_SAFETY_MS = 1500;
2766
+ var DEFAULT_REQUEST_SAFETY_MS = 2500;
2495
2767
  var GAM_AD_OPPORTUNITY_DURATION_MS = 3e4;
2496
2768
  var POD_PARAM_KEYS = [
2497
2769
  "pmnd",
@@ -2915,6 +3187,9 @@ function createHlsAdPlayer(contentVideo, options) {
2915
3187
  var mediaCandidateIndex = 0;
2916
3188
  var mediaStartTimerId;
2917
3189
  var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
3190
+ var MAX_MEDIA_START_ATTEMPTS = 2;
3191
+ var MEDIA_START_TOTAL_BUDGET_MS = Math.max(MEDIA_START_TIMEOUT_MS, 1e4);
3192
+ var mediaStartBudgetStartedAt = 0;
2918
3193
  var VAST_ERROR_MEDIA_TIMEOUT = 402;
2919
3194
  var pendingVastRequests = /* @__PURE__ */ new Set();
2920
3195
  var pendingRequestAbortReason;
@@ -4929,12 +5204,14 @@ function createHlsAdPlayer(contentVideo, options) {
4929
5204
  clearMediaStartTimer();
4930
5205
  if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
4931
5206
  var startedAt = Date.now();
5207
+ var budgetLeftMs = mediaStartBudgetStartedAt > 0 ? MEDIA_START_TOTAL_BUDGET_MS - (startedAt - mediaStartBudgetStartedAt) : MEDIA_START_TIMEOUT_MS;
5208
+ var timeoutMs = Math.max(1e3, Math.min(MEDIA_START_TIMEOUT_MS, budgetLeftMs));
4932
5209
  mediaStartTimerId = setTimeout(function() {
4933
5210
  mediaStartTimerId = void 0;
4934
5211
  if (!adPlaying || trackingFired.impression) return;
4935
- console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(MEDIA_START_TIMEOUT_MS, "ms"));
5212
+ console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(timeoutMs, "ms"));
4936
5213
  logFunnel("play_resolved_but_never_started", {
4937
- timeoutMs: MEDIA_START_TIMEOUT_MS,
5214
+ timeoutMs: timeoutMs,
4938
5215
  elapsedMs: Date.now() - startedAt,
4939
5216
  readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
4940
5217
  networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
@@ -4943,7 +5220,7 @@ function createHlsAdPlayer(contentVideo, options) {
4943
5220
  vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
4944
5221
  });
4945
5222
  recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
4946
- }, MEDIA_START_TIMEOUT_MS);
5223
+ }, timeoutMs);
4947
5224
  }
4948
5225
  function resetVideoElementForNextSource() {
4949
5226
  clearStallWatchdog();
@@ -4958,6 +5235,20 @@ function createHlsAdPlayer(contentVideo, options) {
4958
5235
  function tryNextMediaCandidate() {
4959
5236
  if (!currentAd || trackingFired.impression) return false;
4960
5237
  if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
5238
+ if (mediaCandidateIndex + 1 >= MAX_MEDIA_START_ATTEMPTS) {
5239
+ logFunnel("media_fallback_capped", {
5240
+ reason: "max_attempts",
5241
+ attempts: mediaCandidateIndex + 1
5242
+ });
5243
+ return false;
5244
+ }
5245
+ if (mediaStartBudgetStartedAt > 0 && Date.now() - mediaStartBudgetStartedAt >= MEDIA_START_TOTAL_BUDGET_MS) {
5246
+ logFunnel("media_fallback_capped", {
5247
+ reason: "time_budget",
5248
+ elapsedMs: Date.now() - mediaStartBudgetStartedAt
5249
+ });
5250
+ return false;
5251
+ }
4961
5252
  var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
4962
5253
  mediaCandidateIndex++;
4963
5254
  var next = mediaCandidates[mediaCandidateIndex];
@@ -4991,6 +5282,7 @@ function createHlsAdPlayer(contentVideo, options) {
4991
5282
  }
4992
5283
  mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
4993
5284
  mediaCandidateIndex = 0;
5285
+ mediaStartBudgetStartedAt = Date.now();
4994
5286
  var mediaFile = mediaCandidates[0];
4995
5287
  if (!mediaFile) {
4996
5288
  logFunnel("media_unsupported", {
@@ -5930,6 +6222,7 @@ function getOrCreateNonceLoader(allowStorage) {
5930
6222
  }
5931
6223
  function createPalNonceManager() {
5932
6224
  var currentNonce = "";
6225
+ var currentNonceCreatedAt = 0;
5933
6226
  var currentNonceManager;
5934
6227
  var pendingNonce;
5935
6228
  return {
@@ -5946,6 +6239,9 @@ function createPalNonceManager() {
5946
6239
  getCurrentNonce: function getCurrentNonce() {
5947
6240
  return currentNonce;
5948
6241
  },
6242
+ getNonceAgeMs: function getNonceAgeMs() {
6243
+ return currentNonce ? Date.now() - currentNonceCreatedAt : void 0;
6244
+ },
5949
6245
  waitForNonce: function waitForNonce(maxWaitMs) {
5950
6246
  if (currentNonce) return Promise.resolve(currentNonce);
5951
6247
  var pending = pendingNonce;
@@ -5998,13 +6294,14 @@ function createPalNonceManager() {
5998
6294
  },
5999
6295
  reset: function reset() {
6000
6296
  currentNonce = "";
6297
+ currentNonceCreatedAt = 0;
6001
6298
  currentNonceManager = void 0;
6002
6299
  pendingNonce = void 0;
6003
6300
  }
6004
6301
  };
6005
6302
  function generate(options) {
6006
6303
  return _async_to_generator(function() {
6007
- var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
6304
+ var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, _options_iconsSupported, _options_supportedApiFrameworks, loader, goog, request, apiFrameworks, manager, error;
6008
6305
  return _ts_generator(this, function(_state) {
6009
6306
  switch(_state.label){
6010
6307
  case 0:
@@ -6028,10 +6325,11 @@ function createPalNonceManager() {
6028
6325
  request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
6029
6326
  request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
6030
6327
  request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
6031
- request.iconsSupported = true;
6328
+ request.iconsSupported = (_options_iconsSupported = options.iconsSupported) !== null && _options_iconsSupported !== void 0 ? _options_iconsSupported : false;
6032
6329
  request.playerType = "StormcloudVideoPlayer";
6033
6330
  request.playerVersion = "1.0";
6034
- request.supportedApiFrameworks = "2,7,9";
6331
+ apiFrameworks = ((_options_supportedApiFrameworks = options.supportedApiFrameworks) !== null && _options_supportedApiFrameworks !== void 0 ? _options_supportedApiFrameworks : "").trim();
6332
+ if (apiFrameworks) request.supportedApiFrameworks = apiFrameworks;
6035
6333
  request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
6036
6334
  request.videoWidth = options.videoWidth || 640;
6037
6335
  request.videoHeight = options.videoHeight || 480;
@@ -6061,6 +6359,7 @@ function createPalNonceManager() {
6061
6359
  manager = _state.sent();
6062
6360
  currentNonceManager = manager;
6063
6361
  currentNonce = manager.getNonce();
6362
+ currentNonceCreatedAt = Date.now();
6064
6363
  console.log("[PAL] Nonce generated successfully");
6065
6364
  return [
6066
6365
  2,
@@ -6084,6 +6383,549 @@ function createPalNonceManager() {
6084
6383
  })();
6085
6384
  }
6086
6385
  }
6386
+ // src/utils/deviceInfo.ts
6387
+ var CATEGORY_CODES = {
6388
+ "LG TV": "lg_tv",
6389
+ "LG Set-Top Box": "lg_stb",
6390
+ "Samsung TV": "samsung_tv",
6391
+ Other: "other"
6392
+ };
6393
+ var DEVICE_CATEGORIES = [
6394
+ "LG TV",
6395
+ "LG Set-Top Box",
6396
+ "Samsung TV",
6397
+ "Other"
6398
+ ];
6399
+ var hostDeviceInfo;
6400
+ var lgDeviceInfo;
6401
+ var platformCache;
6402
+ var primePromise;
6403
+ function cleanString(value) {
6404
+ var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
6405
+ if (typeof value !== "string") return void 0;
6406
+ var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
6407
+ if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
6408
+ return t.length > maxLength ? t.slice(0, maxLength) : t;
6409
+ }
6410
+ function safeCall2(fn, thisArg) {
6411
+ if (typeof fn !== "function") return void 0;
6412
+ try {
6413
+ return fn.call(thisArg);
6414
+ } catch (unused) {
6415
+ return void 0;
6416
+ }
6417
+ }
6418
+ function userAgent() {
6419
+ return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
6420
+ }
6421
+ function bridgeSources() {
6422
+ if (typeof window === "undefined") return [];
6423
+ var w = window;
6424
+ return [
6425
+ w.__STORMCLOUD_CTV__,
6426
+ w.__STORMCLOUD_CTV_AD_INFO__,
6427
+ w.stormcloudCtv
6428
+ ].filter(Boolean);
6429
+ }
6430
+ function readBridge(keys) {
6431
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6432
+ try {
6433
+ for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6434
+ var source = _step.value;
6435
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6436
+ try {
6437
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6438
+ var key = _step1.value;
6439
+ var value = void 0;
6440
+ try {
6441
+ value = source === null || source === void 0 ? void 0 : source[key];
6442
+ if (typeof value === "function") value = value.call(source);
6443
+ } catch (unused) {
6444
+ value = void 0;
6445
+ }
6446
+ var clean = cleanString(value);
6447
+ if (clean) return clean;
6448
+ }
6449
+ } catch (err) {
6450
+ _didIteratorError1 = true;
6451
+ _iteratorError1 = err;
6452
+ } finally{
6453
+ try {
6454
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6455
+ _iterator1.return();
6456
+ }
6457
+ } finally{
6458
+ if (_didIteratorError1) {
6459
+ throw _iteratorError1;
6460
+ }
6461
+ }
6462
+ }
6463
+ }
6464
+ } catch (err) {
6465
+ _didIteratorError = true;
6466
+ _iteratorError = err;
6467
+ } finally{
6468
+ try {
6469
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6470
+ _iterator.return();
6471
+ }
6472
+ } finally{
6473
+ if (_didIteratorError) {
6474
+ throw _iteratorError;
6475
+ }
6476
+ }
6477
+ }
6478
+ return void 0;
6479
+ }
6480
+ function normalizeCategory(value) {
6481
+ var v = cleanString(value);
6482
+ if (!v) return void 0;
6483
+ var exact = DEVICE_CATEGORIES.find(function(c) {
6484
+ return c.toLowerCase() === v.toLowerCase();
6485
+ });
6486
+ if (exact) return exact;
6487
+ var code = v.toLowerCase().replace(/[\s-]+/g, "_");
6488
+ var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
6489
+ return CATEGORY_CODES[c] === code;
6490
+ });
6491
+ return byCode;
6492
+ }
6493
+ function parseUserAgentDeviceInfo(ua) {
6494
+ var sources = [];
6495
+ var out = {
6496
+ platform: "other",
6497
+ sources: sources
6498
+ };
6499
+ var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
6500
+ if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
6501
+ if (/Web0S|webOS/i.test(ua)) {
6502
+ out.platform = "webos";
6503
+ var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
6504
+ if (lg && lg[1] && lg[2]) {
6505
+ out.model = lg[1];
6506
+ out.firmware = lg[2];
6507
+ sources.push("user_agent");
6508
+ }
6509
+ } else if (/Tizen/i.test(ua)) {
6510
+ out.platform = "tizen";
6511
+ var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
6512
+ if (tizen && tizen[1]) {
6513
+ out.osVersion = "Tizen ".concat(tizen[1]);
6514
+ sources.push("user_agent");
6515
+ }
6516
+ }
6517
+ return out;
6518
+ }
6519
+ function readSamsungProductInfo() {
6520
+ var _cleanString;
6521
+ var _window_webapis;
6522
+ if (typeof window === "undefined") return void 0;
6523
+ var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
6524
+ if (!productinfo) return void 0;
6525
+ var model = (_cleanString = cleanString(safeCall2(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall2(productinfo.getModel, productinfo), 40);
6526
+ var firmware = cleanString(safeCall2(productinfo.getFirmware, productinfo), 64);
6527
+ var duid = cleanString(safeCall2(productinfo.getDuid, productinfo), 128);
6528
+ if (!model && !firmware && !duid) return void 0;
6529
+ return _object_spread({}, model ? {
6530
+ model: model
6531
+ } : {}, firmware ? {
6532
+ firmware: firmware
6533
+ } : {}, duid ? {
6534
+ internalDeviceId: duid,
6535
+ internalDeviceIdSource: "samsung_duid"
6536
+ } : {});
6537
+ }
6538
+ function readLgDeviceInfo(timeoutMs) {
6539
+ var webOS = typeof window !== "undefined" ? window.webOS : void 0;
6540
+ if (lgDeviceInfo || !webOS || typeof webOS.deviceInfo !== "function") return Promise.resolve();
6541
+ return new Promise(function(resolve) {
6542
+ var settled = false;
6543
+ var finish = function finish() {
6544
+ if (settled) return;
6545
+ settled = true;
6546
+ clearTimeout(timer);
6547
+ resolve();
6548
+ };
6549
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
6550
+ try {
6551
+ webOS.deviceInfo(function(info) {
6552
+ var model = cleanString(info === null || info === void 0 ? void 0 : info.modelName, 40);
6553
+ var firmware = cleanString(info === null || info === void 0 ? void 0 : info.version, 64);
6554
+ var sdkVersion = cleanString(info === null || info === void 0 ? void 0 : info.sdkVersion, 32);
6555
+ lgDeviceInfo = _object_spread({}, model ? {
6556
+ model: model
6557
+ } : {}, firmware ? {
6558
+ firmware: firmware
6559
+ } : {}, sdkVersion ? {
6560
+ sdkVersion: sdkVersion
6561
+ } : {});
6562
+ finish();
6563
+ });
6564
+ } catch (unused) {
6565
+ finish();
6566
+ }
6567
+ });
6568
+ }
6569
+ function computePlatformInfo() {
6570
+ var info = parseUserAgentDeviceInfo(userAgent());
6571
+ var sources = _to_consumable_array(info.sources);
6572
+ var samsung = readSamsungProductInfo();
6573
+ if (samsung) {
6574
+ info.platform = "tizen";
6575
+ if (samsung.model) info.model = samsung.model;
6576
+ if (samsung.firmware) info.firmware = samsung.firmware;
6577
+ if (samsung.internalDeviceId) {
6578
+ info.internalDeviceId = samsung.internalDeviceId;
6579
+ info.internalDeviceIdSource = "samsung_duid";
6580
+ }
6581
+ sources.push("samsung_productinfo");
6582
+ }
6583
+ if (lgDeviceInfo) {
6584
+ info.platform = "webos";
6585
+ if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
6586
+ if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
6587
+ if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
6588
+ sources.push("lg_deviceinfo");
6589
+ }
6590
+ var lgUdid = readCachedLgUdid();
6591
+ if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
6592
+ info.internalDeviceId = lgUdid.deviceId;
6593
+ info.internalDeviceIdSource = "lg_udid";
6594
+ sources.push("lg_udid");
6595
+ }
6596
+ info.sources = sources;
6597
+ return info;
6598
+ }
6599
+ function categorize(platform, model) {
6600
+ if (platform === "tizen") return "Samsung TV";
6601
+ if (platform === "webos") {
6602
+ var ua = userAgent();
6603
+ if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
6604
+ return "LG TV";
6605
+ }
6606
+ return "Other";
6607
+ }
6608
+ function setHostDeviceInfo(info) {
6609
+ hostDeviceInfo = info ? _object_spread({}, info) : void 0;
6610
+ }
6611
+ function primeDeviceInfo() {
6612
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1500;
6613
+ if (!primePromise) {
6614
+ primePromise = Promise.all([
6615
+ readLgDeviceInfo(timeoutMs),
6616
+ primeLgUdid(timeoutMs)
6617
+ ]).catch(function() {
6618
+ return void 0;
6619
+ }).then(function() {
6620
+ platformCache = computePlatformInfo();
6621
+ return getDeviceInfo();
6622
+ });
6623
+ }
6624
+ return primePromise;
6625
+ }
6626
+ function getDeviceInfo() {
6627
+ var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
6628
+ var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
6629
+ if (primePromise && !platformCache) {} else {
6630
+ platformCache = platform;
6631
+ }
6632
+ var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
6633
+ var bridge = {
6634
+ terminalId: readBridge([
6635
+ "terminalId",
6636
+ "terminal_id"
6637
+ ]),
6638
+ internalDeviceId: readBridge([
6639
+ "internalDeviceId",
6640
+ "internal_device_id"
6641
+ ]),
6642
+ model: readBridge([
6643
+ "deviceModel"
6644
+ ]),
6645
+ firmware: readBridge([
6646
+ "firmwareVersion"
6647
+ ]),
6648
+ category: normalizeCategory(readBridge([
6649
+ "deviceCategory"
6650
+ ]))
6651
+ };
6652
+ var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
6653
+ var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
6654
+ var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
6655
+ var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
6656
+ var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
6657
+ var sources = _to_consumable_array(platform.sources);
6658
+ var bridgeValues = [
6659
+ bridge.terminalId,
6660
+ bridge.internalDeviceId,
6661
+ bridge.model,
6662
+ bridge.firmware,
6663
+ bridge.category
6664
+ ];
6665
+ if (bridgeValues.some(function(v) {
6666
+ return v !== void 0;
6667
+ })) sources.unshift("bridge");
6668
+ if (hostDeviceInfo) sources.unshift("host");
6669
+ var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
6670
+ var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
6671
+ var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
6672
+ return _object_spread_props(_object_spread({
6673
+ category: category,
6674
+ categoryCode: CATEGORY_CODES[category]
6675
+ }, model ? {
6676
+ model: model
6677
+ } : {}, sonifiModel ? {
6678
+ sonifiModel: sonifiModel
6679
+ } : {}, firmware ? {
6680
+ firmware: firmware
6681
+ } : {}, platform.osVersion ? {
6682
+ osVersion: platform.osVersion
6683
+ } : {}, platform.browserMajorVersion != null ? {
6684
+ browserMajorVersion: platform.browserMajorVersion
6685
+ } : {}, internalDeviceId ? {
6686
+ internalDeviceId: internalDeviceId
6687
+ } : {}, internalDeviceId && internalDeviceIdSource ? {
6688
+ internalDeviceIdSource: internalDeviceIdSource
6689
+ } : {}, terminalId ? {
6690
+ terminalId: terminalId
6691
+ } : {}), {
6692
+ sources: sources
6693
+ });
6694
+ }
6695
+ var DEVICE_KEY_VALUE_KEYS = {
6696
+ category: "sc_dev",
6697
+ model: "sc_model",
6698
+ firmware: "sc_fw"
6699
+ };
6700
+ function sanitizeKeyValue(value) {
6701
+ if (typeof value !== "string") return void 0;
6702
+ var v = value.trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
6703
+ return v ? v.slice(0, 40) : void 0;
6704
+ }
6705
+ function deviceKeyValuePairs(info) {
6706
+ var pairs = [
6707
+ [
6708
+ DEVICE_KEY_VALUE_KEYS.category,
6709
+ info.categoryCode
6710
+ ]
6711
+ ];
6712
+ var model = sanitizeKeyValue(info.model);
6713
+ var firmware = sanitizeKeyValue(info.firmware);
6714
+ if (model) pairs.push([
6715
+ DEVICE_KEY_VALUE_KEYS.model,
6716
+ model
6717
+ ]);
6718
+ if (firmware) pairs.push([
6719
+ DEVICE_KEY_VALUE_KEYS.firmware,
6720
+ firmware
6721
+ ]);
6722
+ return pairs;
6723
+ }
6724
+ function applyDeviceKeyValues(url, info) {
6725
+ try {
6726
+ var parsed = new URL(url);
6727
+ var pairs = deviceKeyValuePairs(info);
6728
+ var ours = new Set(pairs.map(function(param) {
6729
+ var _param = _sliced_to_array(param, 1), k = _param[0];
6730
+ return k;
6731
+ }));
6732
+ var existing = (parsed.searchParams.get("cust_params") || "").split("&").filter(function(p) {
6733
+ var _p_split_;
6734
+ return p !== "" && !ours.has((_p_split_ = p.split("=")[0]) !== null && _p_split_ !== void 0 ? _p_split_ : "");
6735
+ });
6736
+ var merged = existing.concat(pairs.map(function(param) {
6737
+ var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
6738
+ return "".concat(k, "=").concat(v);
6739
+ })).join("&");
6740
+ parsed.searchParams.set("cust_params", merged);
6741
+ return parsed.toString();
6742
+ } catch (unused) {
6743
+ return url;
6744
+ }
6745
+ }
6746
+ function deviceInfoAnalyticsFields(info) {
6747
+ return _object_spread({
6748
+ device_category: info.category
6749
+ }, info.model ? {
6750
+ device_model: info.model
6751
+ } : {}, info.sonifiModel ? {
6752
+ sonifi_model: info.sonifiModel
6753
+ } : {}, info.firmware ? {
6754
+ firmware_version: info.firmware
6755
+ } : {}, info.osVersion ? {
6756
+ os_version: info.osVersion
6757
+ } : {}, info.browserMajorVersion != null ? {
6758
+ browser_major_version: info.browserMajorVersion
6759
+ } : {}, info.internalDeviceId ? {
6760
+ internal_device_id: info.internalDeviceId
6761
+ } : {}, info.internalDeviceIdSource ? {
6762
+ internal_device_id_source: info.internalDeviceIdSource
6763
+ } : {}, info.terminalId ? {
6764
+ terminal_id: info.terminalId
6765
+ } : {});
6766
+ }
6767
+ // src/utils/contentMetadata.ts
6768
+ var MAX_CONTENT_VALUE_LENGTH = 128;
6769
+ var BRIDGE_KEYS = {
6770
+ channelName: [
6771
+ "channelName",
6772
+ "ct_ch"
6773
+ ],
6774
+ programTitle: [
6775
+ "programTitle",
6776
+ "ct_ti"
6777
+ ],
6778
+ contentNetwork: [
6779
+ "contentNetwork",
6780
+ "ct_ne"
6781
+ ]
6782
+ };
6783
+ function sanitizeContentValue(value) {
6784
+ if (typeof value !== "string") return void 0;
6785
+ var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
6786
+ if (!cleaned) return void 0;
6787
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
6788
+ if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
6789
+ return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
6790
+ }
6791
+ function bridgeSources2() {
6792
+ if (typeof window === "undefined") return [];
6793
+ var w = window;
6794
+ return [
6795
+ w.__STORMCLOUD_CTV__,
6796
+ w.__STORMCLOUD_CTV_AD_INFO__,
6797
+ w.stormcloudCtv
6798
+ ].filter(Boolean);
6799
+ }
6800
+ function readBridgeContentValue(keys) {
6801
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6802
+ try {
6803
+ for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6804
+ var source = _step.value;
6805
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6806
+ try {
6807
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6808
+ var key = _step1.value;
6809
+ var value = void 0;
6810
+ try {
6811
+ value = source === null || source === void 0 ? void 0 : source[key];
6812
+ if (typeof value === "function") value = value.call(source);
6813
+ } catch (unused) {
6814
+ value = void 0;
6815
+ }
6816
+ var sanitized = sanitizeContentValue(value);
6817
+ if (sanitized) return sanitized;
6818
+ }
6819
+ } catch (err) {
6820
+ _didIteratorError1 = true;
6821
+ _iteratorError1 = err;
6822
+ } finally{
6823
+ try {
6824
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6825
+ _iterator1.return();
6826
+ }
6827
+ } finally{
6828
+ if (_didIteratorError1) {
6829
+ throw _iteratorError1;
6830
+ }
6831
+ }
6832
+ }
6833
+ }
6834
+ } catch (err) {
6835
+ _didIteratorError = true;
6836
+ _iteratorError = err;
6837
+ } finally{
6838
+ try {
6839
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6840
+ _iterator.return();
6841
+ }
6842
+ } finally{
6843
+ if (_didIteratorError) {
6844
+ throw _iteratorError;
6845
+ }
6846
+ }
6847
+ }
6848
+ return void 0;
6849
+ }
6850
+ function resolveContentMetadata(config) {
6851
+ var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2;
6852
+ var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
6853
+ var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
6854
+ var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
6855
+ return _object_spread({}, channelName ? {
6856
+ channelName: channelName
6857
+ } : {}, programTitle ? {
6858
+ programTitle: programTitle
6859
+ } : {}, contentNetwork ? {
6860
+ contentNetwork: contentNetwork
6861
+ } : {});
6862
+ }
6863
+ function appendMissingContentParams(url, meta) {
6864
+ if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
6865
+ try {
6866
+ var parsed = new URL(url);
6867
+ var add = function add(key, value) {
6868
+ if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
6869
+ };
6870
+ add("ct_ch", meta.channelName);
6871
+ add("ct_ti", meta.programTitle);
6872
+ add("ct_ne", meta.contentNetwork);
6873
+ return parsed.toString();
6874
+ } catch (unused) {
6875
+ return url;
6876
+ }
6877
+ }
6878
+ // src/utils/screenActivity.ts
6879
+ var hostStandby = false;
6880
+ function setHostStandby(standby) {
6881
+ hostStandby = !!standby;
6882
+ }
6883
+ function toBoolean(value) {
6884
+ if (typeof value === "boolean") return value;
6885
+ if (typeof value === "number") return value === 1;
6886
+ if (typeof value === "string") {
6887
+ var v = value.trim().toLowerCase();
6888
+ if (v === "true" || v === "1" || v === "yes") return true;
6889
+ if (v === "false" || v === "0" || v === "no") return false;
6890
+ }
6891
+ return void 0;
6892
+ }
6893
+ function bridgeSaysStandby() {
6894
+ if (typeof window === "undefined") return false;
6895
+ var w = window;
6896
+ for(var _i = 0, _iter = [
6897
+ w.__STORMCLOUD_CTV__,
6898
+ w.__STORMCLOUD_CTV_AD_INFO__,
6899
+ w.stormcloudCtv
6900
+ ]; _i < _iter.length; _i++){
6901
+ var source = _iter[_i];
6902
+ if (!source) continue;
6903
+ for(var _i1 = 0, _iter1 = [
6904
+ "standby",
6905
+ "isStandby",
6906
+ "screenOff"
6907
+ ]; _i1 < _iter1.length; _i1++){
6908
+ var key = _iter1[_i1];
6909
+ var value = void 0;
6910
+ try {
6911
+ value = source[key];
6912
+ if (typeof value === "function") value = value.call(source);
6913
+ } catch (unused) {
6914
+ value = void 0;
6915
+ }
6916
+ if (toBoolean(value) === true) return true;
6917
+ }
6918
+ }
6919
+ return false;
6920
+ }
6921
+ function getScreenInactiveReason() {
6922
+ if (hostStandby) return "host_standby";
6923
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") {
6924
+ return "document_hidden";
6925
+ }
6926
+ if (bridgeSaysStandby()) return "bridge_standby";
6927
+ return void 0;
6928
+ }
6087
6929
  // src/utils/trackingIngest.ts
6088
6930
  var DEFAULT_TRACKING_INGEST_CONFIG = {
6089
6931
  enabled: true,
@@ -6181,6 +7023,9 @@ function buildAnalyticsContext(config) {
6181
7023
  if (config.isLiveStream !== void 0) {
6182
7024
  context.inputStreamType = config.isLiveStream ? "live" : "vod";
6183
7025
  }
7026
+ if (config.sendDeviceInfoToAnalytics) {
7027
+ context.includeDeviceInfo = true;
7028
+ }
6184
7029
  return context;
6185
7030
  }
6186
7031
  function getClientInfo() {
@@ -6476,7 +7321,7 @@ function buildPlayerMetricEvent() {
6476
7321
  capture_at: captureAt
6477
7322
  }, context.inputStreamType ? {
6478
7323
  input_stream_type: context.inputStreamType
6479
- } : {})
7324
+ } : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
6480
7325
  ];
6481
7326
  }
6482
7327
  });
@@ -8504,7 +9349,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
8504
9349
  key: "generatePodVastUrl",
8505
9350
  value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
8506
9351
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
8507
- var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
9352
+ var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
9353
+ fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
9354
+ sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
9355
+ });
9356
+ var content = resolveContentMetadata(this.config);
8508
9357
  var macroContext = _object_spread_props(_object_spread({
8509
9358
  correlator: this.viewCorrelator,
8510
9359
  streamCorrelator: this.streamCorrelator,
@@ -8519,10 +9368,12 @@ var AdConfigManager = /*#__PURE__*/ function() {
8519
9368
  limitAdTracking: envSignals.limitAdTracking,
8520
9369
  deviceTypeHint: envSignals.deviceTypeHint,
8521
9370
  adTest: this.config.adTest
8522
- }, this.config.programTitle ? {
8523
- programTitle: this.config.programTitle
8524
- } : {}, this.config.channelName ? {
8525
- channelName: this.config.channelName
9371
+ }, content.programTitle ? {
9372
+ programTitle: content.programTitle
9373
+ } : {}, content.channelName ? {
9374
+ channelName: content.channelName
9375
+ } : {}, content.contentNetwork ? {
9376
+ contentNetwork: content.contentNetwork
8526
9377
  } : {}), {
8527
9378
  consent: this.consentSignals,
8528
9379
  palNonce: palNonce.getCurrentNonce() || void 0
@@ -8540,6 +9391,24 @@ var AdConfigManager = /*#__PURE__*/ function() {
8540
9391
  } else {
8541
9392
  finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
8542
9393
  }
9394
+ finalUrl = appendMissingContentParams(finalUrl, content);
9395
+ if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
9396
+ finalUrl = applyDeviceKeyValues(finalUrl, getDeviceInfo());
9397
+ }
9398
+ if (this.debug) {
9399
+ var id = envSignals.deviceId;
9400
+ console.log("[AD-IDENTITY]", {
9401
+ source: envSignals.deviceIdSource,
9402
+ idtype: envSignals.deviceIdType,
9403
+ rdidTail: id ? id.slice(-4) : void 0,
9404
+ isLat: envSignals.limitAdTracking,
9405
+ dth: envSignals.deviceTypeHint,
9406
+ sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
9407
+ ct_ch: content.channelName,
9408
+ ct_ti: content.programTitle,
9409
+ ct_ne: content.contentNetwork
9410
+ });
9411
+ }
8543
9412
  console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
8544
9413
  return finalUrl;
8545
9414
  }
@@ -8591,7 +9460,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
8591
9460
  }
8592
9461
  },
8593
9462
  {
8594
- // --- Tracking ---
8595
9463
  key: "initializeTracking",
8596
9464
  value: function initializeTracking() {
8597
9465
  var _this = this;
@@ -8683,7 +9551,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8683
9551
  }
8684
9552
  },
8685
9553
  {
8686
- // --- Ad stop timer ---
8687
9554
  key: "scheduleAdStopCountdown",
8688
9555
  value: function scheduleAdStopCountdown(remainingMs) {
8689
9556
  var _this = this;
@@ -8715,7 +9582,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8715
9582
  }
8716
9583
  },
8717
9584
  {
8718
- // --- Ad start timer ---
8719
9585
  key: "scheduleAdStartIn",
8720
9586
  value: function scheduleAdStartIn(delayMs) {
8721
9587
  var _this = this;
@@ -8743,7 +9609,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8743
9609
  }
8744
9610
  },
8745
9611
  {
8746
- // --- PTS drift ---
8747
9612
  key: "updatePtsDrift",
8748
9613
  value: function updatePtsDrift(ptsSecondsSample) {
8749
9614
  var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
@@ -8769,7 +9634,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8769
9634
  }
8770
9635
  },
8771
9636
  {
8772
- // --- Duration boundary ---
8773
9637
  key: "beginBreakTiming",
8774
9638
  value: function beginBreakTiming(startWallClockMs) {
8775
9639
  this.currentAdBreakStartWallClockMs = startWallClockMs;
@@ -8817,7 +9681,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8817
9681
  }
8818
9682
  },
8819
9683
  {
8820
- // --- Duration budget ---
8821
9684
  key: "getWallClockRemainingAdMs",
8822
9685
  value: function getWallClockRemainingAdMs() {
8823
9686
  var endWallClockMs = this.getAdBreakEndWallClockMs();
@@ -8966,7 +9829,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8966
9829
  }
8967
9830
  },
8968
9831
  {
8969
- // --- Circuit breaker ---
8970
9832
  key: "isTemporaryAdError",
8971
9833
  value: function isTemporaryAdError(error) {
8972
9834
  var _error_message;
@@ -9100,7 +9962,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9100
9962
  }
9101
9963
  },
9102
9964
  {
9103
- // --- Watchdog ---
9104
9965
  key: "startAdRequestWatchdog",
9105
9966
  value: function startAdRequestWatchdog(token) {
9106
9967
  var _this = this;
@@ -9145,7 +10006,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9145
10006
  }
9146
10007
  },
9147
10008
  {
9148
- // --- Failsafe ---
9149
10009
  key: "startAdFailsafeTimer",
9150
10010
  value: function startAdFailsafeTimer(token) {
9151
10011
  var _this = this;
@@ -9207,7 +10067,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9207
10067
  }
9208
10068
  },
9209
10069
  {
9210
- // --- Reset for ad break end ---
9211
10070
  key: "resetForBreakEnd",
9212
10071
  value: function resetForBreakEnd() {
9213
10072
  this.clearAdStopTimer();
@@ -9406,7 +10265,7 @@ var HlsEngine = /*#__PURE__*/ function() {
9406
10265
  adBehavior: adBehavior
9407
10266
  });
9408
10267
  }
9409
- if (!this.config.autoplay) return [
10268
+ if (!(this.config.autoplay && !this.callbacks.shouldHoldContentForAds())) return [
9410
10269
  3,
9411
10270
  2
9412
10271
  ];
@@ -9597,6 +10456,12 @@ var HlsEngine = /*#__PURE__*/ function() {
9597
10456
  2
9598
10457
  ];
9599
10458
  this.hasInitialBufferCompleted = true;
10459
+ if (this.shouldAutoplayAfterBuffering && this.callbacks.shouldHoldContentForAds()) {
10460
+ this.shouldAutoplayAfterBuffering = false;
10461
+ if (this.debug) {
10462
+ console.log("[StormcloudVideoPlayer] Buffer ready during an ad break; content stays paused until the break ends");
10463
+ }
10464
+ }
9600
10465
  if (!this.shouldAutoplayAfterBuffering) return [
9601
10466
  3,
9602
10467
  2
@@ -10254,9 +11119,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10254
11119
  }
10255
11120
  },
10256
11121
  {
10257
- // ───────────────────────────────────────────────────────────────
10258
- // IMA event listeners
10259
- // ───────────────────────────────────────────────────────────────
10260
11122
  key: "nextAdRequestUrl",
10261
11123
  value: function nextAdRequestUrl(baseVastUrl) {
10262
11124
  return this.host.generatePodVastUrl(baseVastUrl);
@@ -10492,9 +11354,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10492
11354
  }
10493
11355
  },
10494
11356
  {
10495
- // ───────────────────────────────────────────────────────────────
10496
- // Ad break start
10497
- // ───────────────────────────────────────────────────────────────
10498
11357
  key: "isBreakActive",
10499
11358
  value: function isBreakActive() {
10500
11359
  return this.slotState !== "IDLE";
@@ -10522,7 +11381,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10522
11381
  key: "handleAdStart",
10523
11382
  value: function handleAdStart(marker) {
10524
11383
  return _async_to_generator(function() {
10525
- var baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
11384
+ var screenInactiveReason, baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
10526
11385
  return _ts_generator(this, function(_state) {
10527
11386
  switch(_state.label){
10528
11387
  case 0:
@@ -10535,6 +11394,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10535
11394
  2
10536
11395
  ];
10537
11396
  }
11397
+ screenInactiveReason = getScreenInactiveReason();
11398
+ if (screenInactiveReason) {
11399
+ this.logOrchestratorFunnel("break_skipped_screen_inactive", {
11400
+ reason: screenInactiveReason
11401
+ });
11402
+ this.clearPendingAdBreak();
11403
+ return [
11404
+ 2
11405
+ ];
11406
+ }
10538
11407
  baseVastUrl = this.adConfig.apiVastTagUrl;
10539
11408
  edgeConfigured = !!this.host.getEdgePodBaseUrl();
10540
11409
  if (!baseVastUrl && !edgeConfigured) {
@@ -10695,12 +11564,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10695
11564
  },
10696
11565
  {
10697
11566
  key: "startOptimizedPod",
10698
- value: // ───────────────────────────────────────────────────────────────
10699
- // Optimized pod (single multi-ad request)
10700
- // ───────────────────────────────────────────────────────────────
10701
- function startOptimizedPod(baseVastUrl) {
11567
+ value: function startOptimizedPod(baseVastUrl) {
10702
11568
  return _async_to_generator(function() {
10703
- var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, error;
11569
+ var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, _this_host_config_maxAdBreakExtensionMs, remainingMs, overrunAllowanceMs, maxAdsCap, maxAds, error;
10704
11570
  return _ts_generator(this, function(_state) {
10705
11571
  switch(_state.label){
10706
11572
  case 0:
@@ -10808,6 +11674,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10808
11674
  false
10809
11675
  ];
10810
11676
  }
11677
+ if (this.isBreakTimeBounded() && adPlayer.limitPodToBudget) {
11678
+ ;
11679
+ remainingMs = this.timing.getRemainingAdMs();
11680
+ overrunAllowanceMs = Math.max(0, (_this_host_config_maxAdBreakExtensionMs = this.host.config.maxAdBreakExtensionMs) !== null && _this_host_config_maxAdBreakExtensionMs !== void 0 ? _this_host_config_maxAdBreakExtensionMs : 0);
11681
+ maxAdsCap = this.adConfig.resolveAdPodConfig().maxAdsPerBreak;
11682
+ maxAds = maxAdsCap != null ? Math.max(1, maxAdsCap - this.timing.totalAdsInBreak) : Number.MAX_SAFE_INTEGER;
11683
+ if (Number.isFinite(remainingMs)) {
11684
+ podCount = adPlayer.limitPodToBudget(remainingMs + overrunAllowanceMs, maxAds);
11685
+ if (podCount < 1) {
11686
+ if (this.timing.activeAdRequestToken === requestToken) {
11687
+ this.timing.activeAdRequestToken = null;
11688
+ }
11689
+ this.recordRequestFailure(new Error("No GAM ad fits the ".concat(Math.round(remainingMs), "ms left in the break")), podUrl);
11690
+ return [
11691
+ 2,
11692
+ false
11693
+ ];
11694
+ }
11695
+ }
11696
+ }
10811
11697
  this.setSlotState("READY", "vast_ready");
10812
11698
  if (this.debug) {
10813
11699
  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"));
@@ -10877,9 +11763,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10877
11763
  }
10878
11764
  },
10879
11765
  {
10880
- // ───────────────────────────────────────────────────────────────
10881
- // Edge-first pods (live SCTE-35 only, GAM fallback)
10882
- // ───────────────────────────────────────────────────────────────
10883
11766
  key: "resetEdgeStateForBreak",
10884
11767
  value: function resetEdgeStateForBreak() {
10885
11768
  this.edgeExhaustedForBreak = false;
@@ -11097,9 +11980,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11097
11980
  }
11098
11981
  },
11099
11982
  {
11100
- // ───────────────────────────────────────────────────────────────
11101
- // Next-ad scheduling (single flight)
11102
- // ───────────────────────────────────────────────────────────────
11103
11983
  key: "setSlotState",
11104
11984
  value: function setSlotState(next, reason) {
11105
11985
  if (this.slotState === next) return;
@@ -11149,6 +12029,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11149
12029
  {
11150
12030
  key: "getStopRequestingReason",
11151
12031
  value: function getStopRequestingReason(remainingMs) {
12032
+ var screenInactiveReason = getScreenInactiveReason();
12033
+ if (screenInactiveReason) return "screen_inactive:".concat(screenInactiveReason);
11152
12034
  if (this.breakSource === "vmap") {
11153
12035
  if (this.adPodQueue.length === 0) return "vmap_queue_empty";
11154
12036
  } else if (this.breakSource !== "scte35" || !this.followUpBaseVastUrl && !this.canRequestEdge()) {
@@ -11422,9 +12304,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11422
12304
  }
11423
12305
  },
11424
12306
  {
11425
- // ───────────────────────────────────────────────────────────────
11426
- // Per-request diagnostics
11427
- // ───────────────────────────────────────────────────────────────
11428
12307
  key: "recordRequestDiagnostic",
11429
12308
  value: function recordRequestDiagnostic(payload) {
11430
12309
  var requestId = payload.requestId;
@@ -11498,9 +12377,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11498
12377
  }
11499
12378
  },
11500
12379
  {
11501
- // ───────────────────────────────────────────────────────────────
11502
- // Single ad playback
11503
- // ───────────────────────────────────────────────────────────────
11504
12380
  key: "createGamDispatchFinalizer",
11505
12381
  value: function createGamDispatchFinalizer(requestToken) {
11506
12382
  var _this = this;
@@ -11963,9 +12839,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11963
12839
  }
11964
12840
  },
11965
12841
  {
11966
- // ───────────────────────────────────────────────────────────────
11967
- // Ad break completion
11968
- // ───────────────────────────────────────────────────────────────
11969
12842
  key: "logBreakFunnel",
11970
12843
  value: function logBreakFunnel(endReason) {
11971
12844
  var funnel = this.breakFunnel;
@@ -12611,6 +13484,8 @@ var ContentHealthWatchdog = /*#__PURE__*/ function() {
12611
13484
  return ContentHealthWatchdog;
12612
13485
  }();
12613
13486
  // src/player/StormcloudVideoPlayer.ts
13487
+ var DEFAULT_PAL_NONCE_MAX_AGE_MS = 5.5 * 60 * 60 * 1e3;
13488
+ var PAL_NONCE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12614
13489
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12615
13490
  function StormcloudVideoPlayer(config) {
12616
13491
  var _this = this;
@@ -12621,6 +13496,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12621
13496
  var browserOverrides = getBrowserConfigOverrides();
12622
13497
  this.config = _object_spread({}, browserOverrides, config);
12623
13498
  this.video = config.videoElement;
13499
+ if (this.config.forceSingleDecoderMode != null) {
13500
+ setSingleDecoderOverride(this.config.forceSingleDecoderMode);
13501
+ }
13502
+ if (this.config.adDeviceId) {
13503
+ setHostAdIdentity({
13504
+ deviceId: this.config.adDeviceId,
13505
+ deviceIdType: this.config.adDeviceIdType,
13506
+ limitAdTracking: this.config.adLimitAdTracking
13507
+ });
13508
+ }
13509
+ if (this.config.deviceInfo) {
13510
+ setHostDeviceInfo(this.config.deviceInfo);
13511
+ }
12624
13512
  logBrowserInfo(config.debugAdTiming);
12625
13513
  this.floorLadder = new FloorLadderController();
12626
13514
  this.adPlayer = this.createAdPlayer(false);
@@ -12684,6 +13572,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12684
13572
  },
12685
13573
  hasPendingAdBreak: function hasPendingAdBreak() {
12686
13574
  return _this.adBreak.pendingAdBreak !== null;
13575
+ },
13576
+ shouldHoldContentForAds: function shouldHoldContentForAds() {
13577
+ return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
12687
13578
  }
12688
13579
  });
12689
13580
  this.adBreak = new AdBreakOrchestrator({
@@ -12879,10 +13770,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12879
13770
  },
12880
13771
  {
12881
13772
  key: "load",
12882
- value: // ───────────────────────────────────────────────────────────────
12883
- // Lifecycle
12884
- // ───────────────────────────────────────────────────────────────
12885
- function load() {
13773
+ value: function load() {
12886
13774
  return _async_to_generator(function() {
12887
13775
  var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
12888
13776
  return _ts_generator(this, function(_state) {
@@ -12892,6 +13780,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12892
13780
  if (!this.attached) {
12893
13781
  this.attach();
12894
13782
  }
13783
+ primeDeviceInfo().then(function(info) {
13784
+ if (_this.debug) {
13785
+ console.log("[DEVICE-INFO]", _object_spread_props(_object_spread({}, info), {
13786
+ internalDeviceId: info.internalDeviceId ? "...".concat(info.internalDeviceId.slice(-4)) : void 0
13787
+ }));
13788
+ }
13789
+ }).catch(function() {});
12895
13790
  _state.label = 1;
12896
13791
  case 1:
12897
13792
  _state.trys.push([
@@ -12926,21 +13821,30 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12926
13821
  fetchConsentSignals().catch(function() {
12927
13822
  return {};
12928
13823
  }).then(function(signals) {
12929
- var _this_config_lowLatencyMode;
13824
+ var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
12930
13825
  _this.adConfig.consentSignals = signals;
12931
13826
  var muted = _this.video.muted;
12932
- return _this.palNonce.generateNonce(_object_spread({
13827
+ var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
13828
+ var palOptions = _object_spread({
12933
13829
  videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
12934
13830
  videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
12935
13831
  adWillAutoPlay: !!_this.config.autoplay,
12936
13832
  adWillPlayMuted: muted,
12937
13833
  playerVolume: muted ? 0 : _this.video.volume,
12938
- continuousPlayback: (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
13834
+ 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,
13835
+ iconsSupported: (_this_config_palIconsSupported = _this.config.palIconsSupported) !== null && _this_config_palIconsSupported !== void 0 ? _this_config_palIconsSupported : false,
13836
+ supportedApiFrameworks: (_this_config_palSupportedApiFrameworks = _this.config.palSupportedApiFrameworks) !== null && _this_config_palSupportedApiFrameworks !== void 0 ? _this_config_palSupportedApiFrameworks : ""
12939
13837
  }, palDescriptionUrl ? {
12940
13838
  descriptionUrl: palDescriptionUrl
12941
13839
  } : {}, signals.storageAllowed != null ? {
12942
13840
  allowStorage: signals.storageAllowed
12943
- } : {}));
13841
+ } : {}, palSessionId ? {
13842
+ sessionId: palSessionId
13843
+ } : {});
13844
+ _this.lastPalOptions = palOptions;
13845
+ _this.palSessionId = palSessionId;
13846
+ _this.startPalNonceRefresh();
13847
+ return _this.palNonce.generateNonce(palOptions);
12944
13848
  }).catch(function() {});
12945
13849
  this.adConfig.initializeTracking();
12946
13850
  if (!this.hlsEngine.shouldUseNativeHls(function() {
@@ -12978,6 +13882,92 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12978
13882
  }).call(this);
12979
13883
  }
12980
13884
  },
13885
+ {
13886
+ key: "startPalNonceRefresh",
13887
+ value: function startPalNonceRefresh() {
13888
+ var _this = this;
13889
+ if (this.palRefreshTimer != null || typeof window === "undefined") return;
13890
+ this.palRefreshTimer = window.setInterval(function() {
13891
+ return _this.refreshPalNonceIfStale();
13892
+ }, PAL_NONCE_CHECK_INTERVAL_MS);
13893
+ }
13894
+ },
13895
+ {
13896
+ key: "refreshPalNonceIfStale",
13897
+ value: function refreshPalNonceIfStale() {
13898
+ var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
13899
+ var _this_config_palNonceMaxAgeMs;
13900
+ var options = this.lastPalOptions;
13901
+ if (!options) return;
13902
+ var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
13903
+ var ageMs = this.palNonce.getNonceAgeMs();
13904
+ var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
13905
+ var sessionChanged = sessionId !== this.palSessionId;
13906
+ var stale = ageMs === void 0 || ageMs >= maxAgeMs;
13907
+ if (!force && !stale && !sessionChanged) return;
13908
+ var next = _object_spread({}, options);
13909
+ if (sessionId) next.sessionId = sessionId;
13910
+ else delete next.sessionId;
13911
+ this.lastPalOptions = next;
13912
+ this.palSessionId = sessionId;
13913
+ if (this.debug) {
13914
+ console.log("[PAL] Regenerating nonce", {
13915
+ force: force,
13916
+ stale: stale,
13917
+ sessionChanged: sessionChanged,
13918
+ ageMs: ageMs
13919
+ });
13920
+ }
13921
+ this.palNonce.generateNonce(next).catch(function() {});
13922
+ }
13923
+ },
13924
+ {
13925
+ key: "setAdIdentity",
13926
+ value: function setAdIdentity(identity) {
13927
+ setHostAdIdentity(identity);
13928
+ this.refreshPalNonceIfStale();
13929
+ }
13930
+ },
13931
+ {
13932
+ key: "resetAdIdentity",
13933
+ value: function resetAdIdentity1() {
13934
+ resetAdIdentity();
13935
+ this.refreshPalNonceIfStale(true);
13936
+ }
13937
+ },
13938
+ {
13939
+ key: "setContentMetadata",
13940
+ value: function setContentMetadata(meta) {
13941
+ var _this = this;
13942
+ var apply = function apply(key, value) {
13943
+ if (value === void 0) return;
13944
+ var clean = value === null ? void 0 : sanitizeContentValue(value);
13945
+ if (clean) _this.config[key] = clean;
13946
+ else delete _this.config[key];
13947
+ };
13948
+ apply("channelName", meta.channelName);
13949
+ apply("programTitle", meta.programTitle);
13950
+ apply("contentNetwork", meta.contentNetwork);
13951
+ }
13952
+ },
13953
+ {
13954
+ key: "setScreenStandby",
13955
+ value: function setScreenStandby(standby) {
13956
+ setHostStandby(standby);
13957
+ }
13958
+ },
13959
+ {
13960
+ key: "getDeviceInfo",
13961
+ value: function getDeviceInfo1() {
13962
+ return getDeviceInfo();
13963
+ }
13964
+ },
13965
+ {
13966
+ key: "setDeviceInfo",
13967
+ value: function setDeviceInfo(info) {
13968
+ setHostDeviceInfo(info);
13969
+ }
13970
+ },
12981
13971
  {
12982
13972
  key: "onManifestParsed",
12983
13973
  value: function onManifestParsed(isLive) {
@@ -13112,9 +14102,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13112
14102
  }
13113
14103
  },
13114
14104
  {
13115
- // ───────────────────────────────────────────────────────────────
13116
- // SCTE-35 marker orchestration
13117
- // ───────────────────────────────────────────────────────────────
13118
14105
  key: "onScte35Marker",
13119
14106
  value: function onScte35Marker(marker, cueKey) {
13120
14107
  if (this.debug) {
@@ -13293,9 +14280,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13293
14280
  }
13294
14281
  },
13295
14282
  {
13296
- // ───────────────────────────────────────────────────────────────
13297
- // Ad prefetch
13298
- // ───────────────────────────────────────────────────────────────
13299
14283
  key: "startAdPrefetch",
13300
14284
  value: function startAdPrefetch(marker, fragmentSn, cueKey) {
13301
14285
  if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
@@ -13334,9 +14318,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13334
14318
  }
13335
14319
  },
13336
14320
  {
13337
- // ───────────────────────────────────────────────────────────────
13338
- // VMAP time-based ad breaks
13339
- // ───────────────────────────────────────────────────────────────
13340
14321
  key: "onTimeUpdate",
13341
14322
  value: function onTimeUpdate(currentTimeSec) {
13342
14323
  var _this = this;
@@ -13450,9 +14431,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13450
14431
  }
13451
14432
  },
13452
14433
  {
13453
- // ───────────────────────────────────────────────────────────────
13454
- // Public API
13455
- // ───────────────────────────────────────────────────────────────
13456
14434
  key: "getCurrentAdIndex",
13457
14435
  value: function getCurrentAdIndex() {
13458
14436
  return this.timing.currentAdIndex;
@@ -13571,12 +14549,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13571
14549
  }
13572
14550
  },
13573
14551
  {
13574
- // ───────────────────────────────────────────────────────────────
13575
- // Destroy
13576
- // ───────────────────────────────────────────────────────────────
13577
14552
  key: "destroy",
13578
14553
  value: function destroy() {
13579
14554
  var _this_adPlayer;
14555
+ if (this.palRefreshTimer != null) {
14556
+ clearInterval(this.palRefreshTimer);
14557
+ this.palRefreshTimer = void 0;
14558
+ }
13580
14559
  this.contentWatchdog.stop();
13581
14560
  this.adBreak.cancelScheduledRequest();
13582
14561
  this.timing.destroy();