stormcloud-video-player 0.8.78 → 0.8.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/stormcloud-vp.min.js +2 -2
  2. package/lib/Player.cjs +6 -0
  3. package/lib/Player.cjs.map +1 -1
  4. package/lib/Player.d.cts +2 -0
  5. package/lib/StormcloudPlayer.cjs +1143 -160
  6. package/lib/StormcloudPlayer.cjs.map +1 -1
  7. package/lib/StormcloudPlayer.d.cts +2 -0
  8. package/lib/index.cjs +1206 -162
  9. package/lib/index.cjs.map +1 -1
  10. package/lib/index.d.cts +2 -0
  11. package/lib/index.d.ts +64 -2
  12. package/lib/index.js +1206 -162
  13. package/lib/index.js.map +1 -1
  14. package/lib/player/AdBreakOrchestrator.cjs +424 -84
  15. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  16. package/lib/player/AdConfigManager.cjs +738 -94
  17. package/lib/player/AdConfigManager.cjs.map +1 -1
  18. package/lib/player/AdTimingService.cjs +0 -9
  19. package/lib/player/AdTimingService.cjs.map +1 -1
  20. package/lib/player/FloorLadder.cjs +3 -0
  21. package/lib/player/FloorLadder.cjs.map +1 -1
  22. package/lib/player/HlsEngine.cjs +7 -1
  23. package/lib/player/HlsEngine.cjs.map +1 -1
  24. package/lib/player/HlsEngine.d.cts +1 -0
  25. package/lib/player/OptimizedPodRequest.cjs +4 -1
  26. package/lib/player/OptimizedPodRequest.cjs.map +1 -1
  27. package/lib/player/OptimizedPodRequest.d.cts +1 -1
  28. package/lib/player/StormcloudVideoPlayer.cjs +1143 -160
  29. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  30. package/lib/player/StormcloudVideoPlayer.d.cts +18 -1
  31. package/lib/players/HlsPlayer.cjs +1143 -160
  32. package/lib/players/HlsPlayer.cjs.map +1 -1
  33. package/lib/players/index.cjs +1143 -160
  34. package/lib/players/index.cjs.map +1 -1
  35. package/lib/props.cjs +6 -0
  36. package/lib/props.cjs.map +1 -1
  37. package/lib/props.d.cts +2 -0
  38. package/lib/sdk/hlsAdPlayer.cjs +32 -3
  39. package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
  40. package/lib/sdk/pal.cjs +10 -3
  41. package/lib/sdk/pal.cjs.map +1 -1
  42. package/lib/sdk/pal.d.cts +3 -0
  43. package/lib/types.d.cts +24 -1
  44. package/lib/ui/StormcloudVideoPlayer.cjs +1206 -162
  45. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  46. package/lib/ui/StormcloudVideoPlayer.d.cts +2 -0
  47. package/lib/utils/__tests__/adSignals.test.cjs +25662 -0
  48. package/lib/utils/__tests__/adSignals.test.cjs.map +1 -0
  49. package/lib/utils/__tests__/adSignals.test.d.cts +2 -0
  50. package/lib/utils/adIdentity.cjs +421 -0
  51. package/lib/utils/adIdentity.cjs.map +1 -0
  52. package/lib/utils/adIdentity.d.cts +30 -0
  53. package/lib/utils/browserCompat.cjs +13 -0
  54. package/lib/utils/browserCompat.cjs.map +1 -1
  55. package/lib/utils/browserCompat.d.cts +2 -1
  56. package/lib/utils/contentMetadata.cjs +208 -0
  57. package/lib/utils/contentMetadata.cjs.map +1 -0
  58. package/lib/utils/contentMetadata.d.cts +15 -0
  59. package/lib/utils/ctvVastSignals.cjs +250 -181
  60. package/lib/utils/ctvVastSignals.cjs.map +1 -1
  61. package/lib/utils/deviceInfo.cjs +678 -0
  62. package/lib/utils/deviceInfo.cjs.map +1 -0
  63. package/lib/utils/deviceInfo.d.cts +43 -0
  64. package/lib/utils/screenActivity.cjs +125 -0
  65. package/lib/utils/screenActivity.cjs.map +1 -0
  66. package/lib/utils/screenActivity.d.cts +5 -0
  67. package/lib/utils/tracking.cjs +391 -57
  68. package/lib/utils/tracking.cjs.map +1 -1
  69. package/lib/utils/tracking.d.cts +1 -1
  70. package/lib/utils/vastEnvironmentSignals.cjs +255 -85
  71. package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
  72. package/lib/utils/vastEnvironmentSignals.d.cts +8 -2
  73. package/lib/utils/vastMacros.cjs +7 -0
  74. package/lib/utils/vastMacros.cjs.map +1 -1
  75. package/lib/utils/vastMacros.d.cts +1 -0
  76. package/package.json +1 -1
@@ -409,8 +409,264 @@ __export(HlsPlayer_exports, {
409
409
  });
410
410
  module.exports = __toCommonJS(HlsPlayer_exports);
411
411
  var import_react = require("react");
412
+ // src/utils/adIdentity.ts
413
+ var GOOGLE_ID_TYPES = [
414
+ "aaid",
415
+ "adid",
416
+ "afai",
417
+ "idfa",
418
+ "lgudid",
419
+ "msai",
420
+ "rida",
421
+ "tifa",
422
+ "tvOS",
423
+ "vaid",
424
+ "vida",
425
+ "dpid"
426
+ ];
427
+ var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
428
+ var DEFAULT_SESSION_ID_MAX_AGE_MS = MAX_SESSION_ID_AGE_MS;
429
+ var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
430
+ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
431
+ var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
432
+ var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
433
+ var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
434
+ var ZEROED_IDS = /* @__PURE__ */ new Set([
435
+ "00000000-0000-0000-0000-000000000000",
436
+ "38400000-8cf0-11bd-b23e-10b96e40000d"
437
+ ]);
438
+ var hostIdentity;
439
+ var memoryStore = {};
440
+ var lgUdidResult;
441
+ var lgUdidPromise;
442
+ var legacyCleared = false;
443
+ function isUsableAdId(value) {
444
+ if (typeof value !== "string") return false;
445
+ var t = value.trim();
446
+ if (!t) return false;
447
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
448
+ if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
449
+ return !ZEROED_IDS.has(t.toLowerCase());
450
+ }
451
+ function isZeroedAdId(value) {
452
+ return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
453
+ }
454
+ function normalizeIdType(value) {
455
+ if (typeof value !== "string") return void 0;
456
+ var lower = value.trim().toLowerCase();
457
+ if (!lower) return void 0;
458
+ var match = GOOGLE_ID_TYPES.find(function(t) {
459
+ return t.toLowerCase() === lower;
460
+ });
461
+ return match !== null && match !== void 0 ? match : "dpid";
462
+ }
463
+ function createUuid() {
464
+ var _bytes_, _bytes_1, _bytes_i;
465
+ var c = typeof crypto !== "undefined" ? crypto : void 0;
466
+ if (c && typeof c.randomUUID === "function") return c.randomUUID();
467
+ var bytes = new Uint8Array(16);
468
+ if (c && typeof c.getRandomValues === "function") {
469
+ c.getRandomValues(bytes);
470
+ } else {
471
+ for(var i = 0; i < 16; i++)bytes[i] = Math.floor(Math.random() * 256);
472
+ }
473
+ bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
474
+ bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
475
+ var hex = "";
476
+ 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");
477
+ 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));
478
+ }
479
+ function readStored(key) {
480
+ try {
481
+ var _window_localStorage;
482
+ var raw = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
483
+ if (raw) {
484
+ var parsed = JSON.parse(raw);
485
+ if (parsed && typeof parsed.id === "string" && typeof parsed.createdAt === "number" && isFinite(parsed.createdAt)) {
486
+ return {
487
+ id: parsed.id,
488
+ createdAt: parsed.createdAt
489
+ };
490
+ }
491
+ }
492
+ } catch (unused) {}
493
+ return memoryStore[key];
494
+ }
495
+ function writeStored(key, value) {
496
+ memoryStore[key] = value;
497
+ try {
498
+ if (typeof window !== "undefined") {
499
+ var _window_localStorage;
500
+ (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(key, JSON.stringify(value));
501
+ }
502
+ } catch (unused) {}
503
+ }
504
+ function removeStored(key) {
505
+ delete memoryStore[key];
506
+ try {
507
+ var _window_localStorage;
508
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(key);
509
+ } catch (unused) {}
510
+ }
511
+ function clearLegacyIdsOnce() {
512
+ if (legacyCleared) return;
513
+ legacyCleared = true;
514
+ try {
515
+ var _window_localStorage;
516
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(LEGACY_SESSION_KEY);
517
+ } catch (unused) {}
518
+ try {
519
+ if (typeof document !== "undefined") {
520
+ document.cookie = "".concat(encodeURIComponent(LEGACY_SESSION_KEY), "=;path=/;max-age=0;SameSite=Lax");
521
+ }
522
+ } catch (unused) {}
523
+ }
524
+ function clampAge(value, fallback, max) {
525
+ var v = typeof value === "number" && isFinite(value) && value > 0 ? value : fallback;
526
+ if (max != null) v = Math.min(v, max);
527
+ return v;
528
+ }
529
+ function setHostAdIdentity(identity) {
530
+ var _normalizeIdType;
531
+ if (!identity || !isUsableAdId(identity.deviceId)) {
532
+ hostIdentity = void 0;
533
+ return;
534
+ }
535
+ var deviceId = identity.deviceId.trim();
536
+ var changed = !hostIdentity || hostIdentity.deviceId !== deviceId;
537
+ hostIdentity = _object_spread({
538
+ deviceId: deviceId,
539
+ deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
540
+ }, typeof identity.limitAdTracking === "boolean" ? {
541
+ limitAdTracking: identity.limitAdTracking
542
+ } : {});
543
+ if (changed) {
544
+ removeStored(SESSION_ID_KEY);
545
+ removeStored(FALLBACK_DEVICE_ID_KEY);
546
+ }
547
+ }
548
+ function getHostAdIdentity() {
549
+ return hostIdentity ? _object_spread({}, hostIdentity) : void 0;
550
+ }
551
+ function resetAdIdentity() {
552
+ removeStored(SESSION_ID_KEY);
553
+ removeStored(FALLBACK_DEVICE_ID_KEY);
554
+ }
555
+ function readSamsungTifa() {
556
+ try {
557
+ var _window_webapis;
558
+ var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
559
+ if (!adinfo) return void 0;
560
+ var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
561
+ var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
562
+ if (isZeroedAdId(tifa)) return {
563
+ deviceIdType: "tifa",
564
+ limitAdTracking: true
565
+ };
566
+ if (!isUsableAdId(tifa)) return void 0;
567
+ return _object_spread({
568
+ deviceId: tifa.trim(),
569
+ deviceIdType: "tifa"
570
+ }, typeof lat === "boolean" ? {
571
+ limitAdTracking: lat
572
+ } : {});
573
+ } catch (unused) {
574
+ return void 0;
575
+ }
576
+ }
577
+ function primeLgUdid() {
578
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_LGUDID_TIMEOUT_MS;
579
+ if (lgUdidResult || lgUdidPromise) return lgUdidPromise !== null && lgUdidPromise !== void 0 ? lgUdidPromise : Promise.resolve();
580
+ var dev = typeof window !== "undefined" ? window.webOSDev : void 0;
581
+ if (!dev) return Promise.resolve();
582
+ if (typeof dev.LGUDID !== "function") {
583
+ var _dev_lgudid;
584
+ var direct = (_dev_lgudid = dev.lgudid) !== null && _dev_lgudid !== void 0 ? _dev_lgudid : dev.LGUDID;
585
+ if (isZeroedAdId(direct)) lgUdidResult = {
586
+ deviceIdType: "lgudid",
587
+ limitAdTracking: true
588
+ };
589
+ else if (isUsableAdId(direct)) {
590
+ lgUdidResult = {
591
+ deviceId: direct.trim(),
592
+ deviceIdType: "lgudid",
593
+ limitAdTracking: false
594
+ };
595
+ }
596
+ return Promise.resolve();
597
+ }
598
+ lgUdidPromise = new Promise(function(resolve) {
599
+ var settled = false;
600
+ var finish = function finish() {
601
+ if (settled) return;
602
+ settled = true;
603
+ clearTimeout(timer);
604
+ resolve();
605
+ };
606
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
607
+ try {
608
+ dev.LGUDID({
609
+ onSuccess: function onSuccess(res) {
610
+ var id = res === null || res === void 0 ? void 0 : res.id;
611
+ if (isZeroedAdId(id)) {
612
+ lgUdidResult = {
613
+ deviceIdType: "lgudid",
614
+ limitAdTracking: true
615
+ };
616
+ } else if (isUsableAdId(id)) {
617
+ lgUdidResult = {
618
+ deviceId: id.trim(),
619
+ deviceIdType: "lgudid",
620
+ limitAdTracking: false
621
+ };
622
+ }
623
+ finish();
624
+ },
625
+ onFailure: function onFailure() {
626
+ return finish();
627
+ }
628
+ });
629
+ } catch (unused) {
630
+ finish();
631
+ }
632
+ });
633
+ return lgUdidPromise;
634
+ }
635
+ function readCachedLgUdid() {
636
+ return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
637
+ }
638
+ function getOrRotateFallbackDeviceId() {
639
+ 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();
640
+ clearLegacyIdsOnce();
641
+ var age = clampAge(maxAgeMs, DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS);
642
+ var stored = readStored(FALLBACK_DEVICE_ID_KEY);
643
+ if (stored && isUsableAdId(stored.id) && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
644
+ return stored.id;
645
+ }
646
+ var id = createUuid();
647
+ writeStored(FALLBACK_DEVICE_ID_KEY, {
648
+ id: id,
649
+ createdAt: now
650
+ });
651
+ return id;
652
+ }
653
+ function getOrRotateSessionId() {
654
+ 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();
655
+ clearLegacyIdsOnce();
656
+ var age = clampAge(maxAgeMs, DEFAULT_SESSION_ID_MAX_AGE_MS, MAX_SESSION_ID_AGE_MS);
657
+ var stored = readStored(SESSION_ID_KEY);
658
+ if (stored && isUsableAdId(stored.id) && stored.id !== avoidValue && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
659
+ return stored.id;
660
+ }
661
+ var id = createUuid();
662
+ while(id === avoidValue)id = createUuid();
663
+ writeStored(SESSION_ID_KEY, {
664
+ id: id,
665
+ createdAt: now
666
+ });
667
+ return id;
668
+ }
412
669
  // src/utils/vastEnvironmentSignals.ts
413
- var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
414
670
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
415
671
  var DEVICE_ID_STORAGE_KEYS = [
416
672
  "rdid",
@@ -429,49 +685,96 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
429
685
  "adid"
430
686
  ]);
431
687
  function resolveVastEnvironmentSignals(isCtv) {
432
- var bridgeSignals = readNativeBridgeSignals();
433
- var platformDevice = readPlatformNativeDeviceId();
434
- var bridgeDeviceId = validDeviceId(bridgeSignals.deviceId);
435
- var realDeviceId = bridgeDeviceId || (isCtv ? validDeviceId(readStoredDeviceId()) : void 0) || validDeviceId(platformDevice.deviceId);
436
- var deviceId = realDeviceId;
437
- var deviceIdType = (bridgeDeviceId ? bridgeSignals.deviceIdType : void 0) || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
438
- var platformLat = bridgeDeviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
439
- var limitAdTracking = deviceId != null ? platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking() : void 0;
440
- if (!deviceId && isCtv) {
441
- var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
442
- if (dpid) {
443
- deviceId = dpid;
444
- deviceIdType = "dpid";
445
- limitAdTracking = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking();
446
- }
447
- }
688
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
448
689
  var deviceTypeHint = resolveDeviceTypeHint(isCtv);
690
+ var identity = resolveDeviceIdentity(isCtv, options);
691
+ var identityFields = _object_spread({}, identity.deviceId ? {
692
+ deviceId: identity.deviceId
693
+ } : {}, identity.deviceId && identity.deviceIdType ? {
694
+ deviceIdType: identity.deviceIdType
695
+ } : {}, identity.deviceId && identity.limitAdTracking != null ? {
696
+ limitAdTracking: identity.limitAdTracking
697
+ } : {}, identity.source ? {
698
+ deviceIdSource: identity.source
699
+ } : {});
449
700
  if (isCtv) {
450
701
  return _object_spread_props(_object_spread({
451
702
  isCtv: true,
452
- sessionId: getOrCreateCtvSessionId()
453
- }, deviceId ? {
454
- deviceId: deviceId
455
- } : {}, deviceId && deviceIdType ? {
456
- deviceIdType: deviceIdType
457
- } : {}, deviceId && limitAdTracking != null ? {
458
- limitAdTracking: limitAdTracking
459
- } : {}), {
703
+ sessionId: getOrRotateSessionId(options.sessionIdMaxAgeMs, identity.deviceId)
704
+ }, identityFields), {
460
705
  deviceTypeHint: deviceTypeHint
461
706
  });
462
707
  }
463
708
  return _object_spread_props(_object_spread({
464
709
  isCtv: false
465
- }, deviceId ? {
466
- deviceId: deviceId
467
- } : {}, deviceId && deviceIdType ? {
468
- deviceIdType: deviceIdType
469
- } : {}, deviceId && limitAdTracking != null ? {
470
- limitAdTracking: limitAdTracking
471
- } : {}), {
710
+ }, identityFields), {
472
711
  deviceTypeHint: deviceTypeHint
473
712
  });
474
713
  }
714
+ function resolveDeviceIdentity(isCtv, options) {
715
+ var _platform_limitAdTracking;
716
+ var host = getHostAdIdentity();
717
+ if (host) {
718
+ var _host_deviceIdType;
719
+ return _object_spread_props(_object_spread({
720
+ deviceId: host.deviceId,
721
+ deviceIdType: (_host_deviceIdType = host.deviceIdType) !== null && _host_deviceIdType !== void 0 ? _host_deviceIdType : "dpid"
722
+ }, host.limitAdTracking != null ? {
723
+ limitAdTracking: host.limitAdTracking
724
+ } : {}), {
725
+ source: "host"
726
+ });
727
+ }
728
+ var bridge = readNativeBridgeSignals();
729
+ var bridgeDeviceId = validDeviceId(bridge.deviceId);
730
+ if (bridgeDeviceId) {
731
+ var _normalizeIdType;
732
+ return _object_spread_props(_object_spread({
733
+ deviceId: bridgeDeviceId,
734
+ deviceIdType: (_normalizeIdType = normalizeIdType(bridge.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
735
+ }, bridge.limitAdTracking != null ? {
736
+ limitAdTracking: bridge.limitAdTracking
737
+ } : {}), {
738
+ source: "bridge"
739
+ });
740
+ }
741
+ var platform = readPlatformNativeDeviceId();
742
+ var platformDeviceId = validDeviceId(platform.deviceId);
743
+ if (platformDeviceId) {
744
+ var _platform_deviceIdType;
745
+ return _object_spread_props(_object_spread({
746
+ deviceId: platformDeviceId,
747
+ deviceIdType: (_platform_deviceIdType = platform.deviceIdType) !== null && _platform_deviceIdType !== void 0 ? _platform_deviceIdType : "dpid"
748
+ }, platform.limitAdTracking != null ? {
749
+ limitAdTracking: platform.limitAdTracking
750
+ } : {}), {
751
+ source: "platform"
752
+ });
753
+ }
754
+ if (!isCtv) return {};
755
+ var storedDeviceId = validDeviceId(readStoredDeviceId());
756
+ if (storedDeviceId) {
757
+ var _normalizeIdType1;
758
+ var storedLat = readStoredLimitAdTracking();
759
+ return _object_spread_props(_object_spread({
760
+ deviceId: storedDeviceId,
761
+ deviceIdType: (_normalizeIdType1 = normalizeIdType(readStoredString("deviceIdType") || readStoredString("idtype"))) !== null && _normalizeIdType1 !== void 0 ? _normalizeIdType1 : "dpid"
762
+ }, storedLat != null ? {
763
+ limitAdTracking: storedLat
764
+ } : {}), {
765
+ source: "stored"
766
+ });
767
+ }
768
+ var fallbackLat = (_platform_limitAdTracking = platform.limitAdTracking) !== null && _platform_limitAdTracking !== void 0 ? _platform_limitAdTracking : readStoredLimitAdTracking();
769
+ return _object_spread_props(_object_spread({
770
+ deviceId: getOrRotateFallbackDeviceId(options.fallbackDeviceIdMaxAgeMs),
771
+ deviceIdType: "dpid"
772
+ }, fallbackLat != null ? {
773
+ limitAdTracking: fallbackLat
774
+ } : {}), {
775
+ source: "generated"
776
+ });
777
+ }
475
778
  var DEVICE_TYPE_HINT = {
476
779
  FEATURE_PHONE: 1,
477
780
  SMARTPHONE: 2,
@@ -632,7 +935,7 @@ function resolveNativeDeviceId() {
632
935
  var bridgeSignals = readNativeBridgeSignals();
633
936
  var platformDevice = readPlatformNativeDeviceId();
634
937
  var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
635
- if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
938
+ if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
636
939
  return void 0;
637
940
  }
638
941
  return deviceId;
@@ -646,20 +949,10 @@ function getOrCreateStoredUuid(storageKey) {
646
949
  writePersistentId(storageKey, existing);
647
950
  return existing;
648
951
  }
649
- var id = createUuid();
952
+ var id = createUuid2();
650
953
  writePersistentId(storageKey, id);
651
954
  return id;
652
955
  }
653
- function getOrCreateCtvSessionId() {
654
- var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
655
- if (existing) {
656
- writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
657
- return existing;
658
- }
659
- var sessionId = createUuid();
660
- writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
661
- return sessionId;
662
- }
663
956
  function readPersistentId(storageKey) {
664
957
  return readStoredString(storageKey) || readCookie(storageKey);
665
958
  }
@@ -712,7 +1005,7 @@ function writeCookie(name, value) {
712
1005
  document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
713
1006
  } catch (unused) {}
714
1007
  }
715
- function createUuid() {
1008
+ function createUuid2() {
716
1009
  var _bytes_, _bytes_1;
717
1010
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
718
1011
  return crypto.randomUUID();
@@ -746,44 +1039,10 @@ function performanceNow() {
746
1039
  }
747
1040
  function readPlatformNativeDeviceId() {
748
1041
  if (typeof window === "undefined") return {};
749
- try {
750
- var _window_webapis;
751
- var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
752
- if (adinfo) {
753
- var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
754
- if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
755
- var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
756
- return _object_spread({
757
- deviceId: tifa,
758
- deviceIdType: "tifa"
759
- }, typeof lat === "boolean" ? {
760
- limitAdTracking: lat
761
- } : {});
762
- }
763
- }
764
- } catch (unused) {}
765
- try {
766
- var webOSDev = window.webOSDev;
767
- if (webOSDev) {
768
- var _webOSDev_lgudid;
769
- var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
770
- if (typeof lgudid === "string" && lgudid) {
771
- if (isZeroedAdId(lgudid)) {
772
- return {
773
- deviceIdType: "lgudid",
774
- limitAdTracking: true
775
- };
776
- }
777
- if (!isMacroPlaceholder(lgudid)) {
778
- return {
779
- deviceId: lgudid,
780
- deviceIdType: "lgudid",
781
- limitAdTracking: false
782
- };
783
- }
784
- }
785
- }
786
- } catch (unused) {}
1042
+ var tifa = readSamsungTifa();
1043
+ if (tifa) return tifa;
1044
+ var lgudid = readCachedLgUdid();
1045
+ if (lgudid) return lgudid;
787
1046
  try {
788
1047
  var roku = window.Roku;
789
1048
  if (roku) {
@@ -810,7 +1069,7 @@ function isMacroPlaceholder(value) {
810
1069
  function validDeviceId(value) {
811
1070
  return value && !isMacroPlaceholder(value) ? value : void 0;
812
1071
  }
813
- function isZeroedAdId(value) {
1072
+ function isZeroedAdId2(value) {
814
1073
  return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
815
1074
  }
816
1075
  function readNativeBridgeSignals() {
@@ -854,7 +1113,7 @@ function readNativeBridgeSignals() {
854
1113
  "deviceIdType",
855
1114
  "advertisingIdType",
856
1115
  "idType"
857
- ]) || inferDeviceIdType();
1116
+ ]) || void 0;
858
1117
  var limitAdTracking = readBridgeBoolean(source, [
859
1118
  "is_lat",
860
1119
  "limitAdTracking",
@@ -1402,6 +1661,7 @@ function resolveScvpMacroValues(ctx) {
1402
1661
  set("GIVN", ctx.palNonce);
1403
1662
  set("CT-TI", ctx.programTitle);
1404
1663
  set("CT-CH", ctx.channelName);
1664
+ set("CT-NE", ctx.contentNetwork);
1405
1665
  set("POD", ctx.pod);
1406
1666
  set("CORRELATOR", ctx.correlator);
1407
1667
  set("SCOR", ctx.streamCorrelator);
@@ -1630,6 +1890,9 @@ function applyVastMacros(baseUrl, ctx) {
1630
1890
  if (ctx.channelName) {
1631
1891
  params.set("ct_ch", ctx.channelName);
1632
1892
  }
1893
+ if (ctx.contentNetwork) {
1894
+ params.set("ct_ne", ctx.contentNetwork);
1895
+ }
1633
1896
  var staleKeys = [];
1634
1897
  params.forEach(function(value, key) {
1635
1898
  if (isMacroPlaceholder2(value)) {
@@ -2294,8 +2557,17 @@ function detectBrowser() {
2294
2557
  chromeVersion: chromeVersionNum
2295
2558
  };
2296
2559
  }
2560
+ var singleDecoderOverride;
2561
+ function setSingleDecoderOverride(value) {
2562
+ singleDecoderOverride = value;
2563
+ }
2297
2564
  function requiresMediaPipelineResetAfterAds() {
2298
2565
  var _browser_tizenVersion;
2566
+ if (singleDecoderOverride != null) return singleDecoderOverride;
2567
+ try {
2568
+ var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
2569
+ if (typeof globalOverride === "boolean") return globalOverride;
2570
+ } catch (unused) {}
2299
2571
  var browser = detectBrowser();
2300
2572
  return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
2301
2573
  }
@@ -2455,7 +2727,7 @@ function substituteVastTrackingMacros(url) {
2455
2727
  });
2456
2728
  }
2457
2729
  // src/player/OptimizedPodRequest.ts
2458
- var DEFAULT_REQUEST_SAFETY_MS = 1500;
2730
+ var DEFAULT_REQUEST_SAFETY_MS = 2500;
2459
2731
  var GAM_AD_OPPORTUNITY_DURATION_MS = 3e4;
2460
2732
  var POD_PARAM_KEYS = [
2461
2733
  "pmnd",
@@ -2879,6 +3151,9 @@ function createHlsAdPlayer(contentVideo, options) {
2879
3151
  var mediaCandidateIndex = 0;
2880
3152
  var mediaStartTimerId;
2881
3153
  var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
3154
+ var MAX_MEDIA_START_ATTEMPTS = 2;
3155
+ var MEDIA_START_TOTAL_BUDGET_MS = Math.max(MEDIA_START_TIMEOUT_MS, 1e4);
3156
+ var mediaStartBudgetStartedAt = 0;
2882
3157
  var VAST_ERROR_MEDIA_TIMEOUT = 402;
2883
3158
  var pendingVastRequests = /* @__PURE__ */ new Set();
2884
3159
  var pendingRequestAbortReason;
@@ -4893,12 +5168,14 @@ function createHlsAdPlayer(contentVideo, options) {
4893
5168
  clearMediaStartTimer();
4894
5169
  if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
4895
5170
  var startedAt = Date.now();
5171
+ var budgetLeftMs = mediaStartBudgetStartedAt > 0 ? MEDIA_START_TOTAL_BUDGET_MS - (startedAt - mediaStartBudgetStartedAt) : MEDIA_START_TIMEOUT_MS;
5172
+ var timeoutMs = Math.max(1e3, Math.min(MEDIA_START_TIMEOUT_MS, budgetLeftMs));
4896
5173
  mediaStartTimerId = setTimeout(function() {
4897
5174
  mediaStartTimerId = void 0;
4898
5175
  if (!adPlaying || trackingFired.impression) return;
4899
- console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(MEDIA_START_TIMEOUT_MS, "ms"));
5176
+ console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(timeoutMs, "ms"));
4900
5177
  logFunnel("play_resolved_but_never_started", {
4901
- timeoutMs: MEDIA_START_TIMEOUT_MS,
5178
+ timeoutMs: timeoutMs,
4902
5179
  elapsedMs: Date.now() - startedAt,
4903
5180
  readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
4904
5181
  networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
@@ -4907,7 +5184,7 @@ function createHlsAdPlayer(contentVideo, options) {
4907
5184
  vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
4908
5185
  });
4909
5186
  recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
4910
- }, MEDIA_START_TIMEOUT_MS);
5187
+ }, timeoutMs);
4911
5188
  }
4912
5189
  function resetVideoElementForNextSource() {
4913
5190
  clearStallWatchdog();
@@ -4922,6 +5199,20 @@ function createHlsAdPlayer(contentVideo, options) {
4922
5199
  function tryNextMediaCandidate() {
4923
5200
  if (!currentAd || trackingFired.impression) return false;
4924
5201
  if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
5202
+ if (mediaCandidateIndex + 1 >= MAX_MEDIA_START_ATTEMPTS) {
5203
+ logFunnel("media_fallback_capped", {
5204
+ reason: "max_attempts",
5205
+ attempts: mediaCandidateIndex + 1
5206
+ });
5207
+ return false;
5208
+ }
5209
+ if (mediaStartBudgetStartedAt > 0 && Date.now() - mediaStartBudgetStartedAt >= MEDIA_START_TOTAL_BUDGET_MS) {
5210
+ logFunnel("media_fallback_capped", {
5211
+ reason: "time_budget",
5212
+ elapsedMs: Date.now() - mediaStartBudgetStartedAt
5213
+ });
5214
+ return false;
5215
+ }
4925
5216
  var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
4926
5217
  mediaCandidateIndex++;
4927
5218
  var next = mediaCandidates[mediaCandidateIndex];
@@ -4955,6 +5246,7 @@ function createHlsAdPlayer(contentVideo, options) {
4955
5246
  }
4956
5247
  mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
4957
5248
  mediaCandidateIndex = 0;
5249
+ mediaStartBudgetStartedAt = Date.now();
4958
5250
  var mediaFile = mediaCandidates[0];
4959
5251
  if (!mediaFile) {
4960
5252
  logFunnel("media_unsupported", {
@@ -5894,6 +6186,7 @@ function getOrCreateNonceLoader(allowStorage) {
5894
6186
  }
5895
6187
  function createPalNonceManager() {
5896
6188
  var currentNonce = "";
6189
+ var currentNonceCreatedAt = 0;
5897
6190
  var currentNonceManager;
5898
6191
  var pendingNonce;
5899
6192
  return {
@@ -5910,6 +6203,9 @@ function createPalNonceManager() {
5910
6203
  getCurrentNonce: function getCurrentNonce() {
5911
6204
  return currentNonce;
5912
6205
  },
6206
+ getNonceAgeMs: function getNonceAgeMs() {
6207
+ return currentNonce ? Date.now() - currentNonceCreatedAt : void 0;
6208
+ },
5913
6209
  waitForNonce: function waitForNonce(maxWaitMs) {
5914
6210
  if (currentNonce) return Promise.resolve(currentNonce);
5915
6211
  var pending = pendingNonce;
@@ -5962,13 +6258,14 @@ function createPalNonceManager() {
5962
6258
  },
5963
6259
  reset: function reset() {
5964
6260
  currentNonce = "";
6261
+ currentNonceCreatedAt = 0;
5965
6262
  currentNonceManager = void 0;
5966
6263
  pendingNonce = void 0;
5967
6264
  }
5968
6265
  };
5969
6266
  function generate(options) {
5970
6267
  return _async_to_generator(function() {
5971
- var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
6268
+ var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, _options_iconsSupported, _options_supportedApiFrameworks, loader, goog, request, apiFrameworks, manager, error;
5972
6269
  return _ts_generator(this, function(_state) {
5973
6270
  switch(_state.label){
5974
6271
  case 0:
@@ -5992,10 +6289,11 @@ function createPalNonceManager() {
5992
6289
  request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
5993
6290
  request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
5994
6291
  request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
5995
- request.iconsSupported = true;
6292
+ request.iconsSupported = (_options_iconsSupported = options.iconsSupported) !== null && _options_iconsSupported !== void 0 ? _options_iconsSupported : false;
5996
6293
  request.playerType = "StormcloudVideoPlayer";
5997
6294
  request.playerVersion = "1.0";
5998
- request.supportedApiFrameworks = "2,7,9";
6295
+ apiFrameworks = ((_options_supportedApiFrameworks = options.supportedApiFrameworks) !== null && _options_supportedApiFrameworks !== void 0 ? _options_supportedApiFrameworks : "").trim();
6296
+ if (apiFrameworks) request.supportedApiFrameworks = apiFrameworks;
5999
6297
  request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
6000
6298
  request.videoWidth = options.videoWidth || 640;
6001
6299
  request.videoHeight = options.videoHeight || 480;
@@ -6025,6 +6323,7 @@ function createPalNonceManager() {
6025
6323
  manager = _state.sent();
6026
6324
  currentNonceManager = manager;
6027
6325
  currentNonce = manager.getNonce();
6326
+ currentNonceCreatedAt = Date.now();
6028
6327
  console.log("[PAL] Nonce generated successfully");
6029
6328
  return [
6030
6329
  2,
@@ -6048,6 +6347,549 @@ function createPalNonceManager() {
6048
6347
  })();
6049
6348
  }
6050
6349
  }
6350
+ // src/utils/deviceInfo.ts
6351
+ var CATEGORY_CODES = {
6352
+ "LG TV": "lg_tv",
6353
+ "LG Set-Top Box": "lg_stb",
6354
+ "Samsung TV": "samsung_tv",
6355
+ Other: "other"
6356
+ };
6357
+ var DEVICE_CATEGORIES = [
6358
+ "LG TV",
6359
+ "LG Set-Top Box",
6360
+ "Samsung TV",
6361
+ "Other"
6362
+ ];
6363
+ var hostDeviceInfo;
6364
+ var lgDeviceInfo;
6365
+ var platformCache;
6366
+ var primePromise;
6367
+ function cleanString(value) {
6368
+ var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
6369
+ if (typeof value !== "string") return void 0;
6370
+ var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
6371
+ if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
6372
+ return t.length > maxLength ? t.slice(0, maxLength) : t;
6373
+ }
6374
+ function safeCall2(fn, thisArg) {
6375
+ if (typeof fn !== "function") return void 0;
6376
+ try {
6377
+ return fn.call(thisArg);
6378
+ } catch (unused) {
6379
+ return void 0;
6380
+ }
6381
+ }
6382
+ function userAgent() {
6383
+ return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
6384
+ }
6385
+ function bridgeSources() {
6386
+ if (typeof window === "undefined") return [];
6387
+ var w = window;
6388
+ return [
6389
+ w.__STORMCLOUD_CTV__,
6390
+ w.__STORMCLOUD_CTV_AD_INFO__,
6391
+ w.stormcloudCtv
6392
+ ].filter(Boolean);
6393
+ }
6394
+ function readBridge(keys) {
6395
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6396
+ try {
6397
+ for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6398
+ var source = _step.value;
6399
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6400
+ try {
6401
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6402
+ var key = _step1.value;
6403
+ var value = void 0;
6404
+ try {
6405
+ value = source === null || source === void 0 ? void 0 : source[key];
6406
+ if (typeof value === "function") value = value.call(source);
6407
+ } catch (unused) {
6408
+ value = void 0;
6409
+ }
6410
+ var clean = cleanString(value);
6411
+ if (clean) return clean;
6412
+ }
6413
+ } catch (err) {
6414
+ _didIteratorError1 = true;
6415
+ _iteratorError1 = err;
6416
+ } finally{
6417
+ try {
6418
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6419
+ _iterator1.return();
6420
+ }
6421
+ } finally{
6422
+ if (_didIteratorError1) {
6423
+ throw _iteratorError1;
6424
+ }
6425
+ }
6426
+ }
6427
+ }
6428
+ } catch (err) {
6429
+ _didIteratorError = true;
6430
+ _iteratorError = err;
6431
+ } finally{
6432
+ try {
6433
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6434
+ _iterator.return();
6435
+ }
6436
+ } finally{
6437
+ if (_didIteratorError) {
6438
+ throw _iteratorError;
6439
+ }
6440
+ }
6441
+ }
6442
+ return void 0;
6443
+ }
6444
+ function normalizeCategory(value) {
6445
+ var v = cleanString(value);
6446
+ if (!v) return void 0;
6447
+ var exact = DEVICE_CATEGORIES.find(function(c) {
6448
+ return c.toLowerCase() === v.toLowerCase();
6449
+ });
6450
+ if (exact) return exact;
6451
+ var code = v.toLowerCase().replace(/[\s-]+/g, "_");
6452
+ var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
6453
+ return CATEGORY_CODES[c] === code;
6454
+ });
6455
+ return byCode;
6456
+ }
6457
+ function parseUserAgentDeviceInfo(ua) {
6458
+ var sources = [];
6459
+ var out = {
6460
+ platform: "other",
6461
+ sources: sources
6462
+ };
6463
+ var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
6464
+ if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
6465
+ if (/Web0S|webOS/i.test(ua)) {
6466
+ out.platform = "webos";
6467
+ var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
6468
+ if (lg && lg[1] && lg[2]) {
6469
+ out.model = lg[1];
6470
+ out.firmware = lg[2];
6471
+ sources.push("user_agent");
6472
+ }
6473
+ } else if (/Tizen/i.test(ua)) {
6474
+ out.platform = "tizen";
6475
+ var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
6476
+ if (tizen && tizen[1]) {
6477
+ out.osVersion = "Tizen ".concat(tizen[1]);
6478
+ sources.push("user_agent");
6479
+ }
6480
+ }
6481
+ return out;
6482
+ }
6483
+ function readSamsungProductInfo() {
6484
+ var _cleanString;
6485
+ var _window_webapis;
6486
+ if (typeof window === "undefined") return void 0;
6487
+ var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
6488
+ if (!productinfo) return void 0;
6489
+ var model = (_cleanString = cleanString(safeCall2(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall2(productinfo.getModel, productinfo), 40);
6490
+ var firmware = cleanString(safeCall2(productinfo.getFirmware, productinfo), 64);
6491
+ var duid = cleanString(safeCall2(productinfo.getDuid, productinfo), 128);
6492
+ if (!model && !firmware && !duid) return void 0;
6493
+ return _object_spread({}, model ? {
6494
+ model: model
6495
+ } : {}, firmware ? {
6496
+ firmware: firmware
6497
+ } : {}, duid ? {
6498
+ internalDeviceId: duid,
6499
+ internalDeviceIdSource: "samsung_duid"
6500
+ } : {});
6501
+ }
6502
+ function readLgDeviceInfo(timeoutMs) {
6503
+ var webOS = typeof window !== "undefined" ? window.webOS : void 0;
6504
+ if (lgDeviceInfo || !webOS || typeof webOS.deviceInfo !== "function") return Promise.resolve();
6505
+ return new Promise(function(resolve) {
6506
+ var settled = false;
6507
+ var finish = function finish() {
6508
+ if (settled) return;
6509
+ settled = true;
6510
+ clearTimeout(timer);
6511
+ resolve();
6512
+ };
6513
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
6514
+ try {
6515
+ webOS.deviceInfo(function(info) {
6516
+ var model = cleanString(info === null || info === void 0 ? void 0 : info.modelName, 40);
6517
+ var firmware = cleanString(info === null || info === void 0 ? void 0 : info.version, 64);
6518
+ var sdkVersion = cleanString(info === null || info === void 0 ? void 0 : info.sdkVersion, 32);
6519
+ lgDeviceInfo = _object_spread({}, model ? {
6520
+ model: model
6521
+ } : {}, firmware ? {
6522
+ firmware: firmware
6523
+ } : {}, sdkVersion ? {
6524
+ sdkVersion: sdkVersion
6525
+ } : {});
6526
+ finish();
6527
+ });
6528
+ } catch (unused) {
6529
+ finish();
6530
+ }
6531
+ });
6532
+ }
6533
+ function computePlatformInfo() {
6534
+ var info = parseUserAgentDeviceInfo(userAgent());
6535
+ var sources = _to_consumable_array(info.sources);
6536
+ var samsung = readSamsungProductInfo();
6537
+ if (samsung) {
6538
+ info.platform = "tizen";
6539
+ if (samsung.model) info.model = samsung.model;
6540
+ if (samsung.firmware) info.firmware = samsung.firmware;
6541
+ if (samsung.internalDeviceId) {
6542
+ info.internalDeviceId = samsung.internalDeviceId;
6543
+ info.internalDeviceIdSource = "samsung_duid";
6544
+ }
6545
+ sources.push("samsung_productinfo");
6546
+ }
6547
+ if (lgDeviceInfo) {
6548
+ info.platform = "webos";
6549
+ if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
6550
+ if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
6551
+ if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
6552
+ sources.push("lg_deviceinfo");
6553
+ }
6554
+ var lgUdid = readCachedLgUdid();
6555
+ if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
6556
+ info.internalDeviceId = lgUdid.deviceId;
6557
+ info.internalDeviceIdSource = "lg_udid";
6558
+ sources.push("lg_udid");
6559
+ }
6560
+ info.sources = sources;
6561
+ return info;
6562
+ }
6563
+ function categorize(platform, model) {
6564
+ if (platform === "tizen") return "Samsung TV";
6565
+ if (platform === "webos") {
6566
+ var ua = userAgent();
6567
+ if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
6568
+ return "LG TV";
6569
+ }
6570
+ return "Other";
6571
+ }
6572
+ function setHostDeviceInfo(info) {
6573
+ hostDeviceInfo = info ? _object_spread({}, info) : void 0;
6574
+ }
6575
+ function primeDeviceInfo() {
6576
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1500;
6577
+ if (!primePromise) {
6578
+ primePromise = Promise.all([
6579
+ readLgDeviceInfo(timeoutMs),
6580
+ primeLgUdid(timeoutMs)
6581
+ ]).catch(function() {
6582
+ return void 0;
6583
+ }).then(function() {
6584
+ platformCache = computePlatformInfo();
6585
+ return getDeviceInfo();
6586
+ });
6587
+ }
6588
+ return primePromise;
6589
+ }
6590
+ function getDeviceInfo() {
6591
+ var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
6592
+ var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
6593
+ if (primePromise && !platformCache) {} else {
6594
+ platformCache = platform;
6595
+ }
6596
+ var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
6597
+ var bridge = {
6598
+ terminalId: readBridge([
6599
+ "terminalId",
6600
+ "terminal_id"
6601
+ ]),
6602
+ internalDeviceId: readBridge([
6603
+ "internalDeviceId",
6604
+ "internal_device_id"
6605
+ ]),
6606
+ model: readBridge([
6607
+ "deviceModel"
6608
+ ]),
6609
+ firmware: readBridge([
6610
+ "firmwareVersion"
6611
+ ]),
6612
+ category: normalizeCategory(readBridge([
6613
+ "deviceCategory"
6614
+ ]))
6615
+ };
6616
+ var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
6617
+ var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
6618
+ var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
6619
+ var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
6620
+ var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
6621
+ var sources = _to_consumable_array(platform.sources);
6622
+ var bridgeValues = [
6623
+ bridge.terminalId,
6624
+ bridge.internalDeviceId,
6625
+ bridge.model,
6626
+ bridge.firmware,
6627
+ bridge.category
6628
+ ];
6629
+ if (bridgeValues.some(function(v) {
6630
+ return v !== void 0;
6631
+ })) sources.unshift("bridge");
6632
+ if (hostDeviceInfo) sources.unshift("host");
6633
+ var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
6634
+ var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
6635
+ var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
6636
+ return _object_spread_props(_object_spread({
6637
+ category: category,
6638
+ categoryCode: CATEGORY_CODES[category]
6639
+ }, model ? {
6640
+ model: model
6641
+ } : {}, sonifiModel ? {
6642
+ sonifiModel: sonifiModel
6643
+ } : {}, firmware ? {
6644
+ firmware: firmware
6645
+ } : {}, platform.osVersion ? {
6646
+ osVersion: platform.osVersion
6647
+ } : {}, platform.browserMajorVersion != null ? {
6648
+ browserMajorVersion: platform.browserMajorVersion
6649
+ } : {}, internalDeviceId ? {
6650
+ internalDeviceId: internalDeviceId
6651
+ } : {}, internalDeviceId && internalDeviceIdSource ? {
6652
+ internalDeviceIdSource: internalDeviceIdSource
6653
+ } : {}, terminalId ? {
6654
+ terminalId: terminalId
6655
+ } : {}), {
6656
+ sources: sources
6657
+ });
6658
+ }
6659
+ var DEVICE_KEY_VALUE_KEYS = {
6660
+ category: "sc_dev",
6661
+ model: "sc_model",
6662
+ firmware: "sc_fw"
6663
+ };
6664
+ function sanitizeKeyValue(value) {
6665
+ if (typeof value !== "string") return void 0;
6666
+ var v = value.trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
6667
+ return v ? v.slice(0, 40) : void 0;
6668
+ }
6669
+ function deviceKeyValuePairs(info) {
6670
+ var pairs = [
6671
+ [
6672
+ DEVICE_KEY_VALUE_KEYS.category,
6673
+ info.categoryCode
6674
+ ]
6675
+ ];
6676
+ var model = sanitizeKeyValue(info.model);
6677
+ var firmware = sanitizeKeyValue(info.firmware);
6678
+ if (model) pairs.push([
6679
+ DEVICE_KEY_VALUE_KEYS.model,
6680
+ model
6681
+ ]);
6682
+ if (firmware) pairs.push([
6683
+ DEVICE_KEY_VALUE_KEYS.firmware,
6684
+ firmware
6685
+ ]);
6686
+ return pairs;
6687
+ }
6688
+ function applyDeviceKeyValues(url, info) {
6689
+ try {
6690
+ var parsed = new URL(url);
6691
+ var pairs = deviceKeyValuePairs(info);
6692
+ var ours = new Set(pairs.map(function(param) {
6693
+ var _param = _sliced_to_array(param, 1), k = _param[0];
6694
+ return k;
6695
+ }));
6696
+ var existing = (parsed.searchParams.get("cust_params") || "").split("&").filter(function(p) {
6697
+ var _p_split_;
6698
+ return p !== "" && !ours.has((_p_split_ = p.split("=")[0]) !== null && _p_split_ !== void 0 ? _p_split_ : "");
6699
+ });
6700
+ var merged = existing.concat(pairs.map(function(param) {
6701
+ var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
6702
+ return "".concat(k, "=").concat(v);
6703
+ })).join("&");
6704
+ parsed.searchParams.set("cust_params", merged);
6705
+ return parsed.toString();
6706
+ } catch (unused) {
6707
+ return url;
6708
+ }
6709
+ }
6710
+ function deviceInfoAnalyticsFields(info) {
6711
+ return _object_spread({
6712
+ device_category: info.category
6713
+ }, info.model ? {
6714
+ device_model: info.model
6715
+ } : {}, info.sonifiModel ? {
6716
+ sonifi_model: info.sonifiModel
6717
+ } : {}, info.firmware ? {
6718
+ firmware_version: info.firmware
6719
+ } : {}, info.osVersion ? {
6720
+ os_version: info.osVersion
6721
+ } : {}, info.browserMajorVersion != null ? {
6722
+ browser_major_version: info.browserMajorVersion
6723
+ } : {}, info.internalDeviceId ? {
6724
+ internal_device_id: info.internalDeviceId
6725
+ } : {}, info.internalDeviceIdSource ? {
6726
+ internal_device_id_source: info.internalDeviceIdSource
6727
+ } : {}, info.terminalId ? {
6728
+ terminal_id: info.terminalId
6729
+ } : {});
6730
+ }
6731
+ // src/utils/contentMetadata.ts
6732
+ var MAX_CONTENT_VALUE_LENGTH = 128;
6733
+ var BRIDGE_KEYS = {
6734
+ channelName: [
6735
+ "channelName",
6736
+ "ct_ch"
6737
+ ],
6738
+ programTitle: [
6739
+ "programTitle",
6740
+ "ct_ti"
6741
+ ],
6742
+ contentNetwork: [
6743
+ "contentNetwork",
6744
+ "ct_ne"
6745
+ ]
6746
+ };
6747
+ function sanitizeContentValue(value) {
6748
+ if (typeof value !== "string") return void 0;
6749
+ var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
6750
+ if (!cleaned) return void 0;
6751
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
6752
+ if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
6753
+ return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
6754
+ }
6755
+ function bridgeSources2() {
6756
+ if (typeof window === "undefined") return [];
6757
+ var w = window;
6758
+ return [
6759
+ w.__STORMCLOUD_CTV__,
6760
+ w.__STORMCLOUD_CTV_AD_INFO__,
6761
+ w.stormcloudCtv
6762
+ ].filter(Boolean);
6763
+ }
6764
+ function readBridgeContentValue(keys) {
6765
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6766
+ try {
6767
+ for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6768
+ var source = _step.value;
6769
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6770
+ try {
6771
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6772
+ var key = _step1.value;
6773
+ var value = void 0;
6774
+ try {
6775
+ value = source === null || source === void 0 ? void 0 : source[key];
6776
+ if (typeof value === "function") value = value.call(source);
6777
+ } catch (unused) {
6778
+ value = void 0;
6779
+ }
6780
+ var sanitized = sanitizeContentValue(value);
6781
+ if (sanitized) return sanitized;
6782
+ }
6783
+ } catch (err) {
6784
+ _didIteratorError1 = true;
6785
+ _iteratorError1 = err;
6786
+ } finally{
6787
+ try {
6788
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6789
+ _iterator1.return();
6790
+ }
6791
+ } finally{
6792
+ if (_didIteratorError1) {
6793
+ throw _iteratorError1;
6794
+ }
6795
+ }
6796
+ }
6797
+ }
6798
+ } catch (err) {
6799
+ _didIteratorError = true;
6800
+ _iteratorError = err;
6801
+ } finally{
6802
+ try {
6803
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6804
+ _iterator.return();
6805
+ }
6806
+ } finally{
6807
+ if (_didIteratorError) {
6808
+ throw _iteratorError;
6809
+ }
6810
+ }
6811
+ }
6812
+ return void 0;
6813
+ }
6814
+ function resolveContentMetadata(config) {
6815
+ var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2;
6816
+ var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
6817
+ var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
6818
+ var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
6819
+ return _object_spread({}, channelName ? {
6820
+ channelName: channelName
6821
+ } : {}, programTitle ? {
6822
+ programTitle: programTitle
6823
+ } : {}, contentNetwork ? {
6824
+ contentNetwork: contentNetwork
6825
+ } : {});
6826
+ }
6827
+ function appendMissingContentParams(url, meta) {
6828
+ if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
6829
+ try {
6830
+ var parsed = new URL(url);
6831
+ var add = function add(key, value) {
6832
+ if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
6833
+ };
6834
+ add("ct_ch", meta.channelName);
6835
+ add("ct_ti", meta.programTitle);
6836
+ add("ct_ne", meta.contentNetwork);
6837
+ return parsed.toString();
6838
+ } catch (unused) {
6839
+ return url;
6840
+ }
6841
+ }
6842
+ // src/utils/screenActivity.ts
6843
+ var hostStandby = false;
6844
+ function setHostStandby(standby) {
6845
+ hostStandby = !!standby;
6846
+ }
6847
+ function toBoolean(value) {
6848
+ if (typeof value === "boolean") return value;
6849
+ if (typeof value === "number") return value === 1;
6850
+ if (typeof value === "string") {
6851
+ var v = value.trim().toLowerCase();
6852
+ if (v === "true" || v === "1" || v === "yes") return true;
6853
+ if (v === "false" || v === "0" || v === "no") return false;
6854
+ }
6855
+ return void 0;
6856
+ }
6857
+ function bridgeSaysStandby() {
6858
+ if (typeof window === "undefined") return false;
6859
+ var w = window;
6860
+ for(var _i = 0, _iter = [
6861
+ w.__STORMCLOUD_CTV__,
6862
+ w.__STORMCLOUD_CTV_AD_INFO__,
6863
+ w.stormcloudCtv
6864
+ ]; _i < _iter.length; _i++){
6865
+ var source = _iter[_i];
6866
+ if (!source) continue;
6867
+ for(var _i1 = 0, _iter1 = [
6868
+ "standby",
6869
+ "isStandby",
6870
+ "screenOff"
6871
+ ]; _i1 < _iter1.length; _i1++){
6872
+ var key = _iter1[_i1];
6873
+ var value = void 0;
6874
+ try {
6875
+ value = source[key];
6876
+ if (typeof value === "function") value = value.call(source);
6877
+ } catch (unused) {
6878
+ value = void 0;
6879
+ }
6880
+ if (toBoolean(value) === true) return true;
6881
+ }
6882
+ }
6883
+ return false;
6884
+ }
6885
+ function getScreenInactiveReason() {
6886
+ if (hostStandby) return "host_standby";
6887
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") {
6888
+ return "document_hidden";
6889
+ }
6890
+ if (bridgeSaysStandby()) return "bridge_standby";
6891
+ return void 0;
6892
+ }
6051
6893
  // src/utils/trackingIngest.ts
6052
6894
  var DEFAULT_TRACKING_INGEST_CONFIG = {
6053
6895
  enabled: true,
@@ -6129,20 +6971,25 @@ function ingestPlayerTracking(licenseKey, channel, body) {
6129
6971
  // src/utils/tracking.ts
6130
6972
  var cachedBrowserId = null;
6131
6973
  function buildAnalyticsContext(config) {
6132
- var _config_contentNetwork, _config_channelName, _config_programTitle;
6974
+ var _config_contentNetwork, _config_channelName, _config_programTitle, _config_src;
6133
6975
  var context = {};
6134
6976
  var contentNetwork = (_config_contentNetwork = config.contentNetwork) === null || _config_contentNetwork === void 0 ? void 0 : _config_contentNetwork.trim();
6135
6977
  var contentChannel = (_config_channelName = config.channelName) === null || _config_channelName === void 0 ? void 0 : _config_channelName.trim();
6136
6978
  var contentTitle = (_config_programTitle = config.programTitle) === null || _config_programTitle === void 0 ? void 0 : _config_programTitle.trim();
6979
+ var hlsUrl = (_config_src = config.src) === null || _config_src === void 0 ? void 0 : _config_src.trim();
6137
6980
  if (contentNetwork) context.contentNetwork = contentNetwork;
6138
6981
  if (contentChannel) context.contentChannel = contentChannel;
6139
6982
  if (contentTitle) context.contentTitle = contentTitle;
6983
+ if (hlsUrl) context.hlsUrl = hlsUrl;
6140
6984
  if (config.debugAdTiming) {
6141
6985
  context.debugAdTiming = true;
6142
6986
  }
6143
6987
  if (config.isLiveStream !== void 0) {
6144
6988
  context.inputStreamType = config.isLiveStream ? "live" : "vod";
6145
6989
  }
6990
+ if (config.sendDeviceInfoToAnalytics) {
6991
+ context.includeDeviceInfo = true;
6992
+ }
6146
6993
  return context;
6147
6994
  }
6148
6995
  function getClientInfo() {
@@ -6438,7 +7285,7 @@ function buildPlayerMetricEvent() {
6438
7285
  capture_at: captureAt
6439
7286
  }, context.inputStreamType ? {
6440
7287
  input_stream_type: context.inputStreamType
6441
- } : {})
7288
+ } : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
6442
7289
  ];
6443
7290
  }
6444
7291
  });
@@ -6642,6 +7489,8 @@ function sendAdImpressionTracking(_0, _1) {
6642
7489
  content_channel: context.contentChannel
6643
7490
  } : {}, context.contentTitle ? {
6644
7491
  content_title: context.contentTitle
7492
+ } : {}, context.hlsUrl ? {
7493
+ hls_url: context.hlsUrl
6645
7494
  } : {})
6646
7495
  ]
6647
7496
  })
@@ -8464,7 +9313,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
8464
9313
  key: "generatePodVastUrl",
8465
9314
  value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
8466
9315
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
8467
- var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
9316
+ var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
9317
+ fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
9318
+ sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
9319
+ });
9320
+ var content = resolveContentMetadata(this.config);
8468
9321
  var macroContext = _object_spread_props(_object_spread({
8469
9322
  correlator: this.viewCorrelator,
8470
9323
  streamCorrelator: this.streamCorrelator,
@@ -8479,10 +9332,12 @@ var AdConfigManager = /*#__PURE__*/ function() {
8479
9332
  limitAdTracking: envSignals.limitAdTracking,
8480
9333
  deviceTypeHint: envSignals.deviceTypeHint,
8481
9334
  adTest: this.config.adTest
8482
- }, this.config.programTitle ? {
8483
- programTitle: this.config.programTitle
8484
- } : {}, this.config.channelName ? {
8485
- channelName: this.config.channelName
9335
+ }, content.programTitle ? {
9336
+ programTitle: content.programTitle
9337
+ } : {}, content.channelName ? {
9338
+ channelName: content.channelName
9339
+ } : {}, content.contentNetwork ? {
9340
+ contentNetwork: content.contentNetwork
8486
9341
  } : {}), {
8487
9342
  consent: this.consentSignals,
8488
9343
  palNonce: palNonce.getCurrentNonce() || void 0
@@ -8500,6 +9355,24 @@ var AdConfigManager = /*#__PURE__*/ function() {
8500
9355
  } else {
8501
9356
  finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
8502
9357
  }
9358
+ finalUrl = appendMissingContentParams(finalUrl, content);
9359
+ if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
9360
+ finalUrl = applyDeviceKeyValues(finalUrl, getDeviceInfo());
9361
+ }
9362
+ if (this.debug) {
9363
+ var id = envSignals.deviceId;
9364
+ console.log("[AD-IDENTITY]", {
9365
+ source: envSignals.deviceIdSource,
9366
+ idtype: envSignals.deviceIdType,
9367
+ rdidTail: id ? id.slice(-4) : void 0,
9368
+ isLat: envSignals.limitAdTracking,
9369
+ dth: envSignals.deviceTypeHint,
9370
+ sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
9371
+ ct_ch: content.channelName,
9372
+ ct_ti: content.programTitle,
9373
+ ct_ne: content.contentNetwork
9374
+ });
9375
+ }
8503
9376
  console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
8504
9377
  return finalUrl;
8505
9378
  }
@@ -8551,7 +9424,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
8551
9424
  }
8552
9425
  },
8553
9426
  {
8554
- // --- Tracking ---
8555
9427
  key: "initializeTracking",
8556
9428
  value: function initializeTracking() {
8557
9429
  var _this = this;
@@ -8643,7 +9515,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8643
9515
  }
8644
9516
  },
8645
9517
  {
8646
- // --- Ad stop timer ---
8647
9518
  key: "scheduleAdStopCountdown",
8648
9519
  value: function scheduleAdStopCountdown(remainingMs) {
8649
9520
  var _this = this;
@@ -8675,7 +9546,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8675
9546
  }
8676
9547
  },
8677
9548
  {
8678
- // --- Ad start timer ---
8679
9549
  key: "scheduleAdStartIn",
8680
9550
  value: function scheduleAdStartIn(delayMs) {
8681
9551
  var _this = this;
@@ -8703,7 +9573,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8703
9573
  }
8704
9574
  },
8705
9575
  {
8706
- // --- PTS drift ---
8707
9576
  key: "updatePtsDrift",
8708
9577
  value: function updatePtsDrift(ptsSecondsSample) {
8709
9578
  var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
@@ -8729,7 +9598,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8729
9598
  }
8730
9599
  },
8731
9600
  {
8732
- // --- Duration boundary ---
8733
9601
  key: "beginBreakTiming",
8734
9602
  value: function beginBreakTiming(startWallClockMs) {
8735
9603
  this.currentAdBreakStartWallClockMs = startWallClockMs;
@@ -8777,7 +9645,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8777
9645
  }
8778
9646
  },
8779
9647
  {
8780
- // --- Duration budget ---
8781
9648
  key: "getWallClockRemainingAdMs",
8782
9649
  value: function getWallClockRemainingAdMs() {
8783
9650
  var endWallClockMs = this.getAdBreakEndWallClockMs();
@@ -8926,7 +9793,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8926
9793
  }
8927
9794
  },
8928
9795
  {
8929
- // --- Circuit breaker ---
8930
9796
  key: "isTemporaryAdError",
8931
9797
  value: function isTemporaryAdError(error) {
8932
9798
  var _error_message;
@@ -9060,7 +9926,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9060
9926
  }
9061
9927
  },
9062
9928
  {
9063
- // --- Watchdog ---
9064
9929
  key: "startAdRequestWatchdog",
9065
9930
  value: function startAdRequestWatchdog(token) {
9066
9931
  var _this = this;
@@ -9105,7 +9970,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9105
9970
  }
9106
9971
  },
9107
9972
  {
9108
- // --- Failsafe ---
9109
9973
  key: "startAdFailsafeTimer",
9110
9974
  value: function startAdFailsafeTimer(token) {
9111
9975
  var _this = this;
@@ -9167,7 +10031,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9167
10031
  }
9168
10032
  },
9169
10033
  {
9170
- // --- Reset for ad break end ---
9171
10034
  key: "resetForBreakEnd",
9172
10035
  value: function resetForBreakEnd() {
9173
10036
  this.clearAdStopTimer();
@@ -9366,7 +10229,7 @@ var HlsEngine = /*#__PURE__*/ function() {
9366
10229
  adBehavior: adBehavior
9367
10230
  });
9368
10231
  }
9369
- if (!this.config.autoplay) return [
10232
+ if (!(this.config.autoplay && !this.callbacks.shouldHoldContentForAds())) return [
9370
10233
  3,
9371
10234
  2
9372
10235
  ];
@@ -9557,6 +10420,12 @@ var HlsEngine = /*#__PURE__*/ function() {
9557
10420
  2
9558
10421
  ];
9559
10422
  this.hasInitialBufferCompleted = true;
10423
+ if (this.shouldAutoplayAfterBuffering && this.callbacks.shouldHoldContentForAds()) {
10424
+ this.shouldAutoplayAfterBuffering = false;
10425
+ if (this.debug) {
10426
+ console.log("[StormcloudVideoPlayer] Buffer ready during an ad break; content stays paused until the break ends");
10427
+ }
10428
+ }
9560
10429
  if (!this.shouldAutoplayAfterBuffering) return [
9561
10430
  3,
9562
10431
  2
@@ -10214,9 +11083,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10214
11083
  }
10215
11084
  },
10216
11085
  {
10217
- // ───────────────────────────────────────────────────────────────
10218
- // IMA event listeners
10219
- // ───────────────────────────────────────────────────────────────
10220
11086
  key: "nextAdRequestUrl",
10221
11087
  value: function nextAdRequestUrl(baseVastUrl) {
10222
11088
  return this.host.generatePodVastUrl(baseVastUrl);
@@ -10452,9 +11318,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10452
11318
  }
10453
11319
  },
10454
11320
  {
10455
- // ───────────────────────────────────────────────────────────────
10456
- // Ad break start
10457
- // ───────────────────────────────────────────────────────────────
10458
11321
  key: "isBreakActive",
10459
11322
  value: function isBreakActive() {
10460
11323
  return this.slotState !== "IDLE";
@@ -10482,7 +11345,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10482
11345
  key: "handleAdStart",
10483
11346
  value: function handleAdStart(marker) {
10484
11347
  return _async_to_generator(function() {
10485
- var baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
11348
+ var screenInactiveReason, baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
10486
11349
  return _ts_generator(this, function(_state) {
10487
11350
  switch(_state.label){
10488
11351
  case 0:
@@ -10495,6 +11358,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10495
11358
  2
10496
11359
  ];
10497
11360
  }
11361
+ screenInactiveReason = getScreenInactiveReason();
11362
+ if (screenInactiveReason) {
11363
+ this.logOrchestratorFunnel("break_skipped_screen_inactive", {
11364
+ reason: screenInactiveReason
11365
+ });
11366
+ this.clearPendingAdBreak();
11367
+ return [
11368
+ 2
11369
+ ];
11370
+ }
10498
11371
  baseVastUrl = this.adConfig.apiVastTagUrl;
10499
11372
  edgeConfigured = !!this.host.getEdgePodBaseUrl();
10500
11373
  if (!baseVastUrl && !edgeConfigured) {
@@ -10655,12 +11528,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10655
11528
  },
10656
11529
  {
10657
11530
  key: "startOptimizedPod",
10658
- value: // ───────────────────────────────────────────────────────────────
10659
- // Optimized pod (single multi-ad request)
10660
- // ───────────────────────────────────────────────────────────────
10661
- function startOptimizedPod(baseVastUrl) {
11531
+ value: function startOptimizedPod(baseVastUrl) {
10662
11532
  return _async_to_generator(function() {
10663
- var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, error;
11533
+ var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, _this_host_config_maxAdBreakExtensionMs, remainingMs, overrunAllowanceMs, maxAdsCap, maxAds, error;
10664
11534
  return _ts_generator(this, function(_state) {
10665
11535
  switch(_state.label){
10666
11536
  case 0:
@@ -10768,6 +11638,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10768
11638
  false
10769
11639
  ];
10770
11640
  }
11641
+ if (this.isBreakTimeBounded() && adPlayer.limitPodToBudget) {
11642
+ ;
11643
+ remainingMs = this.timing.getRemainingAdMs();
11644
+ overrunAllowanceMs = Math.max(0, (_this_host_config_maxAdBreakExtensionMs = this.host.config.maxAdBreakExtensionMs) !== null && _this_host_config_maxAdBreakExtensionMs !== void 0 ? _this_host_config_maxAdBreakExtensionMs : 0);
11645
+ maxAdsCap = this.adConfig.resolveAdPodConfig().maxAdsPerBreak;
11646
+ maxAds = maxAdsCap != null ? Math.max(1, maxAdsCap - this.timing.totalAdsInBreak) : Number.MAX_SAFE_INTEGER;
11647
+ if (Number.isFinite(remainingMs)) {
11648
+ podCount = adPlayer.limitPodToBudget(remainingMs + overrunAllowanceMs, maxAds);
11649
+ if (podCount < 1) {
11650
+ if (this.timing.activeAdRequestToken === requestToken) {
11651
+ this.timing.activeAdRequestToken = null;
11652
+ }
11653
+ this.recordRequestFailure(new Error("No GAM ad fits the ".concat(Math.round(remainingMs), "ms left in the break")), podUrl);
11654
+ return [
11655
+ 2,
11656
+ false
11657
+ ];
11658
+ }
11659
+ }
11660
+ }
10771
11661
  this.setSlotState("READY", "vast_ready");
10772
11662
  if (this.debug) {
10773
11663
  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"));
@@ -10837,9 +11727,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10837
11727
  }
10838
11728
  },
10839
11729
  {
10840
- // ───────────────────────────────────────────────────────────────
10841
- // Edge-first pods (live SCTE-35 only, GAM fallback)
10842
- // ───────────────────────────────────────────────────────────────
10843
11730
  key: "resetEdgeStateForBreak",
10844
11731
  value: function resetEdgeStateForBreak() {
10845
11732
  this.edgeExhaustedForBreak = false;
@@ -11057,9 +11944,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11057
11944
  }
11058
11945
  },
11059
11946
  {
11060
- // ───────────────────────────────────────────────────────────────
11061
- // Next-ad scheduling (single flight)
11062
- // ───────────────────────────────────────────────────────────────
11063
11947
  key: "setSlotState",
11064
11948
  value: function setSlotState(next, reason) {
11065
11949
  if (this.slotState === next) return;
@@ -11109,6 +11993,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11109
11993
  {
11110
11994
  key: "getStopRequestingReason",
11111
11995
  value: function getStopRequestingReason(remainingMs) {
11996
+ var screenInactiveReason = getScreenInactiveReason();
11997
+ if (screenInactiveReason) return "screen_inactive:".concat(screenInactiveReason);
11112
11998
  if (this.breakSource === "vmap") {
11113
11999
  if (this.adPodQueue.length === 0) return "vmap_queue_empty";
11114
12000
  } else if (this.breakSource !== "scte35" || !this.followUpBaseVastUrl && !this.canRequestEdge()) {
@@ -11382,9 +12268,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11382
12268
  }
11383
12269
  },
11384
12270
  {
11385
- // ───────────────────────────────────────────────────────────────
11386
- // Per-request diagnostics
11387
- // ───────────────────────────────────────────────────────────────
11388
12271
  key: "recordRequestDiagnostic",
11389
12272
  value: function recordRequestDiagnostic(payload) {
11390
12273
  var requestId = payload.requestId;
@@ -11458,9 +12341,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11458
12341
  }
11459
12342
  },
11460
12343
  {
11461
- // ───────────────────────────────────────────────────────────────
11462
- // Single ad playback
11463
- // ───────────────────────────────────────────────────────────────
11464
12344
  key: "createGamDispatchFinalizer",
11465
12345
  value: function createGamDispatchFinalizer(requestToken) {
11466
12346
  var _this = this;
@@ -11923,9 +12803,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11923
12803
  }
11924
12804
  },
11925
12805
  {
11926
- // ───────────────────────────────────────────────────────────────
11927
- // Ad break completion
11928
- // ───────────────────────────────────────────────────────────────
11929
12806
  key: "logBreakFunnel",
11930
12807
  value: function logBreakFunnel(endReason) {
11931
12808
  var funnel = this.breakFunnel;
@@ -12571,6 +13448,8 @@ var ContentHealthWatchdog = /*#__PURE__*/ function() {
12571
13448
  return ContentHealthWatchdog;
12572
13449
  }();
12573
13450
  // src/player/StormcloudVideoPlayer.ts
13451
+ var DEFAULT_PAL_NONCE_MAX_AGE_MS = 5.5 * 60 * 60 * 1e3;
13452
+ var PAL_NONCE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12574
13453
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12575
13454
  function StormcloudVideoPlayer(config) {
12576
13455
  var _this = this;
@@ -12581,6 +13460,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12581
13460
  var browserOverrides = getBrowserConfigOverrides();
12582
13461
  this.config = _object_spread({}, browserOverrides, config);
12583
13462
  this.video = config.videoElement;
13463
+ if (this.config.forceSingleDecoderMode != null) {
13464
+ setSingleDecoderOverride(this.config.forceSingleDecoderMode);
13465
+ }
13466
+ if (this.config.adDeviceId) {
13467
+ setHostAdIdentity({
13468
+ deviceId: this.config.adDeviceId,
13469
+ deviceIdType: this.config.adDeviceIdType,
13470
+ limitAdTracking: this.config.adLimitAdTracking
13471
+ });
13472
+ }
13473
+ if (this.config.deviceInfo) {
13474
+ setHostDeviceInfo(this.config.deviceInfo);
13475
+ }
12584
13476
  logBrowserInfo(config.debugAdTiming);
12585
13477
  this.floorLadder = new FloorLadderController();
12586
13478
  this.adPlayer = this.createAdPlayer(false);
@@ -12644,6 +13536,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12644
13536
  },
12645
13537
  hasPendingAdBreak: function hasPendingAdBreak() {
12646
13538
  return _this.adBreak.pendingAdBreak !== null;
13539
+ },
13540
+ shouldHoldContentForAds: function shouldHoldContentForAds() {
13541
+ return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
12647
13542
  }
12648
13543
  });
12649
13544
  this.adBreak = new AdBreakOrchestrator({
@@ -12839,10 +13734,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12839
13734
  },
12840
13735
  {
12841
13736
  key: "load",
12842
- value: // ───────────────────────────────────────────────────────────────
12843
- // Lifecycle
12844
- // ───────────────────────────────────────────────────────────────
12845
- function load() {
13737
+ value: function load() {
12846
13738
  return _async_to_generator(function() {
12847
13739
  var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
12848
13740
  return _ts_generator(this, function(_state) {
@@ -12852,6 +13744,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12852
13744
  if (!this.attached) {
12853
13745
  this.attach();
12854
13746
  }
13747
+ primeDeviceInfo().then(function(info) {
13748
+ if (_this.debug) {
13749
+ console.log("[DEVICE-INFO]", _object_spread_props(_object_spread({}, info), {
13750
+ internalDeviceId: info.internalDeviceId ? "...".concat(info.internalDeviceId.slice(-4)) : void 0
13751
+ }));
13752
+ }
13753
+ }).catch(function() {});
12855
13754
  _state.label = 1;
12856
13755
  case 1:
12857
13756
  _state.trys.push([
@@ -12886,21 +13785,30 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12886
13785
  fetchConsentSignals().catch(function() {
12887
13786
  return {};
12888
13787
  }).then(function(signals) {
12889
- var _this_config_lowLatencyMode;
13788
+ var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
12890
13789
  _this.adConfig.consentSignals = signals;
12891
13790
  var muted = _this.video.muted;
12892
- return _this.palNonce.generateNonce(_object_spread({
13791
+ var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
13792
+ var palOptions = _object_spread({
12893
13793
  videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
12894
13794
  videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
12895
13795
  adWillAutoPlay: !!_this.config.autoplay,
12896
13796
  adWillPlayMuted: muted,
12897
13797
  playerVolume: muted ? 0 : _this.video.volume,
12898
- continuousPlayback: (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
13798
+ 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,
13799
+ iconsSupported: (_this_config_palIconsSupported = _this.config.palIconsSupported) !== null && _this_config_palIconsSupported !== void 0 ? _this_config_palIconsSupported : false,
13800
+ supportedApiFrameworks: (_this_config_palSupportedApiFrameworks = _this.config.palSupportedApiFrameworks) !== null && _this_config_palSupportedApiFrameworks !== void 0 ? _this_config_palSupportedApiFrameworks : ""
12899
13801
  }, palDescriptionUrl ? {
12900
13802
  descriptionUrl: palDescriptionUrl
12901
13803
  } : {}, signals.storageAllowed != null ? {
12902
13804
  allowStorage: signals.storageAllowed
12903
- } : {}));
13805
+ } : {}, palSessionId ? {
13806
+ sessionId: palSessionId
13807
+ } : {});
13808
+ _this.lastPalOptions = palOptions;
13809
+ _this.palSessionId = palSessionId;
13810
+ _this.startPalNonceRefresh();
13811
+ return _this.palNonce.generateNonce(palOptions);
12904
13812
  }).catch(function() {});
12905
13813
  this.adConfig.initializeTracking();
12906
13814
  if (!this.hlsEngine.shouldUseNativeHls(function() {
@@ -12938,6 +13846,92 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12938
13846
  }).call(this);
12939
13847
  }
12940
13848
  },
13849
+ {
13850
+ key: "startPalNonceRefresh",
13851
+ value: function startPalNonceRefresh() {
13852
+ var _this = this;
13853
+ if (this.palRefreshTimer != null || typeof window === "undefined") return;
13854
+ this.palRefreshTimer = window.setInterval(function() {
13855
+ return _this.refreshPalNonceIfStale();
13856
+ }, PAL_NONCE_CHECK_INTERVAL_MS);
13857
+ }
13858
+ },
13859
+ {
13860
+ key: "refreshPalNonceIfStale",
13861
+ value: function refreshPalNonceIfStale() {
13862
+ var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
13863
+ var _this_config_palNonceMaxAgeMs;
13864
+ var options = this.lastPalOptions;
13865
+ if (!options) return;
13866
+ var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
13867
+ var ageMs = this.palNonce.getNonceAgeMs();
13868
+ var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
13869
+ var sessionChanged = sessionId !== this.palSessionId;
13870
+ var stale = ageMs === void 0 || ageMs >= maxAgeMs;
13871
+ if (!force && !stale && !sessionChanged) return;
13872
+ var next = _object_spread({}, options);
13873
+ if (sessionId) next.sessionId = sessionId;
13874
+ else delete next.sessionId;
13875
+ this.lastPalOptions = next;
13876
+ this.palSessionId = sessionId;
13877
+ if (this.debug) {
13878
+ console.log("[PAL] Regenerating nonce", {
13879
+ force: force,
13880
+ stale: stale,
13881
+ sessionChanged: sessionChanged,
13882
+ ageMs: ageMs
13883
+ });
13884
+ }
13885
+ this.palNonce.generateNonce(next).catch(function() {});
13886
+ }
13887
+ },
13888
+ {
13889
+ key: "setAdIdentity",
13890
+ value: function setAdIdentity(identity) {
13891
+ setHostAdIdentity(identity);
13892
+ this.refreshPalNonceIfStale();
13893
+ }
13894
+ },
13895
+ {
13896
+ key: "resetAdIdentity",
13897
+ value: function resetAdIdentity1() {
13898
+ resetAdIdentity();
13899
+ this.refreshPalNonceIfStale(true);
13900
+ }
13901
+ },
13902
+ {
13903
+ key: "setContentMetadata",
13904
+ value: function setContentMetadata(meta) {
13905
+ var _this = this;
13906
+ var apply = function apply(key, value) {
13907
+ if (value === void 0) return;
13908
+ var clean = value === null ? void 0 : sanitizeContentValue(value);
13909
+ if (clean) _this.config[key] = clean;
13910
+ else delete _this.config[key];
13911
+ };
13912
+ apply("channelName", meta.channelName);
13913
+ apply("programTitle", meta.programTitle);
13914
+ apply("contentNetwork", meta.contentNetwork);
13915
+ }
13916
+ },
13917
+ {
13918
+ key: "setScreenStandby",
13919
+ value: function setScreenStandby(standby) {
13920
+ setHostStandby(standby);
13921
+ }
13922
+ },
13923
+ {
13924
+ key: "getDeviceInfo",
13925
+ value: function getDeviceInfo1() {
13926
+ return getDeviceInfo();
13927
+ }
13928
+ },
13929
+ {
13930
+ key: "setDeviceInfo",
13931
+ value: function setDeviceInfo(info) {
13932
+ setHostDeviceInfo(info);
13933
+ }
13934
+ },
12941
13935
  {
12942
13936
  key: "onManifestParsed",
12943
13937
  value: function onManifestParsed(isLive) {
@@ -13072,9 +14066,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13072
14066
  }
13073
14067
  },
13074
14068
  {
13075
- // ───────────────────────────────────────────────────────────────
13076
- // SCTE-35 marker orchestration
13077
- // ───────────────────────────────────────────────────────────────
13078
14069
  key: "onScte35Marker",
13079
14070
  value: function onScte35Marker(marker, cueKey) {
13080
14071
  if (this.debug) {
@@ -13253,9 +14244,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13253
14244
  }
13254
14245
  },
13255
14246
  {
13256
- // ───────────────────────────────────────────────────────────────
13257
- // Ad prefetch
13258
- // ───────────────────────────────────────────────────────────────
13259
14247
  key: "startAdPrefetch",
13260
14248
  value: function startAdPrefetch(marker, fragmentSn, cueKey) {
13261
14249
  if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
@@ -13294,9 +14282,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13294
14282
  }
13295
14283
  },
13296
14284
  {
13297
- // ───────────────────────────────────────────────────────────────
13298
- // VMAP time-based ad breaks
13299
- // ───────────────────────────────────────────────────────────────
13300
14285
  key: "onTimeUpdate",
13301
14286
  value: function onTimeUpdate(currentTimeSec) {
13302
14287
  var _this = this;
@@ -13410,9 +14395,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13410
14395
  }
13411
14396
  },
13412
14397
  {
13413
- // ───────────────────────────────────────────────────────────────
13414
- // Public API
13415
- // ───────────────────────────────────────────────────────────────
13416
14398
  key: "getCurrentAdIndex",
13417
14399
  value: function getCurrentAdIndex() {
13418
14400
  return this.timing.currentAdIndex;
@@ -13531,12 +14513,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13531
14513
  }
13532
14514
  },
13533
14515
  {
13534
- // ───────────────────────────────────────────────────────────────
13535
- // Destroy
13536
- // ───────────────────────────────────────────────────────────────
13537
14516
  key: "destroy",
13538
14517
  value: function destroy() {
13539
14518
  var _this_adPlayer;
14519
+ if (this.palRefreshTimer != null) {
14520
+ clearInterval(this.palRefreshTimer);
14521
+ this.palRefreshTimer = void 0;
14522
+ }
13540
14523
  this.contentWatchdog.stop();
13541
14524
  this.adBreak.cancelScheduledRequest();
13542
14525
  this.timing.destroy();