stormcloud-video-player 0.8.79 → 0.8.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/stormcloud-vp.min.js +2 -2
  2. package/lib/Player.cjs +6 -0
  3. package/lib/Player.cjs.map +1 -1
  4. package/lib/Player.d.cts +2 -0
  5. package/lib/StormcloudPlayer.cjs +1138 -159
  6. package/lib/StormcloudPlayer.cjs.map +1 -1
  7. package/lib/StormcloudPlayer.d.cts +2 -0
  8. package/lib/index.cjs +1201 -161
  9. package/lib/index.cjs.map +1 -1
  10. package/lib/index.d.cts +2 -0
  11. package/lib/index.d.ts +63 -2
  12. package/lib/index.js +1201 -161
  13. package/lib/index.js.map +1 -1
  14. package/lib/player/AdBreakOrchestrator.cjs +419 -83
  15. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  16. package/lib/player/AdConfigManager.cjs +735 -93
  17. package/lib/player/AdConfigManager.cjs.map +1 -1
  18. package/lib/player/AdTimingService.cjs +0 -9
  19. package/lib/player/AdTimingService.cjs.map +1 -1
  20. package/lib/player/FloorLadder.cjs +3 -0
  21. package/lib/player/FloorLadder.cjs.map +1 -1
  22. package/lib/player/HlsEngine.cjs +7 -1
  23. package/lib/player/HlsEngine.cjs.map +1 -1
  24. package/lib/player/HlsEngine.d.cts +1 -0
  25. package/lib/player/OptimizedPodRequest.cjs +4 -1
  26. package/lib/player/OptimizedPodRequest.cjs.map +1 -1
  27. package/lib/player/OptimizedPodRequest.d.cts +1 -1
  28. package/lib/player/StormcloudVideoPlayer.cjs +1138 -159
  29. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  30. package/lib/player/StormcloudVideoPlayer.d.cts +18 -1
  31. package/lib/players/HlsPlayer.cjs +1138 -159
  32. package/lib/players/HlsPlayer.cjs.map +1 -1
  33. package/lib/players/index.cjs +1138 -159
  34. package/lib/players/index.cjs.map +1 -1
  35. package/lib/props.cjs +6 -0
  36. package/lib/props.cjs.map +1 -1
  37. package/lib/props.d.cts +2 -0
  38. package/lib/sdk/hlsAdPlayer.cjs +32 -3
  39. package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
  40. package/lib/sdk/pal.cjs +10 -3
  41. package/lib/sdk/pal.cjs.map +1 -1
  42. package/lib/sdk/pal.d.cts +3 -0
  43. package/lib/types.d.cts +23 -1
  44. package/lib/ui/StormcloudVideoPlayer.cjs +1201 -161
  45. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  46. package/lib/ui/StormcloudVideoPlayer.d.cts +2 -0
  47. package/lib/utils/__tests__/adSignals.test.cjs +25662 -0
  48. package/lib/utils/__tests__/adSignals.test.cjs.map +1 -0
  49. package/lib/utils/__tests__/adSignals.test.d.cts +2 -0
  50. package/lib/utils/adIdentity.cjs +421 -0
  51. package/lib/utils/adIdentity.cjs.map +1 -0
  52. package/lib/utils/adIdentity.d.cts +30 -0
  53. package/lib/utils/browserCompat.cjs +13 -0
  54. package/lib/utils/browserCompat.cjs.map +1 -1
  55. package/lib/utils/browserCompat.d.cts +2 -1
  56. package/lib/utils/contentMetadata.cjs +208 -0
  57. package/lib/utils/contentMetadata.cjs.map +1 -0
  58. package/lib/utils/contentMetadata.d.cts +15 -0
  59. package/lib/utils/ctvVastSignals.cjs +250 -181
  60. package/lib/utils/ctvVastSignals.cjs.map +1 -1
  61. package/lib/utils/deviceInfo.cjs +678 -0
  62. package/lib/utils/deviceInfo.cjs.map +1 -0
  63. package/lib/utils/deviceInfo.d.cts +43 -0
  64. package/lib/utils/screenActivity.cjs +125 -0
  65. package/lib/utils/screenActivity.cjs.map +1 -0
  66. package/lib/utils/screenActivity.d.cts +5 -0
  67. package/lib/utils/tracking.cjs +386 -56
  68. package/lib/utils/tracking.cjs.map +1 -1
  69. package/lib/utils/tracking.d.cts +1 -1
  70. package/lib/utils/vastEnvironmentSignals.cjs +255 -85
  71. package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
  72. package/lib/utils/vastEnvironmentSignals.d.cts +8 -2
  73. package/lib/utils/vastMacros.cjs +7 -0
  74. package/lib/utils/vastMacros.cjs.map +1 -1
  75. package/lib/utils/vastMacros.d.cts +1 -0
  76. package/package.json +1 -1
@@ -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,
@@ -6098,6 +6940,9 @@ function buildAnalyticsContext(config) {
6098
6940
  if (config.isLiveStream !== void 0) {
6099
6941
  context.inputStreamType = config.isLiveStream ? "live" : "vod";
6100
6942
  }
6943
+ if (config.sendDeviceInfoToAnalytics) {
6944
+ context.includeDeviceInfo = true;
6945
+ }
6101
6946
  return context;
6102
6947
  }
6103
6948
  function getClientInfo() {
@@ -6393,7 +7238,7 @@ function buildPlayerMetricEvent() {
6393
7238
  capture_at: captureAt
6394
7239
  }, context.inputStreamType ? {
6395
7240
  input_stream_type: context.inputStreamType
6396
- } : {})
7241
+ } : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
6397
7242
  ];
6398
7243
  }
6399
7244
  });
@@ -8421,7 +9266,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
8421
9266
  key: "generatePodVastUrl",
8422
9267
  value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
8423
9268
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
8424
- 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);
8425
9274
  var macroContext = _object_spread_props(_object_spread({
8426
9275
  correlator: this.viewCorrelator,
8427
9276
  streamCorrelator: this.streamCorrelator,
@@ -8436,10 +9285,12 @@ var AdConfigManager = /*#__PURE__*/ function() {
8436
9285
  limitAdTracking: envSignals.limitAdTracking,
8437
9286
  deviceTypeHint: envSignals.deviceTypeHint,
8438
9287
  adTest: this.config.adTest
8439
- }, this.config.programTitle ? {
8440
- programTitle: this.config.programTitle
8441
- } : {}, this.config.channelName ? {
8442
- 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
8443
9294
  } : {}), {
8444
9295
  consent: this.consentSignals,
8445
9296
  palNonce: palNonce.getCurrentNonce() || void 0
@@ -8457,6 +9308,24 @@ var AdConfigManager = /*#__PURE__*/ function() {
8457
9308
  } else {
8458
9309
  finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
8459
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
+ }
8460
9329
  console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
8461
9330
  return finalUrl;
8462
9331
  }
@@ -8508,7 +9377,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
8508
9377
  }
8509
9378
  },
8510
9379
  {
8511
- // --- Tracking ---
8512
9380
  key: "initializeTracking",
8513
9381
  value: function initializeTracking() {
8514
9382
  var _this = this;
@@ -8600,7 +9468,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8600
9468
  }
8601
9469
  },
8602
9470
  {
8603
- // --- Ad stop timer ---
8604
9471
  key: "scheduleAdStopCountdown",
8605
9472
  value: function scheduleAdStopCountdown(remainingMs) {
8606
9473
  var _this = this;
@@ -8632,7 +9499,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8632
9499
  }
8633
9500
  },
8634
9501
  {
8635
- // --- Ad start timer ---
8636
9502
  key: "scheduleAdStartIn",
8637
9503
  value: function scheduleAdStartIn(delayMs) {
8638
9504
  var _this = this;
@@ -8660,7 +9526,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8660
9526
  }
8661
9527
  },
8662
9528
  {
8663
- // --- PTS drift ---
8664
9529
  key: "updatePtsDrift",
8665
9530
  value: function updatePtsDrift(ptsSecondsSample) {
8666
9531
  var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
@@ -8686,7 +9551,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8686
9551
  }
8687
9552
  },
8688
9553
  {
8689
- // --- Duration boundary ---
8690
9554
  key: "beginBreakTiming",
8691
9555
  value: function beginBreakTiming(startWallClockMs) {
8692
9556
  this.currentAdBreakStartWallClockMs = startWallClockMs;
@@ -8734,7 +9598,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8734
9598
  }
8735
9599
  },
8736
9600
  {
8737
- // --- Duration budget ---
8738
9601
  key: "getWallClockRemainingAdMs",
8739
9602
  value: function getWallClockRemainingAdMs() {
8740
9603
  var endWallClockMs = this.getAdBreakEndWallClockMs();
@@ -8883,7 +9746,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8883
9746
  }
8884
9747
  },
8885
9748
  {
8886
- // --- Circuit breaker ---
8887
9749
  key: "isTemporaryAdError",
8888
9750
  value: function isTemporaryAdError(error) {
8889
9751
  var _error_message;
@@ -9017,7 +9879,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9017
9879
  }
9018
9880
  },
9019
9881
  {
9020
- // --- Watchdog ---
9021
9882
  key: "startAdRequestWatchdog",
9022
9883
  value: function startAdRequestWatchdog(token) {
9023
9884
  var _this = this;
@@ -9062,7 +9923,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9062
9923
  }
9063
9924
  },
9064
9925
  {
9065
- // --- Failsafe ---
9066
9926
  key: "startAdFailsafeTimer",
9067
9927
  value: function startAdFailsafeTimer(token) {
9068
9928
  var _this = this;
@@ -9124,7 +9984,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9124
9984
  }
9125
9985
  },
9126
9986
  {
9127
- // --- Reset for ad break end ---
9128
9987
  key: "resetForBreakEnd",
9129
9988
  value: function resetForBreakEnd() {
9130
9989
  this.clearAdStopTimer();
@@ -9323,7 +10182,7 @@ var HlsEngine = /*#__PURE__*/ function() {
9323
10182
  adBehavior: adBehavior
9324
10183
  });
9325
10184
  }
9326
- if (!this.config.autoplay) return [
10185
+ if (!(this.config.autoplay && !this.callbacks.shouldHoldContentForAds())) return [
9327
10186
  3,
9328
10187
  2
9329
10188
  ];
@@ -9514,6 +10373,12 @@ var HlsEngine = /*#__PURE__*/ function() {
9514
10373
  2
9515
10374
  ];
9516
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
+ }
9517
10382
  if (!this.shouldAutoplayAfterBuffering) return [
9518
10383
  3,
9519
10384
  2
@@ -10171,9 +11036,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10171
11036
  }
10172
11037
  },
10173
11038
  {
10174
- // ───────────────────────────────────────────────────────────────
10175
- // IMA event listeners
10176
- // ───────────────────────────────────────────────────────────────
10177
11039
  key: "nextAdRequestUrl",
10178
11040
  value: function nextAdRequestUrl(baseVastUrl) {
10179
11041
  return this.host.generatePodVastUrl(baseVastUrl);
@@ -10409,9 +11271,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10409
11271
  }
10410
11272
  },
10411
11273
  {
10412
- // ───────────────────────────────────────────────────────────────
10413
- // Ad break start
10414
- // ───────────────────────────────────────────────────────────────
10415
11274
  key: "isBreakActive",
10416
11275
  value: function isBreakActive() {
10417
11276
  return this.slotState !== "IDLE";
@@ -10439,7 +11298,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10439
11298
  key: "handleAdStart",
10440
11299
  value: function handleAdStart(marker) {
10441
11300
  return _async_to_generator(function() {
10442
- var baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
11301
+ var screenInactiveReason, baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
10443
11302
  return _ts_generator(this, function(_state) {
10444
11303
  switch(_state.label){
10445
11304
  case 0:
@@ -10452,6 +11311,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10452
11311
  2
10453
11312
  ];
10454
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
+ }
10455
11324
  baseVastUrl = this.adConfig.apiVastTagUrl;
10456
11325
  edgeConfigured = !!this.host.getEdgePodBaseUrl();
10457
11326
  if (!baseVastUrl && !edgeConfigured) {
@@ -10612,12 +11481,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10612
11481
  },
10613
11482
  {
10614
11483
  key: "startOptimizedPod",
10615
- value: // ───────────────────────────────────────────────────────────────
10616
- // Optimized pod (single multi-ad request)
10617
- // ───────────────────────────────────────────────────────────────
10618
- function startOptimizedPod(baseVastUrl) {
11484
+ value: function startOptimizedPod(baseVastUrl) {
10619
11485
  return _async_to_generator(function() {
10620
- 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;
10621
11487
  return _ts_generator(this, function(_state) {
10622
11488
  switch(_state.label){
10623
11489
  case 0:
@@ -10725,6 +11591,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10725
11591
  false
10726
11592
  ];
10727
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
+ }
10728
11614
  this.setSlotState("READY", "vast_ready");
10729
11615
  if (this.debug) {
10730
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"));
@@ -10794,9 +11680,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10794
11680
  }
10795
11681
  },
10796
11682
  {
10797
- // ───────────────────────────────────────────────────────────────
10798
- // Edge-first pods (live SCTE-35 only, GAM fallback)
10799
- // ───────────────────────────────────────────────────────────────
10800
11683
  key: "resetEdgeStateForBreak",
10801
11684
  value: function resetEdgeStateForBreak() {
10802
11685
  this.edgeExhaustedForBreak = false;
@@ -11014,9 +11897,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11014
11897
  }
11015
11898
  },
11016
11899
  {
11017
- // ───────────────────────────────────────────────────────────────
11018
- // Next-ad scheduling (single flight)
11019
- // ───────────────────────────────────────────────────────────────
11020
11900
  key: "setSlotState",
11021
11901
  value: function setSlotState(next, reason) {
11022
11902
  if (this.slotState === next) return;
@@ -11066,6 +11946,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11066
11946
  {
11067
11947
  key: "getStopRequestingReason",
11068
11948
  value: function getStopRequestingReason(remainingMs) {
11949
+ var screenInactiveReason = getScreenInactiveReason();
11950
+ if (screenInactiveReason) return "screen_inactive:".concat(screenInactiveReason);
11069
11951
  if (this.breakSource === "vmap") {
11070
11952
  if (this.adPodQueue.length === 0) return "vmap_queue_empty";
11071
11953
  } else if (this.breakSource !== "scte35" || !this.followUpBaseVastUrl && !this.canRequestEdge()) {
@@ -11339,9 +12221,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11339
12221
  }
11340
12222
  },
11341
12223
  {
11342
- // ───────────────────────────────────────────────────────────────
11343
- // Per-request diagnostics
11344
- // ───────────────────────────────────────────────────────────────
11345
12224
  key: "recordRequestDiagnostic",
11346
12225
  value: function recordRequestDiagnostic(payload) {
11347
12226
  var requestId = payload.requestId;
@@ -11415,9 +12294,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11415
12294
  }
11416
12295
  },
11417
12296
  {
11418
- // ───────────────────────────────────────────────────────────────
11419
- // Single ad playback
11420
- // ───────────────────────────────────────────────────────────────
11421
12297
  key: "createGamDispatchFinalizer",
11422
12298
  value: function createGamDispatchFinalizer(requestToken) {
11423
12299
  var _this = this;
@@ -11880,9 +12756,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11880
12756
  }
11881
12757
  },
11882
12758
  {
11883
- // ───────────────────────────────────────────────────────────────
11884
- // Ad break completion
11885
- // ───────────────────────────────────────────────────────────────
11886
12759
  key: "logBreakFunnel",
11887
12760
  value: function logBreakFunnel(endReason) {
11888
12761
  var funnel = this.breakFunnel;
@@ -12528,6 +13401,8 @@ var ContentHealthWatchdog = /*#__PURE__*/ function() {
12528
13401
  return ContentHealthWatchdog;
12529
13402
  }();
12530
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;
12531
13406
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12532
13407
  function StormcloudVideoPlayer(config) {
12533
13408
  var _this = this;
@@ -12538,6 +13413,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12538
13413
  var browserOverrides = getBrowserConfigOverrides();
12539
13414
  this.config = _object_spread({}, browserOverrides, config);
12540
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
+ }
12541
13429
  logBrowserInfo(config.debugAdTiming);
12542
13430
  this.floorLadder = new FloorLadderController();
12543
13431
  this.adPlayer = this.createAdPlayer(false);
@@ -12601,6 +13489,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12601
13489
  },
12602
13490
  hasPendingAdBreak: function hasPendingAdBreak() {
12603
13491
  return _this.adBreak.pendingAdBreak !== null;
13492
+ },
13493
+ shouldHoldContentForAds: function shouldHoldContentForAds() {
13494
+ return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
12604
13495
  }
12605
13496
  });
12606
13497
  this.adBreak = new AdBreakOrchestrator({
@@ -12796,10 +13687,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12796
13687
  },
12797
13688
  {
12798
13689
  key: "load",
12799
- value: // ───────────────────────────────────────────────────────────────
12800
- // Lifecycle
12801
- // ───────────────────────────────────────────────────────────────
12802
- function load() {
13690
+ value: function load() {
12803
13691
  return _async_to_generator(function() {
12804
13692
  var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
12805
13693
  return _ts_generator(this, function(_state) {
@@ -12809,6 +13697,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12809
13697
  if (!this.attached) {
12810
13698
  this.attach();
12811
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() {});
12812
13707
  _state.label = 1;
12813
13708
  case 1:
12814
13709
  _state.trys.push([
@@ -12843,21 +13738,30 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12843
13738
  fetchConsentSignals().catch(function() {
12844
13739
  return {};
12845
13740
  }).then(function(signals) {
12846
- var _this_config_lowLatencyMode;
13741
+ var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
12847
13742
  _this.adConfig.consentSignals = signals;
12848
13743
  var muted = _this.video.muted;
12849
- return _this.palNonce.generateNonce(_object_spread({
13744
+ var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
13745
+ var palOptions = _object_spread({
12850
13746
  videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
12851
13747
  videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
12852
13748
  adWillAutoPlay: !!_this.config.autoplay,
12853
13749
  adWillPlayMuted: muted,
12854
13750
  playerVolume: muted ? 0 : _this.video.volume,
12855
- 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 : ""
12856
13754
  }, palDescriptionUrl ? {
12857
13755
  descriptionUrl: palDescriptionUrl
12858
13756
  } : {}, signals.storageAllowed != null ? {
12859
13757
  allowStorage: signals.storageAllowed
12860
- } : {}));
13758
+ } : {}, palSessionId ? {
13759
+ sessionId: palSessionId
13760
+ } : {});
13761
+ _this.lastPalOptions = palOptions;
13762
+ _this.palSessionId = palSessionId;
13763
+ _this.startPalNonceRefresh();
13764
+ return _this.palNonce.generateNonce(palOptions);
12861
13765
  }).catch(function() {});
12862
13766
  this.adConfig.initializeTracking();
12863
13767
  if (!this.hlsEngine.shouldUseNativeHls(function() {
@@ -12895,6 +13799,92 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12895
13799
  }).call(this);
12896
13800
  }
12897
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
+ },
12898
13888
  {
12899
13889
  key: "onManifestParsed",
12900
13890
  value: function onManifestParsed(isLive) {
@@ -13029,9 +14019,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13029
14019
  }
13030
14020
  },
13031
14021
  {
13032
- // ───────────────────────────────────────────────────────────────
13033
- // SCTE-35 marker orchestration
13034
- // ───────────────────────────────────────────────────────────────
13035
14022
  key: "onScte35Marker",
13036
14023
  value: function onScte35Marker(marker, cueKey) {
13037
14024
  if (this.debug) {
@@ -13210,9 +14197,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13210
14197
  }
13211
14198
  },
13212
14199
  {
13213
- // ───────────────────────────────────────────────────────────────
13214
- // Ad prefetch
13215
- // ───────────────────────────────────────────────────────────────
13216
14200
  key: "startAdPrefetch",
13217
14201
  value: function startAdPrefetch(marker, fragmentSn, cueKey) {
13218
14202
  if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
@@ -13251,9 +14235,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13251
14235
  }
13252
14236
  },
13253
14237
  {
13254
- // ───────────────────────────────────────────────────────────────
13255
- // VMAP time-based ad breaks
13256
- // ───────────────────────────────────────────────────────────────
13257
14238
  key: "onTimeUpdate",
13258
14239
  value: function onTimeUpdate(currentTimeSec) {
13259
14240
  var _this = this;
@@ -13367,9 +14348,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13367
14348
  }
13368
14349
  },
13369
14350
  {
13370
- // ───────────────────────────────────────────────────────────────
13371
- // Public API
13372
- // ───────────────────────────────────────────────────────────────
13373
14351
  key: "getCurrentAdIndex",
13374
14352
  value: function getCurrentAdIndex() {
13375
14353
  return this.timing.currentAdIndex;
@@ -13488,12 +14466,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13488
14466
  }
13489
14467
  },
13490
14468
  {
13491
- // ───────────────────────────────────────────────────────────────
13492
- // Destroy
13493
- // ───────────────────────────────────────────────────────────────
13494
14469
  key: "destroy",
13495
14470
  value: function destroy() {
13496
14471
  var _this_adPlayer;
14472
+ if (this.palRefreshTimer != null) {
14473
+ clearInterval(this.palRefreshTimer);
14474
+ this.palRefreshTimer = void 0;
14475
+ }
13497
14476
  this.contentWatchdog.stop();
13498
14477
  this.adBreak.cancelScheduledRequest();
13499
14478
  this.timing.destroy();