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
@@ -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,
@@ -6148,6 +6990,9 @@ function buildAnalyticsContext(config) {
6148
6990
  if (config.isLiveStream !== void 0) {
6149
6991
  context.inputStreamType = config.isLiveStream ? "live" : "vod";
6150
6992
  }
6993
+ if (config.sendDeviceInfoToAnalytics) {
6994
+ context.includeDeviceInfo = true;
6995
+ }
6151
6996
  return context;
6152
6997
  }
6153
6998
  function getClientInfo() {
@@ -6443,7 +7288,7 @@ function buildPlayerMetricEvent() {
6443
7288
  capture_at: captureAt
6444
7289
  }, context.inputStreamType ? {
6445
7290
  input_stream_type: context.inputStreamType
6446
- } : {})
7291
+ } : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
6447
7292
  ];
6448
7293
  }
6449
7294
  });
@@ -8471,7 +9316,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
8471
9316
  key: "generatePodVastUrl",
8472
9317
  value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
8473
9318
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
8474
- 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);
8475
9324
  var macroContext = _object_spread_props(_object_spread({
8476
9325
  correlator: this.viewCorrelator,
8477
9326
  streamCorrelator: this.streamCorrelator,
@@ -8486,10 +9335,12 @@ var AdConfigManager = /*#__PURE__*/ function() {
8486
9335
  limitAdTracking: envSignals.limitAdTracking,
8487
9336
  deviceTypeHint: envSignals.deviceTypeHint,
8488
9337
  adTest: this.config.adTest
8489
- }, this.config.programTitle ? {
8490
- programTitle: this.config.programTitle
8491
- } : {}, this.config.channelName ? {
8492
- 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
8493
9344
  } : {}), {
8494
9345
  consent: this.consentSignals,
8495
9346
  palNonce: palNonce.getCurrentNonce() || void 0
@@ -8507,6 +9358,24 @@ var AdConfigManager = /*#__PURE__*/ function() {
8507
9358
  } else {
8508
9359
  finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
8509
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
+ }
8510
9379
  console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
8511
9380
  return finalUrl;
8512
9381
  }
@@ -8558,7 +9427,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
8558
9427
  }
8559
9428
  },
8560
9429
  {
8561
- // --- Tracking ---
8562
9430
  key: "initializeTracking",
8563
9431
  value: function initializeTracking() {
8564
9432
  var _this = this;
@@ -8650,7 +9518,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8650
9518
  }
8651
9519
  },
8652
9520
  {
8653
- // --- Ad stop timer ---
8654
9521
  key: "scheduleAdStopCountdown",
8655
9522
  value: function scheduleAdStopCountdown(remainingMs) {
8656
9523
  var _this = this;
@@ -8682,7 +9549,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8682
9549
  }
8683
9550
  },
8684
9551
  {
8685
- // --- Ad start timer ---
8686
9552
  key: "scheduleAdStartIn",
8687
9553
  value: function scheduleAdStartIn(delayMs) {
8688
9554
  var _this = this;
@@ -8710,7 +9576,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8710
9576
  }
8711
9577
  },
8712
9578
  {
8713
- // --- PTS drift ---
8714
9579
  key: "updatePtsDrift",
8715
9580
  value: function updatePtsDrift(ptsSecondsSample) {
8716
9581
  var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
@@ -8736,7 +9601,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8736
9601
  }
8737
9602
  },
8738
9603
  {
8739
- // --- Duration boundary ---
8740
9604
  key: "beginBreakTiming",
8741
9605
  value: function beginBreakTiming(startWallClockMs) {
8742
9606
  this.currentAdBreakStartWallClockMs = startWallClockMs;
@@ -8784,7 +9648,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8784
9648
  }
8785
9649
  },
8786
9650
  {
8787
- // --- Duration budget ---
8788
9651
  key: "getWallClockRemainingAdMs",
8789
9652
  value: function getWallClockRemainingAdMs() {
8790
9653
  var endWallClockMs = this.getAdBreakEndWallClockMs();
@@ -8933,7 +9796,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8933
9796
  }
8934
9797
  },
8935
9798
  {
8936
- // --- Circuit breaker ---
8937
9799
  key: "isTemporaryAdError",
8938
9800
  value: function isTemporaryAdError(error) {
8939
9801
  var _error_message;
@@ -9067,7 +9929,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9067
9929
  }
9068
9930
  },
9069
9931
  {
9070
- // --- Watchdog ---
9071
9932
  key: "startAdRequestWatchdog",
9072
9933
  value: function startAdRequestWatchdog(token) {
9073
9934
  var _this = this;
@@ -9112,7 +9973,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9112
9973
  }
9113
9974
  },
9114
9975
  {
9115
- // --- Failsafe ---
9116
9976
  key: "startAdFailsafeTimer",
9117
9977
  value: function startAdFailsafeTimer(token) {
9118
9978
  var _this = this;
@@ -9174,7 +10034,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9174
10034
  }
9175
10035
  },
9176
10036
  {
9177
- // --- Reset for ad break end ---
9178
10037
  key: "resetForBreakEnd",
9179
10038
  value: function resetForBreakEnd() {
9180
10039
  this.clearAdStopTimer();
@@ -9373,7 +10232,7 @@ var HlsEngine = /*#__PURE__*/ function() {
9373
10232
  adBehavior: adBehavior
9374
10233
  });
9375
10234
  }
9376
- if (!this.config.autoplay) return [
10235
+ if (!(this.config.autoplay && !this.callbacks.shouldHoldContentForAds())) return [
9377
10236
  3,
9378
10237
  2
9379
10238
  ];
@@ -9564,6 +10423,12 @@ var HlsEngine = /*#__PURE__*/ function() {
9564
10423
  2
9565
10424
  ];
9566
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
+ }
9567
10432
  if (!this.shouldAutoplayAfterBuffering) return [
9568
10433
  3,
9569
10434
  2
@@ -10221,9 +11086,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10221
11086
  }
10222
11087
  },
10223
11088
  {
10224
- // ───────────────────────────────────────────────────────────────
10225
- // IMA event listeners
10226
- // ───────────────────────────────────────────────────────────────
10227
11089
  key: "nextAdRequestUrl",
10228
11090
  value: function nextAdRequestUrl(baseVastUrl) {
10229
11091
  return this.host.generatePodVastUrl(baseVastUrl);
@@ -10459,9 +11321,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10459
11321
  }
10460
11322
  },
10461
11323
  {
10462
- // ───────────────────────────────────────────────────────────────
10463
- // Ad break start
10464
- // ───────────────────────────────────────────────────────────────
10465
11324
  key: "isBreakActive",
10466
11325
  value: function isBreakActive() {
10467
11326
  return this.slotState !== "IDLE";
@@ -10489,7 +11348,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10489
11348
  key: "handleAdStart",
10490
11349
  value: function handleAdStart(marker) {
10491
11350
  return _async_to_generator(function() {
10492
- var baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
11351
+ var screenInactiveReason, baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
10493
11352
  return _ts_generator(this, function(_state) {
10494
11353
  switch(_state.label){
10495
11354
  case 0:
@@ -10502,6 +11361,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10502
11361
  2
10503
11362
  ];
10504
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
+ }
10505
11374
  baseVastUrl = this.adConfig.apiVastTagUrl;
10506
11375
  edgeConfigured = !!this.host.getEdgePodBaseUrl();
10507
11376
  if (!baseVastUrl && !edgeConfigured) {
@@ -10662,12 +11531,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10662
11531
  },
10663
11532
  {
10664
11533
  key: "startOptimizedPod",
10665
- value: // ───────────────────────────────────────────────────────────────
10666
- // Optimized pod (single multi-ad request)
10667
- // ───────────────────────────────────────────────────────────────
10668
- function startOptimizedPod(baseVastUrl) {
11534
+ value: function startOptimizedPod(baseVastUrl) {
10669
11535
  return _async_to_generator(function() {
10670
- 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;
10671
11537
  return _ts_generator(this, function(_state) {
10672
11538
  switch(_state.label){
10673
11539
  case 0:
@@ -10775,6 +11641,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10775
11641
  false
10776
11642
  ];
10777
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
+ }
10778
11664
  this.setSlotState("READY", "vast_ready");
10779
11665
  if (this.debug) {
10780
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"));
@@ -10844,9 +11730,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10844
11730
  }
10845
11731
  },
10846
11732
  {
10847
- // ───────────────────────────────────────────────────────────────
10848
- // Edge-first pods (live SCTE-35 only, GAM fallback)
10849
- // ───────────────────────────────────────────────────────────────
10850
11733
  key: "resetEdgeStateForBreak",
10851
11734
  value: function resetEdgeStateForBreak() {
10852
11735
  this.edgeExhaustedForBreak = false;
@@ -11064,9 +11947,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11064
11947
  }
11065
11948
  },
11066
11949
  {
11067
- // ───────────────────────────────────────────────────────────────
11068
- // Next-ad scheduling (single flight)
11069
- // ───────────────────────────────────────────────────────────────
11070
11950
  key: "setSlotState",
11071
11951
  value: function setSlotState(next, reason) {
11072
11952
  if (this.slotState === next) return;
@@ -11116,6 +11996,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11116
11996
  {
11117
11997
  key: "getStopRequestingReason",
11118
11998
  value: function getStopRequestingReason(remainingMs) {
11999
+ var screenInactiveReason = getScreenInactiveReason();
12000
+ if (screenInactiveReason) return "screen_inactive:".concat(screenInactiveReason);
11119
12001
  if (this.breakSource === "vmap") {
11120
12002
  if (this.adPodQueue.length === 0) return "vmap_queue_empty";
11121
12003
  } else if (this.breakSource !== "scte35" || !this.followUpBaseVastUrl && !this.canRequestEdge()) {
@@ -11389,9 +12271,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11389
12271
  }
11390
12272
  },
11391
12273
  {
11392
- // ───────────────────────────────────────────────────────────────
11393
- // Per-request diagnostics
11394
- // ───────────────────────────────────────────────────────────────
11395
12274
  key: "recordRequestDiagnostic",
11396
12275
  value: function recordRequestDiagnostic(payload) {
11397
12276
  var requestId = payload.requestId;
@@ -11465,9 +12344,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11465
12344
  }
11466
12345
  },
11467
12346
  {
11468
- // ───────────────────────────────────────────────────────────────
11469
- // Single ad playback
11470
- // ───────────────────────────────────────────────────────────────
11471
12347
  key: "createGamDispatchFinalizer",
11472
12348
  value: function createGamDispatchFinalizer(requestToken) {
11473
12349
  var _this = this;
@@ -11930,9 +12806,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11930
12806
  }
11931
12807
  },
11932
12808
  {
11933
- // ───────────────────────────────────────────────────────────────
11934
- // Ad break completion
11935
- // ───────────────────────────────────────────────────────────────
11936
12809
  key: "logBreakFunnel",
11937
12810
  value: function logBreakFunnel(endReason) {
11938
12811
  var funnel = this.breakFunnel;
@@ -12578,6 +13451,8 @@ var ContentHealthWatchdog = /*#__PURE__*/ function() {
12578
13451
  return ContentHealthWatchdog;
12579
13452
  }();
12580
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;
12581
13456
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12582
13457
  function StormcloudVideoPlayer(config) {
12583
13458
  var _this = this;
@@ -12588,6 +13463,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12588
13463
  var browserOverrides = getBrowserConfigOverrides();
12589
13464
  this.config = _object_spread({}, browserOverrides, config);
12590
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
+ }
12591
13479
  logBrowserInfo(config.debugAdTiming);
12592
13480
  this.floorLadder = new FloorLadderController();
12593
13481
  this.adPlayer = this.createAdPlayer(false);
@@ -12651,6 +13539,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12651
13539
  },
12652
13540
  hasPendingAdBreak: function hasPendingAdBreak() {
12653
13541
  return _this.adBreak.pendingAdBreak !== null;
13542
+ },
13543
+ shouldHoldContentForAds: function shouldHoldContentForAds() {
13544
+ return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
12654
13545
  }
12655
13546
  });
12656
13547
  this.adBreak = new AdBreakOrchestrator({
@@ -12846,10 +13737,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12846
13737
  },
12847
13738
  {
12848
13739
  key: "load",
12849
- value: // ───────────────────────────────────────────────────────────────
12850
- // Lifecycle
12851
- // ───────────────────────────────────────────────────────────────
12852
- function load() {
13740
+ value: function load() {
12853
13741
  return _async_to_generator(function() {
12854
13742
  var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
12855
13743
  return _ts_generator(this, function(_state) {
@@ -12859,6 +13747,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12859
13747
  if (!this.attached) {
12860
13748
  this.attach();
12861
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() {});
12862
13757
  _state.label = 1;
12863
13758
  case 1:
12864
13759
  _state.trys.push([
@@ -12893,21 +13788,30 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12893
13788
  fetchConsentSignals().catch(function() {
12894
13789
  return {};
12895
13790
  }).then(function(signals) {
12896
- var _this_config_lowLatencyMode;
13791
+ var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
12897
13792
  _this.adConfig.consentSignals = signals;
12898
13793
  var muted = _this.video.muted;
12899
- return _this.palNonce.generateNonce(_object_spread({
13794
+ var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
13795
+ var palOptions = _object_spread({
12900
13796
  videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
12901
13797
  videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
12902
13798
  adWillAutoPlay: !!_this.config.autoplay,
12903
13799
  adWillPlayMuted: muted,
12904
13800
  playerVolume: muted ? 0 : _this.video.volume,
12905
- 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 : ""
12906
13804
  }, palDescriptionUrl ? {
12907
13805
  descriptionUrl: palDescriptionUrl
12908
13806
  } : {}, signals.storageAllowed != null ? {
12909
13807
  allowStorage: signals.storageAllowed
12910
- } : {}));
13808
+ } : {}, palSessionId ? {
13809
+ sessionId: palSessionId
13810
+ } : {});
13811
+ _this.lastPalOptions = palOptions;
13812
+ _this.palSessionId = palSessionId;
13813
+ _this.startPalNonceRefresh();
13814
+ return _this.palNonce.generateNonce(palOptions);
12911
13815
  }).catch(function() {});
12912
13816
  this.adConfig.initializeTracking();
12913
13817
  if (!this.hlsEngine.shouldUseNativeHls(function() {
@@ -12945,6 +13849,92 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12945
13849
  }).call(this);
12946
13850
  }
12947
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
+ },
12948
13938
  {
12949
13939
  key: "onManifestParsed",
12950
13940
  value: function onManifestParsed(isLive) {
@@ -13079,9 +14069,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13079
14069
  }
13080
14070
  },
13081
14071
  {
13082
- // ───────────────────────────────────────────────────────────────
13083
- // SCTE-35 marker orchestration
13084
- // ───────────────────────────────────────────────────────────────
13085
14072
  key: "onScte35Marker",
13086
14073
  value: function onScte35Marker(marker, cueKey) {
13087
14074
  if (this.debug) {
@@ -13260,9 +14247,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13260
14247
  }
13261
14248
  },
13262
14249
  {
13263
- // ───────────────────────────────────────────────────────────────
13264
- // Ad prefetch
13265
- // ───────────────────────────────────────────────────────────────
13266
14250
  key: "startAdPrefetch",
13267
14251
  value: function startAdPrefetch(marker, fragmentSn, cueKey) {
13268
14252
  if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
@@ -13301,9 +14285,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13301
14285
  }
13302
14286
  },
13303
14287
  {
13304
- // ───────────────────────────────────────────────────────────────
13305
- // VMAP time-based ad breaks
13306
- // ───────────────────────────────────────────────────────────────
13307
14288
  key: "onTimeUpdate",
13308
14289
  value: function onTimeUpdate(currentTimeSec) {
13309
14290
  var _this = this;
@@ -13417,9 +14398,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13417
14398
  }
13418
14399
  },
13419
14400
  {
13420
- // ───────────────────────────────────────────────────────────────
13421
- // Public API
13422
- // ───────────────────────────────────────────────────────────────
13423
14401
  key: "getCurrentAdIndex",
13424
14402
  value: function getCurrentAdIndex() {
13425
14403
  return this.timing.currentAdIndex;
@@ -13538,12 +14516,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13538
14516
  }
13539
14517
  },
13540
14518
  {
13541
- // ───────────────────────────────────────────────────────────────
13542
- // Destroy
13543
- // ───────────────────────────────────────────────────────────────
13544
14519
  key: "destroy",
13545
14520
  value: function destroy() {
13546
14521
  var _this_adPlayer;
14522
+ if (this.palRefreshTimer != null) {
14523
+ clearInterval(this.palRefreshTimer);
14524
+ this.palRefreshTimer = void 0;
14525
+ }
13547
14526
  this.contentWatchdog.stop();
13548
14527
  this.adBreak.cancelScheduledRequest();
13549
14528
  this.timing.destroy();