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
@@ -362,8 +362,264 @@ __export(StormcloudVideoPlayer_exports, {
362
362
  }
363
363
  });
364
364
  module.exports = __toCommonJS(StormcloudVideoPlayer_exports);
365
+ // src/utils/adIdentity.ts
366
+ var GOOGLE_ID_TYPES = [
367
+ "aaid",
368
+ "adid",
369
+ "afai",
370
+ "idfa",
371
+ "lgudid",
372
+ "msai",
373
+ "rida",
374
+ "tifa",
375
+ "tvOS",
376
+ "vaid",
377
+ "vida",
378
+ "dpid"
379
+ ];
380
+ var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
381
+ var DEFAULT_SESSION_ID_MAX_AGE_MS = MAX_SESSION_ID_AGE_MS;
382
+ var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
383
+ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
384
+ var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
385
+ var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
386
+ var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
387
+ var ZEROED_IDS = /* @__PURE__ */ new Set([
388
+ "00000000-0000-0000-0000-000000000000",
389
+ "38400000-8cf0-11bd-b23e-10b96e40000d"
390
+ ]);
391
+ var hostIdentity;
392
+ var memoryStore = {};
393
+ var lgUdidResult;
394
+ var lgUdidPromise;
395
+ var legacyCleared = false;
396
+ function isUsableAdId(value) {
397
+ if (typeof value !== "string") return false;
398
+ var t = value.trim();
399
+ if (!t) return false;
400
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
401
+ if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
402
+ return !ZEROED_IDS.has(t.toLowerCase());
403
+ }
404
+ function isZeroedAdId(value) {
405
+ return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
406
+ }
407
+ function normalizeIdType(value) {
408
+ if (typeof value !== "string") return void 0;
409
+ var lower = value.trim().toLowerCase();
410
+ if (!lower) return void 0;
411
+ var match = GOOGLE_ID_TYPES.find(function(t) {
412
+ return t.toLowerCase() === lower;
413
+ });
414
+ return match !== null && match !== void 0 ? match : "dpid";
415
+ }
416
+ function createUuid() {
417
+ var _bytes_, _bytes_1, _bytes_i;
418
+ var c = typeof crypto !== "undefined" ? crypto : void 0;
419
+ if (c && typeof c.randomUUID === "function") return c.randomUUID();
420
+ var bytes = new Uint8Array(16);
421
+ if (c && typeof c.getRandomValues === "function") {
422
+ c.getRandomValues(bytes);
423
+ } else {
424
+ for(var i = 0; i < 16; i++)bytes[i] = Math.floor(Math.random() * 256);
425
+ }
426
+ bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
427
+ bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
428
+ var hex = "";
429
+ 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");
430
+ 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));
431
+ }
432
+ function readStored(key) {
433
+ try {
434
+ var _window_localStorage;
435
+ var raw = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
436
+ if (raw) {
437
+ var parsed = JSON.parse(raw);
438
+ if (parsed && typeof parsed.id === "string" && typeof parsed.createdAt === "number" && isFinite(parsed.createdAt)) {
439
+ return {
440
+ id: parsed.id,
441
+ createdAt: parsed.createdAt
442
+ };
443
+ }
444
+ }
445
+ } catch (unused) {}
446
+ return memoryStore[key];
447
+ }
448
+ function writeStored(key, value) {
449
+ memoryStore[key] = value;
450
+ try {
451
+ if (typeof window !== "undefined") {
452
+ var _window_localStorage;
453
+ (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(key, JSON.stringify(value));
454
+ }
455
+ } catch (unused) {}
456
+ }
457
+ function removeStored(key) {
458
+ delete memoryStore[key];
459
+ try {
460
+ var _window_localStorage;
461
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(key);
462
+ } catch (unused) {}
463
+ }
464
+ function clearLegacyIdsOnce() {
465
+ if (legacyCleared) return;
466
+ legacyCleared = true;
467
+ try {
468
+ var _window_localStorage;
469
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(LEGACY_SESSION_KEY);
470
+ } catch (unused) {}
471
+ try {
472
+ if (typeof document !== "undefined") {
473
+ document.cookie = "".concat(encodeURIComponent(LEGACY_SESSION_KEY), "=;path=/;max-age=0;SameSite=Lax");
474
+ }
475
+ } catch (unused) {}
476
+ }
477
+ function clampAge(value, fallback, max) {
478
+ var v = typeof value === "number" && isFinite(value) && value > 0 ? value : fallback;
479
+ if (max != null) v = Math.min(v, max);
480
+ return v;
481
+ }
482
+ function setHostAdIdentity(identity) {
483
+ var _normalizeIdType;
484
+ if (!identity || !isUsableAdId(identity.deviceId)) {
485
+ hostIdentity = void 0;
486
+ return;
487
+ }
488
+ var deviceId = identity.deviceId.trim();
489
+ var changed = !hostIdentity || hostIdentity.deviceId !== deviceId;
490
+ hostIdentity = _object_spread({
491
+ deviceId: deviceId,
492
+ deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
493
+ }, typeof identity.limitAdTracking === "boolean" ? {
494
+ limitAdTracking: identity.limitAdTracking
495
+ } : {});
496
+ if (changed) {
497
+ removeStored(SESSION_ID_KEY);
498
+ removeStored(FALLBACK_DEVICE_ID_KEY);
499
+ }
500
+ }
501
+ function getHostAdIdentity() {
502
+ return hostIdentity ? _object_spread({}, hostIdentity) : void 0;
503
+ }
504
+ function resetAdIdentity() {
505
+ removeStored(SESSION_ID_KEY);
506
+ removeStored(FALLBACK_DEVICE_ID_KEY);
507
+ }
508
+ function readSamsungTifa() {
509
+ try {
510
+ var _window_webapis;
511
+ var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
512
+ if (!adinfo) return void 0;
513
+ var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
514
+ var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
515
+ if (isZeroedAdId(tifa)) return {
516
+ deviceIdType: "tifa",
517
+ limitAdTracking: true
518
+ };
519
+ if (!isUsableAdId(tifa)) return void 0;
520
+ return _object_spread({
521
+ deviceId: tifa.trim(),
522
+ deviceIdType: "tifa"
523
+ }, typeof lat === "boolean" ? {
524
+ limitAdTracking: lat
525
+ } : {});
526
+ } catch (unused) {
527
+ return void 0;
528
+ }
529
+ }
530
+ function primeLgUdid() {
531
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_LGUDID_TIMEOUT_MS;
532
+ if (lgUdidResult || lgUdidPromise) return lgUdidPromise !== null && lgUdidPromise !== void 0 ? lgUdidPromise : Promise.resolve();
533
+ var dev = typeof window !== "undefined" ? window.webOSDev : void 0;
534
+ if (!dev) return Promise.resolve();
535
+ if (typeof dev.LGUDID !== "function") {
536
+ var _dev_lgudid;
537
+ var direct = (_dev_lgudid = dev.lgudid) !== null && _dev_lgudid !== void 0 ? _dev_lgudid : dev.LGUDID;
538
+ if (isZeroedAdId(direct)) lgUdidResult = {
539
+ deviceIdType: "lgudid",
540
+ limitAdTracking: true
541
+ };
542
+ else if (isUsableAdId(direct)) {
543
+ lgUdidResult = {
544
+ deviceId: direct.trim(),
545
+ deviceIdType: "lgudid",
546
+ limitAdTracking: false
547
+ };
548
+ }
549
+ return Promise.resolve();
550
+ }
551
+ lgUdidPromise = new Promise(function(resolve) {
552
+ var settled = false;
553
+ var finish = function finish() {
554
+ if (settled) return;
555
+ settled = true;
556
+ clearTimeout(timer);
557
+ resolve();
558
+ };
559
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
560
+ try {
561
+ dev.LGUDID({
562
+ onSuccess: function onSuccess(res) {
563
+ var id = res === null || res === void 0 ? void 0 : res.id;
564
+ if (isZeroedAdId(id)) {
565
+ lgUdidResult = {
566
+ deviceIdType: "lgudid",
567
+ limitAdTracking: true
568
+ };
569
+ } else if (isUsableAdId(id)) {
570
+ lgUdidResult = {
571
+ deviceId: id.trim(),
572
+ deviceIdType: "lgudid",
573
+ limitAdTracking: false
574
+ };
575
+ }
576
+ finish();
577
+ },
578
+ onFailure: function onFailure() {
579
+ return finish();
580
+ }
581
+ });
582
+ } catch (unused) {
583
+ finish();
584
+ }
585
+ });
586
+ return lgUdidPromise;
587
+ }
588
+ function readCachedLgUdid() {
589
+ return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
590
+ }
591
+ function getOrRotateFallbackDeviceId() {
592
+ 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();
593
+ clearLegacyIdsOnce();
594
+ var age = clampAge(maxAgeMs, DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS);
595
+ var stored = readStored(FALLBACK_DEVICE_ID_KEY);
596
+ if (stored && isUsableAdId(stored.id) && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
597
+ return stored.id;
598
+ }
599
+ var id = createUuid();
600
+ writeStored(FALLBACK_DEVICE_ID_KEY, {
601
+ id: id,
602
+ createdAt: now
603
+ });
604
+ return id;
605
+ }
606
+ function getOrRotateSessionId() {
607
+ 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();
608
+ clearLegacyIdsOnce();
609
+ var age = clampAge(maxAgeMs, DEFAULT_SESSION_ID_MAX_AGE_MS, MAX_SESSION_ID_AGE_MS);
610
+ var stored = readStored(SESSION_ID_KEY);
611
+ if (stored && isUsableAdId(stored.id) && stored.id !== avoidValue && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
612
+ return stored.id;
613
+ }
614
+ var id = createUuid();
615
+ while(id === avoidValue)id = createUuid();
616
+ writeStored(SESSION_ID_KEY, {
617
+ id: id,
618
+ createdAt: now
619
+ });
620
+ return id;
621
+ }
365
622
  // src/utils/vastEnvironmentSignals.ts
366
- var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
367
623
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
368
624
  var DEVICE_ID_STORAGE_KEYS = [
369
625
  "rdid",
@@ -382,49 +638,96 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
382
638
  "adid"
383
639
  ]);
384
640
  function resolveVastEnvironmentSignals(isCtv) {
385
- var bridgeSignals = readNativeBridgeSignals();
386
- var platformDevice = readPlatformNativeDeviceId();
387
- var bridgeDeviceId = validDeviceId(bridgeSignals.deviceId);
388
- var realDeviceId = bridgeDeviceId || (isCtv ? validDeviceId(readStoredDeviceId()) : void 0) || validDeviceId(platformDevice.deviceId);
389
- var deviceId = realDeviceId;
390
- var deviceIdType = (bridgeDeviceId ? bridgeSignals.deviceIdType : void 0) || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
391
- var platformLat = bridgeDeviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
392
- var limitAdTracking = deviceId != null ? platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking() : void 0;
393
- if (!deviceId && isCtv) {
394
- var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
395
- if (dpid) {
396
- deviceId = dpid;
397
- deviceIdType = "dpid";
398
- limitAdTracking = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking();
399
- }
400
- }
641
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
401
642
  var deviceTypeHint = resolveDeviceTypeHint(isCtv);
643
+ var identity = resolveDeviceIdentity(isCtv, options);
644
+ var identityFields = _object_spread({}, identity.deviceId ? {
645
+ deviceId: identity.deviceId
646
+ } : {}, identity.deviceId && identity.deviceIdType ? {
647
+ deviceIdType: identity.deviceIdType
648
+ } : {}, identity.deviceId && identity.limitAdTracking != null ? {
649
+ limitAdTracking: identity.limitAdTracking
650
+ } : {}, identity.source ? {
651
+ deviceIdSource: identity.source
652
+ } : {});
402
653
  if (isCtv) {
403
654
  return _object_spread_props(_object_spread({
404
655
  isCtv: true,
405
- sessionId: getOrCreateCtvSessionId()
406
- }, deviceId ? {
407
- deviceId: deviceId
408
- } : {}, deviceId && deviceIdType ? {
409
- deviceIdType: deviceIdType
410
- } : {}, deviceId && limitAdTracking != null ? {
411
- limitAdTracking: limitAdTracking
412
- } : {}), {
656
+ sessionId: getOrRotateSessionId(options.sessionIdMaxAgeMs, identity.deviceId)
657
+ }, identityFields), {
413
658
  deviceTypeHint: deviceTypeHint
414
659
  });
415
660
  }
416
661
  return _object_spread_props(_object_spread({
417
662
  isCtv: false
418
- }, deviceId ? {
419
- deviceId: deviceId
420
- } : {}, deviceId && deviceIdType ? {
421
- deviceIdType: deviceIdType
422
- } : {}, deviceId && limitAdTracking != null ? {
423
- limitAdTracking: limitAdTracking
424
- } : {}), {
663
+ }, identityFields), {
425
664
  deviceTypeHint: deviceTypeHint
426
665
  });
427
666
  }
667
+ function resolveDeviceIdentity(isCtv, options) {
668
+ var _platform_limitAdTracking;
669
+ var host = getHostAdIdentity();
670
+ if (host) {
671
+ var _host_deviceIdType;
672
+ return _object_spread_props(_object_spread({
673
+ deviceId: host.deviceId,
674
+ deviceIdType: (_host_deviceIdType = host.deviceIdType) !== null && _host_deviceIdType !== void 0 ? _host_deviceIdType : "dpid"
675
+ }, host.limitAdTracking != null ? {
676
+ limitAdTracking: host.limitAdTracking
677
+ } : {}), {
678
+ source: "host"
679
+ });
680
+ }
681
+ var bridge = readNativeBridgeSignals();
682
+ var bridgeDeviceId = validDeviceId(bridge.deviceId);
683
+ if (bridgeDeviceId) {
684
+ var _normalizeIdType;
685
+ return _object_spread_props(_object_spread({
686
+ deviceId: bridgeDeviceId,
687
+ deviceIdType: (_normalizeIdType = normalizeIdType(bridge.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
688
+ }, bridge.limitAdTracking != null ? {
689
+ limitAdTracking: bridge.limitAdTracking
690
+ } : {}), {
691
+ source: "bridge"
692
+ });
693
+ }
694
+ var platform = readPlatformNativeDeviceId();
695
+ var platformDeviceId = validDeviceId(platform.deviceId);
696
+ if (platformDeviceId) {
697
+ var _platform_deviceIdType;
698
+ return _object_spread_props(_object_spread({
699
+ deviceId: platformDeviceId,
700
+ deviceIdType: (_platform_deviceIdType = platform.deviceIdType) !== null && _platform_deviceIdType !== void 0 ? _platform_deviceIdType : "dpid"
701
+ }, platform.limitAdTracking != null ? {
702
+ limitAdTracking: platform.limitAdTracking
703
+ } : {}), {
704
+ source: "platform"
705
+ });
706
+ }
707
+ if (!isCtv) return {};
708
+ var storedDeviceId = validDeviceId(readStoredDeviceId());
709
+ if (storedDeviceId) {
710
+ var _normalizeIdType1;
711
+ var storedLat = readStoredLimitAdTracking();
712
+ return _object_spread_props(_object_spread({
713
+ deviceId: storedDeviceId,
714
+ deviceIdType: (_normalizeIdType1 = normalizeIdType(readStoredString("deviceIdType") || readStoredString("idtype"))) !== null && _normalizeIdType1 !== void 0 ? _normalizeIdType1 : "dpid"
715
+ }, storedLat != null ? {
716
+ limitAdTracking: storedLat
717
+ } : {}), {
718
+ source: "stored"
719
+ });
720
+ }
721
+ var fallbackLat = (_platform_limitAdTracking = platform.limitAdTracking) !== null && _platform_limitAdTracking !== void 0 ? _platform_limitAdTracking : readStoredLimitAdTracking();
722
+ return _object_spread_props(_object_spread({
723
+ deviceId: getOrRotateFallbackDeviceId(options.fallbackDeviceIdMaxAgeMs),
724
+ deviceIdType: "dpid"
725
+ }, fallbackLat != null ? {
726
+ limitAdTracking: fallbackLat
727
+ } : {}), {
728
+ source: "generated"
729
+ });
730
+ }
428
731
  var DEVICE_TYPE_HINT = {
429
732
  FEATURE_PHONE: 1,
430
733
  SMARTPHONE: 2,
@@ -585,7 +888,7 @@ function resolveNativeDeviceId() {
585
888
  var bridgeSignals = readNativeBridgeSignals();
586
889
  var platformDevice = readPlatformNativeDeviceId();
587
890
  var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
588
- if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
891
+ if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
589
892
  return void 0;
590
893
  }
591
894
  return deviceId;
@@ -599,20 +902,10 @@ function getOrCreateStoredUuid(storageKey) {
599
902
  writePersistentId(storageKey, existing);
600
903
  return existing;
601
904
  }
602
- var id = createUuid();
905
+ var id = createUuid2();
603
906
  writePersistentId(storageKey, id);
604
907
  return id;
605
908
  }
606
- function getOrCreateCtvSessionId() {
607
- var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
608
- if (existing) {
609
- writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
610
- return existing;
611
- }
612
- var sessionId = createUuid();
613
- writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
614
- return sessionId;
615
- }
616
909
  function readPersistentId(storageKey) {
617
910
  return readStoredString(storageKey) || readCookie(storageKey);
618
911
  }
@@ -665,7 +958,7 @@ function writeCookie(name, value) {
665
958
  document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
666
959
  } catch (unused) {}
667
960
  }
668
- function createUuid() {
961
+ function createUuid2() {
669
962
  var _bytes_, _bytes_1;
670
963
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
671
964
  return crypto.randomUUID();
@@ -699,44 +992,10 @@ function performanceNow() {
699
992
  }
700
993
  function readPlatformNativeDeviceId() {
701
994
  if (typeof window === "undefined") return {};
702
- try {
703
- var _window_webapis;
704
- var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
705
- if (adinfo) {
706
- var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
707
- if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
708
- var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
709
- return _object_spread({
710
- deviceId: tifa,
711
- deviceIdType: "tifa"
712
- }, typeof lat === "boolean" ? {
713
- limitAdTracking: lat
714
- } : {});
715
- }
716
- }
717
- } catch (unused) {}
718
- try {
719
- var webOSDev = window.webOSDev;
720
- if (webOSDev) {
721
- var _webOSDev_lgudid;
722
- var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
723
- if (typeof lgudid === "string" && lgudid) {
724
- if (isZeroedAdId(lgudid)) {
725
- return {
726
- deviceIdType: "lgudid",
727
- limitAdTracking: true
728
- };
729
- }
730
- if (!isMacroPlaceholder(lgudid)) {
731
- return {
732
- deviceId: lgudid,
733
- deviceIdType: "lgudid",
734
- limitAdTracking: false
735
- };
736
- }
737
- }
738
- }
739
- } catch (unused) {}
995
+ var tifa = readSamsungTifa();
996
+ if (tifa) return tifa;
997
+ var lgudid = readCachedLgUdid();
998
+ if (lgudid) return lgudid;
740
999
  try {
741
1000
  var roku = window.Roku;
742
1001
  if (roku) {
@@ -763,7 +1022,7 @@ function isMacroPlaceholder(value) {
763
1022
  function validDeviceId(value) {
764
1023
  return value && !isMacroPlaceholder(value) ? value : void 0;
765
1024
  }
766
- function isZeroedAdId(value) {
1025
+ function isZeroedAdId2(value) {
767
1026
  return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
768
1027
  }
769
1028
  function readNativeBridgeSignals() {
@@ -807,7 +1066,7 @@ function readNativeBridgeSignals() {
807
1066
  "deviceIdType",
808
1067
  "advertisingIdType",
809
1068
  "idType"
810
- ]) || inferDeviceIdType();
1069
+ ]) || void 0;
811
1070
  var limitAdTracking = readBridgeBoolean(source, [
812
1071
  "is_lat",
813
1072
  "limitAdTracking",
@@ -1355,6 +1614,7 @@ function resolveScvpMacroValues(ctx) {
1355
1614
  set("GIVN", ctx.palNonce);
1356
1615
  set("CT-TI", ctx.programTitle);
1357
1616
  set("CT-CH", ctx.channelName);
1617
+ set("CT-NE", ctx.contentNetwork);
1358
1618
  set("POD", ctx.pod);
1359
1619
  set("CORRELATOR", ctx.correlator);
1360
1620
  set("SCOR", ctx.streamCorrelator);
@@ -1583,6 +1843,9 @@ function applyVastMacros(baseUrl, ctx) {
1583
1843
  if (ctx.channelName) {
1584
1844
  params.set("ct_ch", ctx.channelName);
1585
1845
  }
1846
+ if (ctx.contentNetwork) {
1847
+ params.set("ct_ne", ctx.contentNetwork);
1848
+ }
1586
1849
  var staleKeys = [];
1587
1850
  params.forEach(function(value, key) {
1588
1851
  if (isMacroPlaceholder2(value)) {
@@ -2247,8 +2510,17 @@ function detectBrowser() {
2247
2510
  chromeVersion: chromeVersionNum
2248
2511
  };
2249
2512
  }
2513
+ var singleDecoderOverride;
2514
+ function setSingleDecoderOverride(value) {
2515
+ singleDecoderOverride = value;
2516
+ }
2250
2517
  function requiresMediaPipelineResetAfterAds() {
2251
2518
  var _browser_tizenVersion;
2519
+ if (singleDecoderOverride != null) return singleDecoderOverride;
2520
+ try {
2521
+ var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
2522
+ if (typeof globalOverride === "boolean") return globalOverride;
2523
+ } catch (unused) {}
2252
2524
  var browser = detectBrowser();
2253
2525
  return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
2254
2526
  }
@@ -2408,7 +2680,7 @@ function substituteVastTrackingMacros(url) {
2408
2680
  });
2409
2681
  }
2410
2682
  // src/player/OptimizedPodRequest.ts
2411
- var DEFAULT_REQUEST_SAFETY_MS = 1500;
2683
+ var DEFAULT_REQUEST_SAFETY_MS = 2500;
2412
2684
  var GAM_AD_OPPORTUNITY_DURATION_MS = 3e4;
2413
2685
  var POD_PARAM_KEYS = [
2414
2686
  "pmnd",
@@ -2832,6 +3104,9 @@ function createHlsAdPlayer(contentVideo, options) {
2832
3104
  var mediaCandidateIndex = 0;
2833
3105
  var mediaStartTimerId;
2834
3106
  var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
3107
+ var MAX_MEDIA_START_ATTEMPTS = 2;
3108
+ var MEDIA_START_TOTAL_BUDGET_MS = Math.max(MEDIA_START_TIMEOUT_MS, 1e4);
3109
+ var mediaStartBudgetStartedAt = 0;
2835
3110
  var VAST_ERROR_MEDIA_TIMEOUT = 402;
2836
3111
  var pendingVastRequests = /* @__PURE__ */ new Set();
2837
3112
  var pendingRequestAbortReason;
@@ -4846,12 +5121,14 @@ function createHlsAdPlayer(contentVideo, options) {
4846
5121
  clearMediaStartTimer();
4847
5122
  if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
4848
5123
  var startedAt = Date.now();
5124
+ var budgetLeftMs = mediaStartBudgetStartedAt > 0 ? MEDIA_START_TOTAL_BUDGET_MS - (startedAt - mediaStartBudgetStartedAt) : MEDIA_START_TIMEOUT_MS;
5125
+ var timeoutMs = Math.max(1e3, Math.min(MEDIA_START_TIMEOUT_MS, budgetLeftMs));
4849
5126
  mediaStartTimerId = setTimeout(function() {
4850
5127
  mediaStartTimerId = void 0;
4851
5128
  if (!adPlaying || trackingFired.impression) return;
4852
- console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(MEDIA_START_TIMEOUT_MS, "ms"));
5129
+ console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(timeoutMs, "ms"));
4853
5130
  logFunnel("play_resolved_but_never_started", {
4854
- timeoutMs: MEDIA_START_TIMEOUT_MS,
5131
+ timeoutMs: timeoutMs,
4855
5132
  elapsedMs: Date.now() - startedAt,
4856
5133
  readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
4857
5134
  networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
@@ -4860,7 +5137,7 @@ function createHlsAdPlayer(contentVideo, options) {
4860
5137
  vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
4861
5138
  });
4862
5139
  recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
4863
- }, MEDIA_START_TIMEOUT_MS);
5140
+ }, timeoutMs);
4864
5141
  }
4865
5142
  function resetVideoElementForNextSource() {
4866
5143
  clearStallWatchdog();
@@ -4875,6 +5152,20 @@ function createHlsAdPlayer(contentVideo, options) {
4875
5152
  function tryNextMediaCandidate() {
4876
5153
  if (!currentAd || trackingFired.impression) return false;
4877
5154
  if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
5155
+ if (mediaCandidateIndex + 1 >= MAX_MEDIA_START_ATTEMPTS) {
5156
+ logFunnel("media_fallback_capped", {
5157
+ reason: "max_attempts",
5158
+ attempts: mediaCandidateIndex + 1
5159
+ });
5160
+ return false;
5161
+ }
5162
+ if (mediaStartBudgetStartedAt > 0 && Date.now() - mediaStartBudgetStartedAt >= MEDIA_START_TOTAL_BUDGET_MS) {
5163
+ logFunnel("media_fallback_capped", {
5164
+ reason: "time_budget",
5165
+ elapsedMs: Date.now() - mediaStartBudgetStartedAt
5166
+ });
5167
+ return false;
5168
+ }
4878
5169
  var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
4879
5170
  mediaCandidateIndex++;
4880
5171
  var next = mediaCandidates[mediaCandidateIndex];
@@ -4908,6 +5199,7 @@ function createHlsAdPlayer(contentVideo, options) {
4908
5199
  }
4909
5200
  mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
4910
5201
  mediaCandidateIndex = 0;
5202
+ mediaStartBudgetStartedAt = Date.now();
4911
5203
  var mediaFile = mediaCandidates[0];
4912
5204
  if (!mediaFile) {
4913
5205
  logFunnel("media_unsupported", {
@@ -5847,6 +6139,7 @@ function getOrCreateNonceLoader(allowStorage) {
5847
6139
  }
5848
6140
  function createPalNonceManager() {
5849
6141
  var currentNonce = "";
6142
+ var currentNonceCreatedAt = 0;
5850
6143
  var currentNonceManager;
5851
6144
  var pendingNonce;
5852
6145
  return {
@@ -5863,6 +6156,9 @@ function createPalNonceManager() {
5863
6156
  getCurrentNonce: function getCurrentNonce() {
5864
6157
  return currentNonce;
5865
6158
  },
6159
+ getNonceAgeMs: function getNonceAgeMs() {
6160
+ return currentNonce ? Date.now() - currentNonceCreatedAt : void 0;
6161
+ },
5866
6162
  waitForNonce: function waitForNonce(maxWaitMs) {
5867
6163
  if (currentNonce) return Promise.resolve(currentNonce);
5868
6164
  var pending = pendingNonce;
@@ -5915,13 +6211,14 @@ function createPalNonceManager() {
5915
6211
  },
5916
6212
  reset: function reset() {
5917
6213
  currentNonce = "";
6214
+ currentNonceCreatedAt = 0;
5918
6215
  currentNonceManager = void 0;
5919
6216
  pendingNonce = void 0;
5920
6217
  }
5921
6218
  };
5922
6219
  function generate(options) {
5923
6220
  return _async_to_generator(function() {
5924
- var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
6221
+ var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, _options_iconsSupported, _options_supportedApiFrameworks, loader, goog, request, apiFrameworks, manager, error;
5925
6222
  return _ts_generator(this, function(_state) {
5926
6223
  switch(_state.label){
5927
6224
  case 0:
@@ -5945,10 +6242,11 @@ function createPalNonceManager() {
5945
6242
  request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
5946
6243
  request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
5947
6244
  request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
5948
- request.iconsSupported = true;
6245
+ request.iconsSupported = (_options_iconsSupported = options.iconsSupported) !== null && _options_iconsSupported !== void 0 ? _options_iconsSupported : false;
5949
6246
  request.playerType = "StormcloudVideoPlayer";
5950
6247
  request.playerVersion = "1.0";
5951
- request.supportedApiFrameworks = "2,7,9";
6248
+ apiFrameworks = ((_options_supportedApiFrameworks = options.supportedApiFrameworks) !== null && _options_supportedApiFrameworks !== void 0 ? _options_supportedApiFrameworks : "").trim();
6249
+ if (apiFrameworks) request.supportedApiFrameworks = apiFrameworks;
5952
6250
  request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
5953
6251
  request.videoWidth = options.videoWidth || 640;
5954
6252
  request.videoHeight = options.videoHeight || 480;
@@ -5978,6 +6276,7 @@ function createPalNonceManager() {
5978
6276
  manager = _state.sent();
5979
6277
  currentNonceManager = manager;
5980
6278
  currentNonce = manager.getNonce();
6279
+ currentNonceCreatedAt = Date.now();
5981
6280
  console.log("[PAL] Nonce generated successfully");
5982
6281
  return [
5983
6282
  2,
@@ -6001,6 +6300,549 @@ function createPalNonceManager() {
6001
6300
  })();
6002
6301
  }
6003
6302
  }
6303
+ // src/utils/deviceInfo.ts
6304
+ var CATEGORY_CODES = {
6305
+ "LG TV": "lg_tv",
6306
+ "LG Set-Top Box": "lg_stb",
6307
+ "Samsung TV": "samsung_tv",
6308
+ Other: "other"
6309
+ };
6310
+ var DEVICE_CATEGORIES = [
6311
+ "LG TV",
6312
+ "LG Set-Top Box",
6313
+ "Samsung TV",
6314
+ "Other"
6315
+ ];
6316
+ var hostDeviceInfo;
6317
+ var lgDeviceInfo;
6318
+ var platformCache;
6319
+ var primePromise;
6320
+ function cleanString(value) {
6321
+ var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
6322
+ if (typeof value !== "string") return void 0;
6323
+ var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
6324
+ if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
6325
+ return t.length > maxLength ? t.slice(0, maxLength) : t;
6326
+ }
6327
+ function safeCall2(fn, thisArg) {
6328
+ if (typeof fn !== "function") return void 0;
6329
+ try {
6330
+ return fn.call(thisArg);
6331
+ } catch (unused) {
6332
+ return void 0;
6333
+ }
6334
+ }
6335
+ function userAgent() {
6336
+ return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
6337
+ }
6338
+ function bridgeSources() {
6339
+ if (typeof window === "undefined") return [];
6340
+ var w = window;
6341
+ return [
6342
+ w.__STORMCLOUD_CTV__,
6343
+ w.__STORMCLOUD_CTV_AD_INFO__,
6344
+ w.stormcloudCtv
6345
+ ].filter(Boolean);
6346
+ }
6347
+ function readBridge(keys) {
6348
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6349
+ try {
6350
+ for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6351
+ var source = _step.value;
6352
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6353
+ try {
6354
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6355
+ var key = _step1.value;
6356
+ var value = void 0;
6357
+ try {
6358
+ value = source === null || source === void 0 ? void 0 : source[key];
6359
+ if (typeof value === "function") value = value.call(source);
6360
+ } catch (unused) {
6361
+ value = void 0;
6362
+ }
6363
+ var clean = cleanString(value);
6364
+ if (clean) return clean;
6365
+ }
6366
+ } catch (err) {
6367
+ _didIteratorError1 = true;
6368
+ _iteratorError1 = err;
6369
+ } finally{
6370
+ try {
6371
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6372
+ _iterator1.return();
6373
+ }
6374
+ } finally{
6375
+ if (_didIteratorError1) {
6376
+ throw _iteratorError1;
6377
+ }
6378
+ }
6379
+ }
6380
+ }
6381
+ } catch (err) {
6382
+ _didIteratorError = true;
6383
+ _iteratorError = err;
6384
+ } finally{
6385
+ try {
6386
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6387
+ _iterator.return();
6388
+ }
6389
+ } finally{
6390
+ if (_didIteratorError) {
6391
+ throw _iteratorError;
6392
+ }
6393
+ }
6394
+ }
6395
+ return void 0;
6396
+ }
6397
+ function normalizeCategory(value) {
6398
+ var v = cleanString(value);
6399
+ if (!v) return void 0;
6400
+ var exact = DEVICE_CATEGORIES.find(function(c) {
6401
+ return c.toLowerCase() === v.toLowerCase();
6402
+ });
6403
+ if (exact) return exact;
6404
+ var code = v.toLowerCase().replace(/[\s-]+/g, "_");
6405
+ var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
6406
+ return CATEGORY_CODES[c] === code;
6407
+ });
6408
+ return byCode;
6409
+ }
6410
+ function parseUserAgentDeviceInfo(ua) {
6411
+ var sources = [];
6412
+ var out = {
6413
+ platform: "other",
6414
+ sources: sources
6415
+ };
6416
+ var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
6417
+ if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
6418
+ if (/Web0S|webOS/i.test(ua)) {
6419
+ out.platform = "webos";
6420
+ var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
6421
+ if (lg && lg[1] && lg[2]) {
6422
+ out.model = lg[1];
6423
+ out.firmware = lg[2];
6424
+ sources.push("user_agent");
6425
+ }
6426
+ } else if (/Tizen/i.test(ua)) {
6427
+ out.platform = "tizen";
6428
+ var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
6429
+ if (tizen && tizen[1]) {
6430
+ out.osVersion = "Tizen ".concat(tizen[1]);
6431
+ sources.push("user_agent");
6432
+ }
6433
+ }
6434
+ return out;
6435
+ }
6436
+ function readSamsungProductInfo() {
6437
+ var _cleanString;
6438
+ var _window_webapis;
6439
+ if (typeof window === "undefined") return void 0;
6440
+ var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
6441
+ if (!productinfo) return void 0;
6442
+ var model = (_cleanString = cleanString(safeCall2(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall2(productinfo.getModel, productinfo), 40);
6443
+ var firmware = cleanString(safeCall2(productinfo.getFirmware, productinfo), 64);
6444
+ var duid = cleanString(safeCall2(productinfo.getDuid, productinfo), 128);
6445
+ if (!model && !firmware && !duid) return void 0;
6446
+ return _object_spread({}, model ? {
6447
+ model: model
6448
+ } : {}, firmware ? {
6449
+ firmware: firmware
6450
+ } : {}, duid ? {
6451
+ internalDeviceId: duid,
6452
+ internalDeviceIdSource: "samsung_duid"
6453
+ } : {});
6454
+ }
6455
+ function readLgDeviceInfo(timeoutMs) {
6456
+ var webOS = typeof window !== "undefined" ? window.webOS : void 0;
6457
+ if (lgDeviceInfo || !webOS || typeof webOS.deviceInfo !== "function") return Promise.resolve();
6458
+ return new Promise(function(resolve) {
6459
+ var settled = false;
6460
+ var finish = function finish() {
6461
+ if (settled) return;
6462
+ settled = true;
6463
+ clearTimeout(timer);
6464
+ resolve();
6465
+ };
6466
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
6467
+ try {
6468
+ webOS.deviceInfo(function(info) {
6469
+ var model = cleanString(info === null || info === void 0 ? void 0 : info.modelName, 40);
6470
+ var firmware = cleanString(info === null || info === void 0 ? void 0 : info.version, 64);
6471
+ var sdkVersion = cleanString(info === null || info === void 0 ? void 0 : info.sdkVersion, 32);
6472
+ lgDeviceInfo = _object_spread({}, model ? {
6473
+ model: model
6474
+ } : {}, firmware ? {
6475
+ firmware: firmware
6476
+ } : {}, sdkVersion ? {
6477
+ sdkVersion: sdkVersion
6478
+ } : {});
6479
+ finish();
6480
+ });
6481
+ } catch (unused) {
6482
+ finish();
6483
+ }
6484
+ });
6485
+ }
6486
+ function computePlatformInfo() {
6487
+ var info = parseUserAgentDeviceInfo(userAgent());
6488
+ var sources = _to_consumable_array(info.sources);
6489
+ var samsung = readSamsungProductInfo();
6490
+ if (samsung) {
6491
+ info.platform = "tizen";
6492
+ if (samsung.model) info.model = samsung.model;
6493
+ if (samsung.firmware) info.firmware = samsung.firmware;
6494
+ if (samsung.internalDeviceId) {
6495
+ info.internalDeviceId = samsung.internalDeviceId;
6496
+ info.internalDeviceIdSource = "samsung_duid";
6497
+ }
6498
+ sources.push("samsung_productinfo");
6499
+ }
6500
+ if (lgDeviceInfo) {
6501
+ info.platform = "webos";
6502
+ if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
6503
+ if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
6504
+ if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
6505
+ sources.push("lg_deviceinfo");
6506
+ }
6507
+ var lgUdid = readCachedLgUdid();
6508
+ if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
6509
+ info.internalDeviceId = lgUdid.deviceId;
6510
+ info.internalDeviceIdSource = "lg_udid";
6511
+ sources.push("lg_udid");
6512
+ }
6513
+ info.sources = sources;
6514
+ return info;
6515
+ }
6516
+ function categorize(platform, model) {
6517
+ if (platform === "tizen") return "Samsung TV";
6518
+ if (platform === "webos") {
6519
+ var ua = userAgent();
6520
+ if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
6521
+ return "LG TV";
6522
+ }
6523
+ return "Other";
6524
+ }
6525
+ function setHostDeviceInfo(info) {
6526
+ hostDeviceInfo = info ? _object_spread({}, info) : void 0;
6527
+ }
6528
+ function primeDeviceInfo() {
6529
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1500;
6530
+ if (!primePromise) {
6531
+ primePromise = Promise.all([
6532
+ readLgDeviceInfo(timeoutMs),
6533
+ primeLgUdid(timeoutMs)
6534
+ ]).catch(function() {
6535
+ return void 0;
6536
+ }).then(function() {
6537
+ platformCache = computePlatformInfo();
6538
+ return getDeviceInfo();
6539
+ });
6540
+ }
6541
+ return primePromise;
6542
+ }
6543
+ function getDeviceInfo() {
6544
+ var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
6545
+ var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
6546
+ if (primePromise && !platformCache) {} else {
6547
+ platformCache = platform;
6548
+ }
6549
+ var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
6550
+ var bridge = {
6551
+ terminalId: readBridge([
6552
+ "terminalId",
6553
+ "terminal_id"
6554
+ ]),
6555
+ internalDeviceId: readBridge([
6556
+ "internalDeviceId",
6557
+ "internal_device_id"
6558
+ ]),
6559
+ model: readBridge([
6560
+ "deviceModel"
6561
+ ]),
6562
+ firmware: readBridge([
6563
+ "firmwareVersion"
6564
+ ]),
6565
+ category: normalizeCategory(readBridge([
6566
+ "deviceCategory"
6567
+ ]))
6568
+ };
6569
+ var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
6570
+ var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
6571
+ var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
6572
+ var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
6573
+ var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
6574
+ var sources = _to_consumable_array(platform.sources);
6575
+ var bridgeValues = [
6576
+ bridge.terminalId,
6577
+ bridge.internalDeviceId,
6578
+ bridge.model,
6579
+ bridge.firmware,
6580
+ bridge.category
6581
+ ];
6582
+ if (bridgeValues.some(function(v) {
6583
+ return v !== void 0;
6584
+ })) sources.unshift("bridge");
6585
+ if (hostDeviceInfo) sources.unshift("host");
6586
+ var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
6587
+ var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
6588
+ var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
6589
+ return _object_spread_props(_object_spread({
6590
+ category: category,
6591
+ categoryCode: CATEGORY_CODES[category]
6592
+ }, model ? {
6593
+ model: model
6594
+ } : {}, sonifiModel ? {
6595
+ sonifiModel: sonifiModel
6596
+ } : {}, firmware ? {
6597
+ firmware: firmware
6598
+ } : {}, platform.osVersion ? {
6599
+ osVersion: platform.osVersion
6600
+ } : {}, platform.browserMajorVersion != null ? {
6601
+ browserMajorVersion: platform.browserMajorVersion
6602
+ } : {}, internalDeviceId ? {
6603
+ internalDeviceId: internalDeviceId
6604
+ } : {}, internalDeviceId && internalDeviceIdSource ? {
6605
+ internalDeviceIdSource: internalDeviceIdSource
6606
+ } : {}, terminalId ? {
6607
+ terminalId: terminalId
6608
+ } : {}), {
6609
+ sources: sources
6610
+ });
6611
+ }
6612
+ var DEVICE_KEY_VALUE_KEYS = {
6613
+ category: "sc_dev",
6614
+ model: "sc_model",
6615
+ firmware: "sc_fw"
6616
+ };
6617
+ function sanitizeKeyValue(value) {
6618
+ if (typeof value !== "string") return void 0;
6619
+ var v = value.trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
6620
+ return v ? v.slice(0, 40) : void 0;
6621
+ }
6622
+ function deviceKeyValuePairs(info) {
6623
+ var pairs = [
6624
+ [
6625
+ DEVICE_KEY_VALUE_KEYS.category,
6626
+ info.categoryCode
6627
+ ]
6628
+ ];
6629
+ var model = sanitizeKeyValue(info.model);
6630
+ var firmware = sanitizeKeyValue(info.firmware);
6631
+ if (model) pairs.push([
6632
+ DEVICE_KEY_VALUE_KEYS.model,
6633
+ model
6634
+ ]);
6635
+ if (firmware) pairs.push([
6636
+ DEVICE_KEY_VALUE_KEYS.firmware,
6637
+ firmware
6638
+ ]);
6639
+ return pairs;
6640
+ }
6641
+ function applyDeviceKeyValues(url, info) {
6642
+ try {
6643
+ var parsed = new URL(url);
6644
+ var pairs = deviceKeyValuePairs(info);
6645
+ var ours = new Set(pairs.map(function(param) {
6646
+ var _param = _sliced_to_array(param, 1), k = _param[0];
6647
+ return k;
6648
+ }));
6649
+ var existing = (parsed.searchParams.get("cust_params") || "").split("&").filter(function(p) {
6650
+ var _p_split_;
6651
+ return p !== "" && !ours.has((_p_split_ = p.split("=")[0]) !== null && _p_split_ !== void 0 ? _p_split_ : "");
6652
+ });
6653
+ var merged = existing.concat(pairs.map(function(param) {
6654
+ var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
6655
+ return "".concat(k, "=").concat(v);
6656
+ })).join("&");
6657
+ parsed.searchParams.set("cust_params", merged);
6658
+ return parsed.toString();
6659
+ } catch (unused) {
6660
+ return url;
6661
+ }
6662
+ }
6663
+ function deviceInfoAnalyticsFields(info) {
6664
+ return _object_spread({
6665
+ device_category: info.category
6666
+ }, info.model ? {
6667
+ device_model: info.model
6668
+ } : {}, info.sonifiModel ? {
6669
+ sonifi_model: info.sonifiModel
6670
+ } : {}, info.firmware ? {
6671
+ firmware_version: info.firmware
6672
+ } : {}, info.osVersion ? {
6673
+ os_version: info.osVersion
6674
+ } : {}, info.browserMajorVersion != null ? {
6675
+ browser_major_version: info.browserMajorVersion
6676
+ } : {}, info.internalDeviceId ? {
6677
+ internal_device_id: info.internalDeviceId
6678
+ } : {}, info.internalDeviceIdSource ? {
6679
+ internal_device_id_source: info.internalDeviceIdSource
6680
+ } : {}, info.terminalId ? {
6681
+ terminal_id: info.terminalId
6682
+ } : {});
6683
+ }
6684
+ // src/utils/contentMetadata.ts
6685
+ var MAX_CONTENT_VALUE_LENGTH = 128;
6686
+ var BRIDGE_KEYS = {
6687
+ channelName: [
6688
+ "channelName",
6689
+ "ct_ch"
6690
+ ],
6691
+ programTitle: [
6692
+ "programTitle",
6693
+ "ct_ti"
6694
+ ],
6695
+ contentNetwork: [
6696
+ "contentNetwork",
6697
+ "ct_ne"
6698
+ ]
6699
+ };
6700
+ function sanitizeContentValue(value) {
6701
+ if (typeof value !== "string") return void 0;
6702
+ var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
6703
+ if (!cleaned) return void 0;
6704
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
6705
+ if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
6706
+ return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
6707
+ }
6708
+ function bridgeSources2() {
6709
+ if (typeof window === "undefined") return [];
6710
+ var w = window;
6711
+ return [
6712
+ w.__STORMCLOUD_CTV__,
6713
+ w.__STORMCLOUD_CTV_AD_INFO__,
6714
+ w.stormcloudCtv
6715
+ ].filter(Boolean);
6716
+ }
6717
+ function readBridgeContentValue(keys) {
6718
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6719
+ try {
6720
+ for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6721
+ var source = _step.value;
6722
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6723
+ try {
6724
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6725
+ var key = _step1.value;
6726
+ var value = void 0;
6727
+ try {
6728
+ value = source === null || source === void 0 ? void 0 : source[key];
6729
+ if (typeof value === "function") value = value.call(source);
6730
+ } catch (unused) {
6731
+ value = void 0;
6732
+ }
6733
+ var sanitized = sanitizeContentValue(value);
6734
+ if (sanitized) return sanitized;
6735
+ }
6736
+ } catch (err) {
6737
+ _didIteratorError1 = true;
6738
+ _iteratorError1 = err;
6739
+ } finally{
6740
+ try {
6741
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6742
+ _iterator1.return();
6743
+ }
6744
+ } finally{
6745
+ if (_didIteratorError1) {
6746
+ throw _iteratorError1;
6747
+ }
6748
+ }
6749
+ }
6750
+ }
6751
+ } catch (err) {
6752
+ _didIteratorError = true;
6753
+ _iteratorError = err;
6754
+ } finally{
6755
+ try {
6756
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6757
+ _iterator.return();
6758
+ }
6759
+ } finally{
6760
+ if (_didIteratorError) {
6761
+ throw _iteratorError;
6762
+ }
6763
+ }
6764
+ }
6765
+ return void 0;
6766
+ }
6767
+ function resolveContentMetadata(config) {
6768
+ var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2;
6769
+ var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
6770
+ var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
6771
+ var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
6772
+ return _object_spread({}, channelName ? {
6773
+ channelName: channelName
6774
+ } : {}, programTitle ? {
6775
+ programTitle: programTitle
6776
+ } : {}, contentNetwork ? {
6777
+ contentNetwork: contentNetwork
6778
+ } : {});
6779
+ }
6780
+ function appendMissingContentParams(url, meta) {
6781
+ if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
6782
+ try {
6783
+ var parsed = new URL(url);
6784
+ var add = function add(key, value) {
6785
+ if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
6786
+ };
6787
+ add("ct_ch", meta.channelName);
6788
+ add("ct_ti", meta.programTitle);
6789
+ add("ct_ne", meta.contentNetwork);
6790
+ return parsed.toString();
6791
+ } catch (unused) {
6792
+ return url;
6793
+ }
6794
+ }
6795
+ // src/utils/screenActivity.ts
6796
+ var hostStandby = false;
6797
+ function setHostStandby(standby) {
6798
+ hostStandby = !!standby;
6799
+ }
6800
+ function toBoolean(value) {
6801
+ if (typeof value === "boolean") return value;
6802
+ if (typeof value === "number") return value === 1;
6803
+ if (typeof value === "string") {
6804
+ var v = value.trim().toLowerCase();
6805
+ if (v === "true" || v === "1" || v === "yes") return true;
6806
+ if (v === "false" || v === "0" || v === "no") return false;
6807
+ }
6808
+ return void 0;
6809
+ }
6810
+ function bridgeSaysStandby() {
6811
+ if (typeof window === "undefined") return false;
6812
+ var w = window;
6813
+ for(var _i = 0, _iter = [
6814
+ w.__STORMCLOUD_CTV__,
6815
+ w.__STORMCLOUD_CTV_AD_INFO__,
6816
+ w.stormcloudCtv
6817
+ ]; _i < _iter.length; _i++){
6818
+ var source = _iter[_i];
6819
+ if (!source) continue;
6820
+ for(var _i1 = 0, _iter1 = [
6821
+ "standby",
6822
+ "isStandby",
6823
+ "screenOff"
6824
+ ]; _i1 < _iter1.length; _i1++){
6825
+ var key = _iter1[_i1];
6826
+ var value = void 0;
6827
+ try {
6828
+ value = source[key];
6829
+ if (typeof value === "function") value = value.call(source);
6830
+ } catch (unused) {
6831
+ value = void 0;
6832
+ }
6833
+ if (toBoolean(value) === true) return true;
6834
+ }
6835
+ }
6836
+ return false;
6837
+ }
6838
+ function getScreenInactiveReason() {
6839
+ if (hostStandby) return "host_standby";
6840
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") {
6841
+ return "document_hidden";
6842
+ }
6843
+ if (bridgeSaysStandby()) return "bridge_standby";
6844
+ return void 0;
6845
+ }
6004
6846
  // src/utils/trackingIngest.ts
6005
6847
  var DEFAULT_TRACKING_INGEST_CONFIG = {
6006
6848
  enabled: true,
@@ -6082,20 +6924,25 @@ function ingestPlayerTracking(licenseKey, channel, body) {
6082
6924
  // src/utils/tracking.ts
6083
6925
  var cachedBrowserId = null;
6084
6926
  function buildAnalyticsContext(config) {
6085
- var _config_contentNetwork, _config_channelName, _config_programTitle;
6927
+ var _config_contentNetwork, _config_channelName, _config_programTitle, _config_src;
6086
6928
  var context = {};
6087
6929
  var contentNetwork = (_config_contentNetwork = config.contentNetwork) === null || _config_contentNetwork === void 0 ? void 0 : _config_contentNetwork.trim();
6088
6930
  var contentChannel = (_config_channelName = config.channelName) === null || _config_channelName === void 0 ? void 0 : _config_channelName.trim();
6089
6931
  var contentTitle = (_config_programTitle = config.programTitle) === null || _config_programTitle === void 0 ? void 0 : _config_programTitle.trim();
6932
+ var hlsUrl = (_config_src = config.src) === null || _config_src === void 0 ? void 0 : _config_src.trim();
6090
6933
  if (contentNetwork) context.contentNetwork = contentNetwork;
6091
6934
  if (contentChannel) context.contentChannel = contentChannel;
6092
6935
  if (contentTitle) context.contentTitle = contentTitle;
6936
+ if (hlsUrl) context.hlsUrl = hlsUrl;
6093
6937
  if (config.debugAdTiming) {
6094
6938
  context.debugAdTiming = true;
6095
6939
  }
6096
6940
  if (config.isLiveStream !== void 0) {
6097
6941
  context.inputStreamType = config.isLiveStream ? "live" : "vod";
6098
6942
  }
6943
+ if (config.sendDeviceInfoToAnalytics) {
6944
+ context.includeDeviceInfo = true;
6945
+ }
6099
6946
  return context;
6100
6947
  }
6101
6948
  function getClientInfo() {
@@ -6391,7 +7238,7 @@ function buildPlayerMetricEvent() {
6391
7238
  capture_at: captureAt
6392
7239
  }, context.inputStreamType ? {
6393
7240
  input_stream_type: context.inputStreamType
6394
- } : {})
7241
+ } : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
6395
7242
  ];
6396
7243
  }
6397
7244
  });
@@ -6595,6 +7442,8 @@ function sendAdImpressionTracking(_0, _1) {
6595
7442
  content_channel: context.contentChannel
6596
7443
  } : {}, context.contentTitle ? {
6597
7444
  content_title: context.contentTitle
7445
+ } : {}, context.hlsUrl ? {
7446
+ hls_url: context.hlsUrl
6598
7447
  } : {})
6599
7448
  ]
6600
7449
  })
@@ -8417,7 +9266,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
8417
9266
  key: "generatePodVastUrl",
8418
9267
  value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
8419
9268
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
8420
- var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
9269
+ var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
9270
+ fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
9271
+ sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
9272
+ });
9273
+ var content = resolveContentMetadata(this.config);
8421
9274
  var macroContext = _object_spread_props(_object_spread({
8422
9275
  correlator: this.viewCorrelator,
8423
9276
  streamCorrelator: this.streamCorrelator,
@@ -8432,10 +9285,12 @@ var AdConfigManager = /*#__PURE__*/ function() {
8432
9285
  limitAdTracking: envSignals.limitAdTracking,
8433
9286
  deviceTypeHint: envSignals.deviceTypeHint,
8434
9287
  adTest: this.config.adTest
8435
- }, this.config.programTitle ? {
8436
- programTitle: this.config.programTitle
8437
- } : {}, this.config.channelName ? {
8438
- channelName: this.config.channelName
9288
+ }, content.programTitle ? {
9289
+ programTitle: content.programTitle
9290
+ } : {}, content.channelName ? {
9291
+ channelName: content.channelName
9292
+ } : {}, content.contentNetwork ? {
9293
+ contentNetwork: content.contentNetwork
8439
9294
  } : {}), {
8440
9295
  consent: this.consentSignals,
8441
9296
  palNonce: palNonce.getCurrentNonce() || void 0
@@ -8453,6 +9308,24 @@ var AdConfigManager = /*#__PURE__*/ function() {
8453
9308
  } else {
8454
9309
  finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
8455
9310
  }
9311
+ finalUrl = appendMissingContentParams(finalUrl, content);
9312
+ if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
9313
+ finalUrl = applyDeviceKeyValues(finalUrl, getDeviceInfo());
9314
+ }
9315
+ if (this.debug) {
9316
+ var id = envSignals.deviceId;
9317
+ console.log("[AD-IDENTITY]", {
9318
+ source: envSignals.deviceIdSource,
9319
+ idtype: envSignals.deviceIdType,
9320
+ rdidTail: id ? id.slice(-4) : void 0,
9321
+ isLat: envSignals.limitAdTracking,
9322
+ dth: envSignals.deviceTypeHint,
9323
+ sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
9324
+ ct_ch: content.channelName,
9325
+ ct_ti: content.programTitle,
9326
+ ct_ne: content.contentNetwork
9327
+ });
9328
+ }
8456
9329
  console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
8457
9330
  return finalUrl;
8458
9331
  }
@@ -8504,7 +9377,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
8504
9377
  }
8505
9378
  },
8506
9379
  {
8507
- // --- Tracking ---
8508
9380
  key: "initializeTracking",
8509
9381
  value: function initializeTracking() {
8510
9382
  var _this = this;
@@ -8596,7 +9468,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8596
9468
  }
8597
9469
  },
8598
9470
  {
8599
- // --- Ad stop timer ---
8600
9471
  key: "scheduleAdStopCountdown",
8601
9472
  value: function scheduleAdStopCountdown(remainingMs) {
8602
9473
  var _this = this;
@@ -8628,7 +9499,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8628
9499
  }
8629
9500
  },
8630
9501
  {
8631
- // --- Ad start timer ---
8632
9502
  key: "scheduleAdStartIn",
8633
9503
  value: function scheduleAdStartIn(delayMs) {
8634
9504
  var _this = this;
@@ -8656,7 +9526,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8656
9526
  }
8657
9527
  },
8658
9528
  {
8659
- // --- PTS drift ---
8660
9529
  key: "updatePtsDrift",
8661
9530
  value: function updatePtsDrift(ptsSecondsSample) {
8662
9531
  var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
@@ -8682,7 +9551,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8682
9551
  }
8683
9552
  },
8684
9553
  {
8685
- // --- Duration boundary ---
8686
9554
  key: "beginBreakTiming",
8687
9555
  value: function beginBreakTiming(startWallClockMs) {
8688
9556
  this.currentAdBreakStartWallClockMs = startWallClockMs;
@@ -8730,7 +9598,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8730
9598
  }
8731
9599
  },
8732
9600
  {
8733
- // --- Duration budget ---
8734
9601
  key: "getWallClockRemainingAdMs",
8735
9602
  value: function getWallClockRemainingAdMs() {
8736
9603
  var endWallClockMs = this.getAdBreakEndWallClockMs();
@@ -8879,7 +9746,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8879
9746
  }
8880
9747
  },
8881
9748
  {
8882
- // --- Circuit breaker ---
8883
9749
  key: "isTemporaryAdError",
8884
9750
  value: function isTemporaryAdError(error) {
8885
9751
  var _error_message;
@@ -9013,7 +9879,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9013
9879
  }
9014
9880
  },
9015
9881
  {
9016
- // --- Watchdog ---
9017
9882
  key: "startAdRequestWatchdog",
9018
9883
  value: function startAdRequestWatchdog(token) {
9019
9884
  var _this = this;
@@ -9058,7 +9923,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9058
9923
  }
9059
9924
  },
9060
9925
  {
9061
- // --- Failsafe ---
9062
9926
  key: "startAdFailsafeTimer",
9063
9927
  value: function startAdFailsafeTimer(token) {
9064
9928
  var _this = this;
@@ -9120,7 +9984,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9120
9984
  }
9121
9985
  },
9122
9986
  {
9123
- // --- Reset for ad break end ---
9124
9987
  key: "resetForBreakEnd",
9125
9988
  value: function resetForBreakEnd() {
9126
9989
  this.clearAdStopTimer();
@@ -9319,7 +10182,7 @@ var HlsEngine = /*#__PURE__*/ function() {
9319
10182
  adBehavior: adBehavior
9320
10183
  });
9321
10184
  }
9322
- if (!this.config.autoplay) return [
10185
+ if (!(this.config.autoplay && !this.callbacks.shouldHoldContentForAds())) return [
9323
10186
  3,
9324
10187
  2
9325
10188
  ];
@@ -9510,6 +10373,12 @@ var HlsEngine = /*#__PURE__*/ function() {
9510
10373
  2
9511
10374
  ];
9512
10375
  this.hasInitialBufferCompleted = true;
10376
+ if (this.shouldAutoplayAfterBuffering && this.callbacks.shouldHoldContentForAds()) {
10377
+ this.shouldAutoplayAfterBuffering = false;
10378
+ if (this.debug) {
10379
+ console.log("[StormcloudVideoPlayer] Buffer ready during an ad break; content stays paused until the break ends");
10380
+ }
10381
+ }
9513
10382
  if (!this.shouldAutoplayAfterBuffering) return [
9514
10383
  3,
9515
10384
  2
@@ -10167,9 +11036,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10167
11036
  }
10168
11037
  },
10169
11038
  {
10170
- // ───────────────────────────────────────────────────────────────
10171
- // IMA event listeners
10172
- // ───────────────────────────────────────────────────────────────
10173
11039
  key: "nextAdRequestUrl",
10174
11040
  value: function nextAdRequestUrl(baseVastUrl) {
10175
11041
  return this.host.generatePodVastUrl(baseVastUrl);
@@ -10405,9 +11271,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10405
11271
  }
10406
11272
  },
10407
11273
  {
10408
- // ───────────────────────────────────────────────────────────────
10409
- // Ad break start
10410
- // ───────────────────────────────────────────────────────────────
10411
11274
  key: "isBreakActive",
10412
11275
  value: function isBreakActive() {
10413
11276
  return this.slotState !== "IDLE";
@@ -10435,7 +11298,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10435
11298
  key: "handleAdStart",
10436
11299
  value: function handleAdStart(marker) {
10437
11300
  return _async_to_generator(function() {
10438
- var baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
11301
+ var screenInactiveReason, baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
10439
11302
  return _ts_generator(this, function(_state) {
10440
11303
  switch(_state.label){
10441
11304
  case 0:
@@ -10448,6 +11311,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10448
11311
  2
10449
11312
  ];
10450
11313
  }
11314
+ screenInactiveReason = getScreenInactiveReason();
11315
+ if (screenInactiveReason) {
11316
+ this.logOrchestratorFunnel("break_skipped_screen_inactive", {
11317
+ reason: screenInactiveReason
11318
+ });
11319
+ this.clearPendingAdBreak();
11320
+ return [
11321
+ 2
11322
+ ];
11323
+ }
10451
11324
  baseVastUrl = this.adConfig.apiVastTagUrl;
10452
11325
  edgeConfigured = !!this.host.getEdgePodBaseUrl();
10453
11326
  if (!baseVastUrl && !edgeConfigured) {
@@ -10608,12 +11481,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10608
11481
  },
10609
11482
  {
10610
11483
  key: "startOptimizedPod",
10611
- value: // ───────────────────────────────────────────────────────────────
10612
- // Optimized pod (single multi-ad request)
10613
- // ───────────────────────────────────────────────────────────────
10614
- function startOptimizedPod(baseVastUrl) {
11484
+ value: function startOptimizedPod(baseVastUrl) {
10615
11485
  return _async_to_generator(function() {
10616
- var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, error;
11486
+ var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, _this_host_config_maxAdBreakExtensionMs, remainingMs, overrunAllowanceMs, maxAdsCap, maxAds, error;
10617
11487
  return _ts_generator(this, function(_state) {
10618
11488
  switch(_state.label){
10619
11489
  case 0:
@@ -10721,6 +11591,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10721
11591
  false
10722
11592
  ];
10723
11593
  }
11594
+ if (this.isBreakTimeBounded() && adPlayer.limitPodToBudget) {
11595
+ ;
11596
+ remainingMs = this.timing.getRemainingAdMs();
11597
+ overrunAllowanceMs = Math.max(0, (_this_host_config_maxAdBreakExtensionMs = this.host.config.maxAdBreakExtensionMs) !== null && _this_host_config_maxAdBreakExtensionMs !== void 0 ? _this_host_config_maxAdBreakExtensionMs : 0);
11598
+ maxAdsCap = this.adConfig.resolveAdPodConfig().maxAdsPerBreak;
11599
+ maxAds = maxAdsCap != null ? Math.max(1, maxAdsCap - this.timing.totalAdsInBreak) : Number.MAX_SAFE_INTEGER;
11600
+ if (Number.isFinite(remainingMs)) {
11601
+ podCount = adPlayer.limitPodToBudget(remainingMs + overrunAllowanceMs, maxAds);
11602
+ if (podCount < 1) {
11603
+ if (this.timing.activeAdRequestToken === requestToken) {
11604
+ this.timing.activeAdRequestToken = null;
11605
+ }
11606
+ this.recordRequestFailure(new Error("No GAM ad fits the ".concat(Math.round(remainingMs), "ms left in the break")), podUrl);
11607
+ return [
11608
+ 2,
11609
+ false
11610
+ ];
11611
+ }
11612
+ }
11613
+ }
10724
11614
  this.setSlotState("READY", "vast_ready");
10725
11615
  if (this.debug) {
10726
11616
  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"));
@@ -10790,9 +11680,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10790
11680
  }
10791
11681
  },
10792
11682
  {
10793
- // ───────────────────────────────────────────────────────────────
10794
- // Edge-first pods (live SCTE-35 only, GAM fallback)
10795
- // ───────────────────────────────────────────────────────────────
10796
11683
  key: "resetEdgeStateForBreak",
10797
11684
  value: function resetEdgeStateForBreak() {
10798
11685
  this.edgeExhaustedForBreak = false;
@@ -11010,9 +11897,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11010
11897
  }
11011
11898
  },
11012
11899
  {
11013
- // ───────────────────────────────────────────────────────────────
11014
- // Next-ad scheduling (single flight)
11015
- // ───────────────────────────────────────────────────────────────
11016
11900
  key: "setSlotState",
11017
11901
  value: function setSlotState(next, reason) {
11018
11902
  if (this.slotState === next) return;
@@ -11062,6 +11946,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11062
11946
  {
11063
11947
  key: "getStopRequestingReason",
11064
11948
  value: function getStopRequestingReason(remainingMs) {
11949
+ var screenInactiveReason = getScreenInactiveReason();
11950
+ if (screenInactiveReason) return "screen_inactive:".concat(screenInactiveReason);
11065
11951
  if (this.breakSource === "vmap") {
11066
11952
  if (this.adPodQueue.length === 0) return "vmap_queue_empty";
11067
11953
  } else if (this.breakSource !== "scte35" || !this.followUpBaseVastUrl && !this.canRequestEdge()) {
@@ -11335,9 +12221,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11335
12221
  }
11336
12222
  },
11337
12223
  {
11338
- // ───────────────────────────────────────────────────────────────
11339
- // Per-request diagnostics
11340
- // ───────────────────────────────────────────────────────────────
11341
12224
  key: "recordRequestDiagnostic",
11342
12225
  value: function recordRequestDiagnostic(payload) {
11343
12226
  var requestId = payload.requestId;
@@ -11411,9 +12294,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11411
12294
  }
11412
12295
  },
11413
12296
  {
11414
- // ───────────────────────────────────────────────────────────────
11415
- // Single ad playback
11416
- // ───────────────────────────────────────────────────────────────
11417
12297
  key: "createGamDispatchFinalizer",
11418
12298
  value: function createGamDispatchFinalizer(requestToken) {
11419
12299
  var _this = this;
@@ -11876,9 +12756,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11876
12756
  }
11877
12757
  },
11878
12758
  {
11879
- // ───────────────────────────────────────────────────────────────
11880
- // Ad break completion
11881
- // ───────────────────────────────────────────────────────────────
11882
12759
  key: "logBreakFunnel",
11883
12760
  value: function logBreakFunnel(endReason) {
11884
12761
  var funnel = this.breakFunnel;
@@ -12524,6 +13401,8 @@ var ContentHealthWatchdog = /*#__PURE__*/ function() {
12524
13401
  return ContentHealthWatchdog;
12525
13402
  }();
12526
13403
  // src/player/StormcloudVideoPlayer.ts
13404
+ var DEFAULT_PAL_NONCE_MAX_AGE_MS = 5.5 * 60 * 60 * 1e3;
13405
+ var PAL_NONCE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12527
13406
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12528
13407
  function StormcloudVideoPlayer(config) {
12529
13408
  var _this = this;
@@ -12534,6 +13413,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12534
13413
  var browserOverrides = getBrowserConfigOverrides();
12535
13414
  this.config = _object_spread({}, browserOverrides, config);
12536
13415
  this.video = config.videoElement;
13416
+ if (this.config.forceSingleDecoderMode != null) {
13417
+ setSingleDecoderOverride(this.config.forceSingleDecoderMode);
13418
+ }
13419
+ if (this.config.adDeviceId) {
13420
+ setHostAdIdentity({
13421
+ deviceId: this.config.adDeviceId,
13422
+ deviceIdType: this.config.adDeviceIdType,
13423
+ limitAdTracking: this.config.adLimitAdTracking
13424
+ });
13425
+ }
13426
+ if (this.config.deviceInfo) {
13427
+ setHostDeviceInfo(this.config.deviceInfo);
13428
+ }
12537
13429
  logBrowserInfo(config.debugAdTiming);
12538
13430
  this.floorLadder = new FloorLadderController();
12539
13431
  this.adPlayer = this.createAdPlayer(false);
@@ -12597,6 +13489,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12597
13489
  },
12598
13490
  hasPendingAdBreak: function hasPendingAdBreak() {
12599
13491
  return _this.adBreak.pendingAdBreak !== null;
13492
+ },
13493
+ shouldHoldContentForAds: function shouldHoldContentForAds() {
13494
+ return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
12600
13495
  }
12601
13496
  });
12602
13497
  this.adBreak = new AdBreakOrchestrator({
@@ -12792,10 +13687,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12792
13687
  },
12793
13688
  {
12794
13689
  key: "load",
12795
- value: // ───────────────────────────────────────────────────────────────
12796
- // Lifecycle
12797
- // ───────────────────────────────────────────────────────────────
12798
- function load() {
13690
+ value: function load() {
12799
13691
  return _async_to_generator(function() {
12800
13692
  var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
12801
13693
  return _ts_generator(this, function(_state) {
@@ -12805,6 +13697,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12805
13697
  if (!this.attached) {
12806
13698
  this.attach();
12807
13699
  }
13700
+ primeDeviceInfo().then(function(info) {
13701
+ if (_this.debug) {
13702
+ console.log("[DEVICE-INFO]", _object_spread_props(_object_spread({}, info), {
13703
+ internalDeviceId: info.internalDeviceId ? "...".concat(info.internalDeviceId.slice(-4)) : void 0
13704
+ }));
13705
+ }
13706
+ }).catch(function() {});
12808
13707
  _state.label = 1;
12809
13708
  case 1:
12810
13709
  _state.trys.push([
@@ -12839,21 +13738,30 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12839
13738
  fetchConsentSignals().catch(function() {
12840
13739
  return {};
12841
13740
  }).then(function(signals) {
12842
- var _this_config_lowLatencyMode;
13741
+ var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
12843
13742
  _this.adConfig.consentSignals = signals;
12844
13743
  var muted = _this.video.muted;
12845
- return _this.palNonce.generateNonce(_object_spread({
13744
+ var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
13745
+ var palOptions = _object_spread({
12846
13746
  videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
12847
13747
  videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
12848
13748
  adWillAutoPlay: !!_this.config.autoplay,
12849
13749
  adWillPlayMuted: muted,
12850
13750
  playerVolume: muted ? 0 : _this.video.volume,
12851
- continuousPlayback: (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
13751
+ 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,
13752
+ iconsSupported: (_this_config_palIconsSupported = _this.config.palIconsSupported) !== null && _this_config_palIconsSupported !== void 0 ? _this_config_palIconsSupported : false,
13753
+ supportedApiFrameworks: (_this_config_palSupportedApiFrameworks = _this.config.palSupportedApiFrameworks) !== null && _this_config_palSupportedApiFrameworks !== void 0 ? _this_config_palSupportedApiFrameworks : ""
12852
13754
  }, palDescriptionUrl ? {
12853
13755
  descriptionUrl: palDescriptionUrl
12854
13756
  } : {}, signals.storageAllowed != null ? {
12855
13757
  allowStorage: signals.storageAllowed
12856
- } : {}));
13758
+ } : {}, palSessionId ? {
13759
+ sessionId: palSessionId
13760
+ } : {});
13761
+ _this.lastPalOptions = palOptions;
13762
+ _this.palSessionId = palSessionId;
13763
+ _this.startPalNonceRefresh();
13764
+ return _this.palNonce.generateNonce(palOptions);
12857
13765
  }).catch(function() {});
12858
13766
  this.adConfig.initializeTracking();
12859
13767
  if (!this.hlsEngine.shouldUseNativeHls(function() {
@@ -12891,6 +13799,92 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12891
13799
  }).call(this);
12892
13800
  }
12893
13801
  },
13802
+ {
13803
+ key: "startPalNonceRefresh",
13804
+ value: function startPalNonceRefresh() {
13805
+ var _this = this;
13806
+ if (this.palRefreshTimer != null || typeof window === "undefined") return;
13807
+ this.palRefreshTimer = window.setInterval(function() {
13808
+ return _this.refreshPalNonceIfStale();
13809
+ }, PAL_NONCE_CHECK_INTERVAL_MS);
13810
+ }
13811
+ },
13812
+ {
13813
+ key: "refreshPalNonceIfStale",
13814
+ value: function refreshPalNonceIfStale() {
13815
+ var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
13816
+ var _this_config_palNonceMaxAgeMs;
13817
+ var options = this.lastPalOptions;
13818
+ if (!options) return;
13819
+ var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
13820
+ var ageMs = this.palNonce.getNonceAgeMs();
13821
+ var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
13822
+ var sessionChanged = sessionId !== this.palSessionId;
13823
+ var stale = ageMs === void 0 || ageMs >= maxAgeMs;
13824
+ if (!force && !stale && !sessionChanged) return;
13825
+ var next = _object_spread({}, options);
13826
+ if (sessionId) next.sessionId = sessionId;
13827
+ else delete next.sessionId;
13828
+ this.lastPalOptions = next;
13829
+ this.palSessionId = sessionId;
13830
+ if (this.debug) {
13831
+ console.log("[PAL] Regenerating nonce", {
13832
+ force: force,
13833
+ stale: stale,
13834
+ sessionChanged: sessionChanged,
13835
+ ageMs: ageMs
13836
+ });
13837
+ }
13838
+ this.palNonce.generateNonce(next).catch(function() {});
13839
+ }
13840
+ },
13841
+ {
13842
+ key: "setAdIdentity",
13843
+ value: function setAdIdentity(identity) {
13844
+ setHostAdIdentity(identity);
13845
+ this.refreshPalNonceIfStale();
13846
+ }
13847
+ },
13848
+ {
13849
+ key: "resetAdIdentity",
13850
+ value: function resetAdIdentity1() {
13851
+ resetAdIdentity();
13852
+ this.refreshPalNonceIfStale(true);
13853
+ }
13854
+ },
13855
+ {
13856
+ key: "setContentMetadata",
13857
+ value: function setContentMetadata(meta) {
13858
+ var _this = this;
13859
+ var apply = function apply(key, value) {
13860
+ if (value === void 0) return;
13861
+ var clean = value === null ? void 0 : sanitizeContentValue(value);
13862
+ if (clean) _this.config[key] = clean;
13863
+ else delete _this.config[key];
13864
+ };
13865
+ apply("channelName", meta.channelName);
13866
+ apply("programTitle", meta.programTitle);
13867
+ apply("contentNetwork", meta.contentNetwork);
13868
+ }
13869
+ },
13870
+ {
13871
+ key: "setScreenStandby",
13872
+ value: function setScreenStandby(standby) {
13873
+ setHostStandby(standby);
13874
+ }
13875
+ },
13876
+ {
13877
+ key: "getDeviceInfo",
13878
+ value: function getDeviceInfo1() {
13879
+ return getDeviceInfo();
13880
+ }
13881
+ },
13882
+ {
13883
+ key: "setDeviceInfo",
13884
+ value: function setDeviceInfo(info) {
13885
+ setHostDeviceInfo(info);
13886
+ }
13887
+ },
12894
13888
  {
12895
13889
  key: "onManifestParsed",
12896
13890
  value: function onManifestParsed(isLive) {
@@ -13025,9 +14019,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13025
14019
  }
13026
14020
  },
13027
14021
  {
13028
- // ───────────────────────────────────────────────────────────────
13029
- // SCTE-35 marker orchestration
13030
- // ───────────────────────────────────────────────────────────────
13031
14022
  key: "onScte35Marker",
13032
14023
  value: function onScte35Marker(marker, cueKey) {
13033
14024
  if (this.debug) {
@@ -13206,9 +14197,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13206
14197
  }
13207
14198
  },
13208
14199
  {
13209
- // ───────────────────────────────────────────────────────────────
13210
- // Ad prefetch
13211
- // ───────────────────────────────────────────────────────────────
13212
14200
  key: "startAdPrefetch",
13213
14201
  value: function startAdPrefetch(marker, fragmentSn, cueKey) {
13214
14202
  if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
@@ -13247,9 +14235,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13247
14235
  }
13248
14236
  },
13249
14237
  {
13250
- // ───────────────────────────────────────────────────────────────
13251
- // VMAP time-based ad breaks
13252
- // ───────────────────────────────────────────────────────────────
13253
14238
  key: "onTimeUpdate",
13254
14239
  value: function onTimeUpdate(currentTimeSec) {
13255
14240
  var _this = this;
@@ -13363,9 +14348,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13363
14348
  }
13364
14349
  },
13365
14350
  {
13366
- // ───────────────────────────────────────────────────────────────
13367
- // Public API
13368
- // ───────────────────────────────────────────────────────────────
13369
14351
  key: "getCurrentAdIndex",
13370
14352
  value: function getCurrentAdIndex() {
13371
14353
  return this.timing.currentAdIndex;
@@ -13484,12 +14466,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13484
14466
  }
13485
14467
  },
13486
14468
  {
13487
- // ───────────────────────────────────────────────────────────────
13488
- // Destroy
13489
- // ───────────────────────────────────────────────────────────────
13490
14469
  key: "destroy",
13491
14470
  value: function destroy() {
13492
14471
  var _this_adPlayer;
14472
+ if (this.palRefreshTimer != null) {
14473
+ clearInterval(this.palRefreshTimer);
14474
+ this.palRefreshTimer = void 0;
14475
+ }
13493
14476
  this.contentWatchdog.stop();
13494
14477
  this.adBreak.cancelScheduledRequest();
13495
14478
  this.timing.destroy();