stormcloud-video-player 0.8.67 → 0.8.69

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 (37) hide show
  1. package/dist/stormcloud-vp.min.js +1 -1
  2. package/lib/Player.cjs +30 -8
  3. package/lib/Player.cjs.map +1 -1
  4. package/lib/Player.d.cts +1 -0
  5. package/lib/StormcloudPlayer.cjs +5383 -4790
  6. package/lib/StormcloudPlayer.cjs.map +1 -1
  7. package/lib/StormcloudPlayer.d.cts +1 -0
  8. package/lib/index.cjs +5471 -4821
  9. package/lib/index.cjs.map +1 -1
  10. package/lib/index.d.cts +2 -1
  11. package/lib/index.d.ts +81 -1
  12. package/lib/index.js +5444 -4821
  13. package/lib/index.js.map +1 -1
  14. package/lib/player/AdBreakOrchestrator.cjs +404 -124
  15. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  16. package/lib/player/AdBreakOrchestrator.d.cts +12 -3
  17. package/lib/player/FloorLadder.cjs +578 -0
  18. package/lib/player/FloorLadder.cjs.map +1 -0
  19. package/lib/player/FloorLadder.d.cts +74 -0
  20. package/lib/player/StormcloudVideoPlayer.cjs +5383 -4790
  21. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  22. package/lib/player/StormcloudVideoPlayer.d.cts +9 -1
  23. package/lib/players/HlsPlayer.cjs +5383 -4790
  24. package/lib/players/HlsPlayer.cjs.map +1 -1
  25. package/lib/players/index.cjs +5383 -4790
  26. package/lib/players/index.cjs.map +1 -1
  27. package/lib/props.cjs +30 -8
  28. package/lib/props.cjs.map +1 -1
  29. package/lib/props.d.cts +1 -0
  30. package/lib/types.d.cts +22 -1
  31. package/lib/ui/StormcloudVideoPlayer.cjs +5434 -4812
  32. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  33. package/lib/ui/StormcloudVideoPlayer.d.cts +1 -0
  34. package/lib/utils/vastMacros.cjs +4 -0
  35. package/lib/utils/vastMacros.cjs.map +1 -1
  36. package/lib/utils/vastMacros.d.cts +2 -1
  37. package/package.json +1 -1
@@ -284,84 +284,6 @@ __export(AdBreakOrchestrator_exports, {
284
284
  }
285
285
  });
286
286
  module.exports = __toCommonJS(AdBreakOrchestrator_exports);
287
- // src/utils/trackingIngest.ts
288
- var DEFAULT_TRACKING_INGEST_CONFIG = {
289
- enabled: true,
290
- baseUrl: "https://player-analytics-ingest-api-760490581852.us-central1.run.app/api/adstorm/player-tracking"
291
- };
292
- var trackingIngestConfig = _object_spread({}, DEFAULT_TRACKING_INGEST_CONFIG);
293
- function isTrackingIngestEnabled() {
294
- return trackingIngestConfig.enabled === true;
295
- }
296
- function normalizeIngestBaseUrl(baseUrl) {
297
- return baseUrl.replace(/\/+$/, "");
298
- }
299
- function buildTrackingIngestUrl(channel) {
300
- var base = normalizeIngestBaseUrl(trackingIngestConfig.baseUrl);
301
- if (channel === "impressions") {
302
- return "".concat(base, "/impressions/ingest");
303
- }
304
- return "".concat(base, "/metrics/ingest");
305
- }
306
- function ingestPlayerTracking(licenseKey, channel, body) {
307
- return _async_to_generator(function() {
308
- var response, error;
309
- return _ts_generator(this, function(_state) {
310
- switch(_state.label){
311
- case 0:
312
- if (!isTrackingIngestEnabled() || !licenseKey) {
313
- return [
314
- 2,
315
- false
316
- ];
317
- }
318
- _state.label = 1;
319
- case 1:
320
- _state.trys.push([
321
- 1,
322
- 3,
323
- ,
324
- 4
325
- ]);
326
- return [
327
- 4,
328
- fetch(buildTrackingIngestUrl(channel), {
329
- method: "POST",
330
- headers: {
331
- "Content-Type": "application/json",
332
- Authorization: "License-Key ".concat(licenseKey)
333
- },
334
- body: JSON.stringify(body)
335
- })
336
- ];
337
- case 2:
338
- response = _state.sent();
339
- if (!response.ok) {
340
- console.warn("[StormcloudVideoPlayer] Tracking ingest failed (".concat(response.status, ") for ").concat(channel));
341
- return [
342
- 2,
343
- false
344
- ];
345
- }
346
- return [
347
- 2,
348
- true
349
- ];
350
- case 3:
351
- error = _state.sent();
352
- console.warn("[StormcloudVideoPlayer] Tracking ingest error for ".concat(channel, ":"), error);
353
- return [
354
- 2,
355
- false
356
- ];
357
- case 4:
358
- return [
359
- 2
360
- ];
361
- }
362
- });
363
- })();
364
- }
365
287
  // src/utils/vastEnvironmentSignals.ts
366
288
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
367
289
  var DEVICE_ID_STORAGE_KEYS = [
@@ -807,6 +729,225 @@ function normalizeBoolean(value) {
807
729
  }
808
730
  return void 0;
809
731
  }
732
+ // src/utils/vastMacros.ts
733
+ var GAM_AD_HOSTS = /* @__PURE__ */ new Set([
734
+ "pubads.g.doubleclick.net",
735
+ "securepubads.g.doubleclick.net"
736
+ ]);
737
+ function ensureVideoAdType(rawUrl) {
738
+ try {
739
+ var url = new URL(rawUrl);
740
+ if (!GAM_AD_HOSTS.has(url.hostname)) return rawUrl;
741
+ if (url.searchParams.has("ad_type")) return rawUrl;
742
+ url.searchParams.set("ad_type", "video");
743
+ return url.toString();
744
+ } catch (unused) {
745
+ return rawUrl;
746
+ }
747
+ }
748
+ // src/player/FloorLadder.ts
749
+ var DEFAULT_WEB_FLOOR_LADDER_CONFIG = Object.freeze({
750
+ enabled: false,
751
+ targetingKey: "airytv_web_floor",
752
+ minFloorCents: 25,
753
+ maxFloorCents: 300,
754
+ stepCents: 25,
755
+ selectedFloorCents: 25,
756
+ fallbackFloorCents: 25,
757
+ readyFloorCents: [],
758
+ mode: "fixed",
759
+ allowedPositions: [
760
+ "midroll"
761
+ ],
762
+ targetAdUnitPath: "/21821455290/airytvadx/airytv-web",
763
+ configurationVersion: "2026-09-29.1"
764
+ });
765
+ var DEFAULT_FLOOR_LADDER_BOUNDS = Object.freeze({
766
+ minCents: 25,
767
+ maxCents: 300,
768
+ stepCents: 25
769
+ });
770
+ function decodeQueryComponent(value) {
771
+ try {
772
+ return decodeURIComponent(value.replace(/\+/g, " "));
773
+ } catch (unused) {
774
+ return void 0;
775
+ }
776
+ }
777
+ function mergeCustParams(decoded, key, cents) {
778
+ var prefix = "".concat(key, "=");
779
+ var kept = decoded.split("&").filter(function(pair) {
780
+ return pair !== "" && pair !== key && pair.indexOf(prefix) !== 0;
781
+ });
782
+ kept.push("".concat(prefix).concat(cents));
783
+ return kept.join("&");
784
+ }
785
+ function applyFloorToVastUrl(url, floor) {
786
+ if (floor.status !== "armed" || floor.floorCents == null) {
787
+ return {
788
+ url: url,
789
+ applied: false,
790
+ reason: floor.reason
791
+ };
792
+ }
793
+ var parsed;
794
+ try {
795
+ parsed = new URL(url);
796
+ } catch (unused) {
797
+ return {
798
+ url: url,
799
+ applied: false,
800
+ reason: "invalid_url"
801
+ };
802
+ }
803
+ if (!GAM_AD_HOSTS.has(parsed.hostname)) {
804
+ return {
805
+ url: url,
806
+ applied: false,
807
+ reason: "not_gam_host"
808
+ };
809
+ }
810
+ if (parsed.searchParams.get("iu") !== floor.targetAdUnitPath) {
811
+ return {
812
+ url: url,
813
+ applied: false,
814
+ reason: "ad_unit_mismatch"
815
+ };
816
+ }
817
+ var hashIndex = url.indexOf("#");
818
+ var beforeHash = hashIndex === -1 ? url : url.slice(0, hashIndex);
819
+ var hash = hashIndex === -1 ? "" : url.slice(hashIndex);
820
+ var queryIndex = beforeHash.indexOf("?");
821
+ var base = beforeHash.slice(0, queryIndex);
822
+ var segments = beforeHash.slice(queryIndex + 1).split("&");
823
+ var existing = [];
824
+ var insertAt = -1;
825
+ var rest = [];
826
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
827
+ try {
828
+ for(var _iterator = segments[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
829
+ var segment = _step.value;
830
+ var eq = segment.indexOf("=");
831
+ var rawKey = eq === -1 ? segment : segment.slice(0, eq);
832
+ if (decodeQueryComponent(rawKey) === "cust_params") {
833
+ if (insertAt === -1) insertAt = rest.length;
834
+ var value = eq === -1 ? "" : decodeQueryComponent(segment.slice(eq + 1));
835
+ if (value === void 0) {
836
+ return {
837
+ url: url,
838
+ applied: false,
839
+ reason: "malformed_cust_params"
840
+ };
841
+ }
842
+ if (value) existing.push(value);
843
+ continue;
844
+ }
845
+ rest.push(segment);
846
+ }
847
+ } catch (err) {
848
+ _didIteratorError = true;
849
+ _iteratorError = err;
850
+ } finally{
851
+ try {
852
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
853
+ _iterator.return();
854
+ }
855
+ } finally{
856
+ if (_didIteratorError) {
857
+ throw _iteratorError;
858
+ }
859
+ }
860
+ }
861
+ if (insertAt === -1) insertAt = rest.length;
862
+ var merged = mergeCustParams(existing.join("&"), floor.targetingKey, floor.floorCents);
863
+ rest.splice(insertAt, 0, "cust_params=".concat(encodeURIComponent(merged)));
864
+ var query = rest.filter(function(segment) {
865
+ return segment !== "";
866
+ }).join("&");
867
+ return {
868
+ url: "".concat(base, "?").concat(query).concat(hash),
869
+ applied: true,
870
+ reason: void 0
871
+ };
872
+ }
873
+ // src/utils/trackingIngest.ts
874
+ var DEFAULT_TRACKING_INGEST_CONFIG = {
875
+ enabled: true,
876
+ baseUrl: "https://player-analytics-ingest-api-760490581852.us-central1.run.app/api/adstorm/player-tracking"
877
+ };
878
+ var trackingIngestConfig = _object_spread({}, DEFAULT_TRACKING_INGEST_CONFIG);
879
+ function isTrackingIngestEnabled() {
880
+ return trackingIngestConfig.enabled === true;
881
+ }
882
+ function normalizeIngestBaseUrl(baseUrl) {
883
+ return baseUrl.replace(/\/+$/, "");
884
+ }
885
+ function buildTrackingIngestUrl(channel) {
886
+ var base = normalizeIngestBaseUrl(trackingIngestConfig.baseUrl);
887
+ if (channel === "impressions") {
888
+ return "".concat(base, "/impressions/ingest");
889
+ }
890
+ return "".concat(base, "/metrics/ingest");
891
+ }
892
+ function ingestPlayerTracking(licenseKey, channel, body) {
893
+ return _async_to_generator(function() {
894
+ var response, error;
895
+ return _ts_generator(this, function(_state) {
896
+ switch(_state.label){
897
+ case 0:
898
+ if (!isTrackingIngestEnabled() || !licenseKey) {
899
+ return [
900
+ 2,
901
+ false
902
+ ];
903
+ }
904
+ _state.label = 1;
905
+ case 1:
906
+ _state.trys.push([
907
+ 1,
908
+ 3,
909
+ ,
910
+ 4
911
+ ]);
912
+ return [
913
+ 4,
914
+ fetch(buildTrackingIngestUrl(channel), {
915
+ method: "POST",
916
+ headers: {
917
+ "Content-Type": "application/json",
918
+ Authorization: "License-Key ".concat(licenseKey)
919
+ },
920
+ body: JSON.stringify(body)
921
+ })
922
+ ];
923
+ case 2:
924
+ response = _state.sent();
925
+ if (!response.ok) {
926
+ console.warn("[StormcloudVideoPlayer] Tracking ingest failed (".concat(response.status, ") for ").concat(channel));
927
+ return [
928
+ 2,
929
+ false
930
+ ];
931
+ }
932
+ return [
933
+ 2,
934
+ true
935
+ ];
936
+ case 3:
937
+ error = _state.sent();
938
+ console.warn("[StormcloudVideoPlayer] Tracking ingest error for ".concat(channel, ":"), error);
939
+ return [
940
+ 2,
941
+ false
942
+ ];
943
+ case 4:
944
+ return [
945
+ 2
946
+ ];
947
+ }
948
+ });
949
+ })();
950
+ }
810
951
  // src/utils/tracking.ts
811
952
  var cachedBrowserId = null;
812
953
  function buildAnalyticsContext(config) {
@@ -1288,22 +1429,6 @@ function sendHeartbeat(_0) {
1288
1429
  function getAdAudioVolume(adPlayer) {
1289
1430
  return adPlayer.getOriginalMutedState() ? 0 : adPlayer.getOriginalVolume();
1290
1431
  }
1291
- // src/utils/vastMacros.ts
1292
- var GAM_AD_HOSTS = /* @__PURE__ */ new Set([
1293
- "pubads.g.doubleclick.net",
1294
- "securepubads.g.doubleclick.net"
1295
- ]);
1296
- function ensureVideoAdType(rawUrl) {
1297
- try {
1298
- var url = new URL(rawUrl);
1299
- if (!GAM_AD_HOSTS.has(url.hostname)) return rawUrl;
1300
- if (url.searchParams.has("ad_type")) return rawUrl;
1301
- url.searchParams.set("ad_type", "video");
1302
- return url.toString();
1303
- } catch (unused) {
1304
- return rawUrl;
1305
- }
1306
- }
1307
1432
  // src/player/AdBreakOrchestrator.ts
1308
1433
  var REQUEST_FAILURE_STAGES = /* @__PURE__ */ new Set([
1309
1434
  "no_fill",
@@ -1335,6 +1460,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1335
1460
  this.adPodQueue = [];
1336
1461
  this.defaultMinRemainingMsToRequestAd = 1e4;
1337
1462
  this.defaultMaxNoFillsPerBreak = 2;
1463
+ this.defaultLiveMaxNoFillsPerBreak = 1;
1464
+ this.breakDurationWaitMs = 300;
1338
1465
  this.pendingAdBreak = null;
1339
1466
  this.host = host;
1340
1467
  this.timing = timing;
@@ -1451,7 +1578,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1451
1578
  }
1452
1579
  });
1453
1580
  adPlayer.on("ad_error", function(errorPayload) {
1454
- var errorMessage = "Ad playback failed";
1581
+ if (_this.controllerCallInFlight) {
1582
+ if (_this.debug) {
1583
+ console.log("[AdBreak] ad_error during request/play; outcome reported by the caller", errorPayload || "");
1584
+ }
1585
+ return;
1586
+ }
1587
+ var errorMessage = "Ad error (no details)";
1455
1588
  if (errorPayload) {
1456
1589
  var errorCode = errorPayload.code || errorPayload.errorCode || "unknown";
1457
1590
  var vastErrorCode = errorPayload.vastErrorCode;
@@ -1467,9 +1600,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1467
1600
  }
1468
1601
  }
1469
1602
  console.error("[AD-ERROR]", errorMessage, errorPayload || "");
1470
- if (_this.controllerCallInFlight) {
1471
- return;
1472
- }
1473
1603
  _this.handleAdFailure("ad_error");
1474
1604
  });
1475
1605
  adPlayer.on("content_pause", function() {
@@ -1607,20 +1737,20 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1607
1737
  },
1608
1738
  {
1609
1739
  key: "beginVmapBreak",
1610
- value: function beginVmapBreak(breakKey) {
1740
+ value: function beginVmapBreak(breakKey, position) {
1611
1741
  this.breakSource = "vmap";
1612
1742
  this.followUpBaseVastUrl = void 0;
1613
1743
  this.unusableResponsesInBreak = 0;
1614
1744
  this.timing.totalAdRequestsInBreak = 0;
1615
1745
  this.setSlotState("NEEDS_NEXT_AD", "vmap_break_start");
1616
- this.noteOpportunity("vmap", breakKey);
1746
+ this.noteOpportunity("vmap", breakKey, position);
1617
1747
  }
1618
1748
  },
1619
1749
  {
1620
1750
  key: "handleAdStart",
1621
1751
  value: function handleAdStart(marker) {
1622
1752
  return _async_to_generator(function() {
1623
- var baseVastUrl, adBreakDurationMs, mode, currentMuted, currentVolume, epoch, podPlayed;
1753
+ var baseVastUrl, adBreakDurationMs, currentMuted, currentVolume, epoch, hasPrefetchedUrl, mode, podPlayed;
1624
1754
  return _ts_generator(this, function(_state) {
1625
1755
  switch(_state.label){
1626
1756
  case 0:
@@ -1642,10 +1772,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1642
1772
  ];
1643
1773
  }
1644
1774
  adBreakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : this.timing.expectedAdBreakDurationMs;
1645
- if (this.debug) {
1646
- mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
1647
- console.log("[CONTINUOUS-FETCH] ".concat(mode, " MODE: Target duration=").concat(adBreakDurationMs, "ms"));
1648
- }
1649
1775
  this.timing.failedVastUrls.clear();
1650
1776
  this.timing.temporaryFailureUrls.clear();
1651
1777
  this.timing.consecutiveFailures = 0;
@@ -1672,13 +1798,33 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1672
1798
  if (this.timing.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
1673
1799
  this.timing.expectedAdBreakDurationMs = adBreakDurationMs;
1674
1800
  }
1675
- this.noteOpportunity("scte35", this.cueManager.activeScte35BreakKey);
1801
+ this.noteOpportunity("scte35", this.cueManager.activeScte35BreakKey, "midroll");
1676
1802
  epoch = this.timing.adBreakEpoch;
1803
+ hasPrefetchedUrl = !!(this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0);
1804
+ if (!(adBreakDurationMs == null && !hasPrefetchedUrl)) return [
1805
+ 3,
1806
+ 2
1807
+ ];
1677
1808
  return [
1678
1809
  4,
1679
- this.startOptimizedPod(baseVastUrl, adBreakDurationMs)
1810
+ this.waitForBreakDuration(this.breakDurationWaitMs)
1680
1811
  ];
1681
1812
  case 1:
1813
+ adBreakDurationMs = _state.sent();
1814
+ if (!this.inAdBreak || epoch !== this.timing.adBreakEpoch) return [
1815
+ 2
1816
+ ];
1817
+ _state.label = 2;
1818
+ case 2:
1819
+ if (this.debug) {
1820
+ mode = this.host.config.isLiveStream ? "LIVE" : "VOD";
1821
+ console.log("[AdBreak] ".concat(mode, " break start: target duration=").concat(adBreakDurationMs != null ? "".concat(adBreakDurationMs, "ms") : "unknown"));
1822
+ }
1823
+ return [
1824
+ 4,
1825
+ this.startOptimizedPod(baseVastUrl, adBreakDurationMs)
1826
+ ];
1827
+ case 3:
1682
1828
  podPlayed = _state.sent();
1683
1829
  if (!podPlayed && this.inAdBreak && epoch === this.timing.adBreakEpoch) {
1684
1830
  this.setSlotState("NEEDS_NEXT_AD", "initial_request_failed");
@@ -1692,6 +1838,53 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1692
1838
  }).call(this);
1693
1839
  }
1694
1840
  },
1841
+ {
1842
+ key: "waitForBreakDuration",
1843
+ value: function waitForBreakDuration(maxWaitMs) {
1844
+ return _async_to_generator(function() {
1845
+ var deadline, durationMs;
1846
+ return _ts_generator(this, function(_state) {
1847
+ switch(_state.label){
1848
+ case 0:
1849
+ deadline = Date.now() + maxWaitMs;
1850
+ _state.label = 1;
1851
+ case 1:
1852
+ if (!(this.timing.expectedAdBreakDurationMs == null && Date.now() < deadline)) return [
1853
+ 3,
1854
+ 3
1855
+ ];
1856
+ return [
1857
+ 4,
1858
+ new Promise(function(resolve) {
1859
+ return setTimeout(resolve, 50);
1860
+ })
1861
+ ];
1862
+ case 2:
1863
+ _state.sent();
1864
+ if (!this.inAdBreak) return [
1865
+ 3,
1866
+ 3
1867
+ ];
1868
+ return [
1869
+ 3,
1870
+ 1
1871
+ ];
1872
+ case 3:
1873
+ durationMs = this.timing.expectedAdBreakDurationMs;
1874
+ this.logOrchestratorFunnel("break_duration_wait", {
1875
+ waitedForMs: maxWaitMs - Math.max(0, deadline - Date.now()),
1876
+ durationMs: durationMs,
1877
+ resolved: durationMs != null
1878
+ });
1879
+ return [
1880
+ 2,
1881
+ durationMs
1882
+ ];
1883
+ }
1884
+ });
1885
+ }).call(this);
1886
+ }
1887
+ },
1695
1888
  {
1696
1889
  key: "startOptimizedPod",
1697
1890
  value: // ───────────────────────────────────────────────────────────────
@@ -1699,7 +1892,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1699
1892
  // ───────────────────────────────────────────────────────────────
1700
1893
  function startOptimizedPod(baseVastUrl, breakDurationMs) {
1701
1894
  return _async_to_generator(function() {
1702
- var podUrl, prefetched, epoch, generation, adPlayer, requestToken, _ref, _adPlayer_getPodAdCount, podCount, error;
1895
+ var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _adPlayer_getPodAdCount, podCount, error;
1703
1896
  return _ts_generator(this, function(_state) {
1704
1897
  switch(_state.label){
1705
1898
  case 0:
@@ -1723,9 +1916,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1723
1916
  adPlayer = this.host.getAdPlayer();
1724
1917
  requestToken = ++this.timing.adRequestTokenCounter;
1725
1918
  this.timing.activeAdRequestToken = requestToken;
1726
- this.currentVastUrl = podUrl;
1727
1919
  this.setSlotState("REQUESTING", "initial_pod");
1728
1920
  this.beginFunnelRequest(adPlayer, requestToken, "initial_pod");
1921
+ requestUrl = this.applyOpportunityFloor(podUrl);
1922
+ this.currentVastUrl = requestUrl;
1729
1923
  _state.label = 1;
1730
1924
  case 1:
1731
1925
  _state.trys.push([
@@ -1748,7 +1942,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1748
1942
  return [
1749
1943
  4,
1750
1944
  this.callController(function() {
1751
- return adPlayer.requestAds(podUrl);
1945
+ return adPlayer.requestAds(requestUrl);
1752
1946
  })
1753
1947
  ];
1754
1948
  case 3:
@@ -1780,7 +1974,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1780
1974
  }
1781
1975
  sendAdLoadedTracking(this.host.config.licenseKey, {
1782
1976
  source: "hls",
1783
- vastUrl: podUrl,
1977
+ vastUrl: requestUrl,
1784
1978
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
1785
1979
  }, this.analyticsContext).catch(function() {});
1786
1980
  this.timing.startAdFailsafeTimer(requestToken);
@@ -1878,7 +2072,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1878
2072
  key: "getMaxNoFillsPerBreak",
1879
2073
  value: function getMaxNoFillsPerBreak() {
1880
2074
  var configured = this.host.config.maxNoFillsPerBreak;
1881
- return typeof configured === "number" && configured > 0 ? configured : this.defaultMaxNoFillsPerBreak;
2075
+ if (typeof configured === "number" && configured > 0) return configured;
2076
+ return this.breakSource === "scte35" ? this.defaultLiveMaxNoFillsPerBreak : this.defaultMaxNoFillsPerBreak;
1882
2077
  }
1883
2078
  },
1884
2079
  {
@@ -2074,6 +2269,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2074
2269
  } catch (unused) {}
2075
2270
  var adType = (_ref = params === null || params === void 0 ? void 0 : params.get("ad_type")) !== null && _ref !== void 0 ? _ref : void 0;
2076
2271
  this.logOrchestratorFunnel("vast_url_generated", {
2272
+ requestId: void 0,
2077
2273
  source: source,
2078
2274
  pod: (_ref1 = params === null || params === void 0 ? void 0 : params.get("pod")) !== null && _ref1 !== void 0 ? _ref1 : void 0,
2079
2275
  pmad: (_ref2 = params === null || params === void 0 ? void 0 : params.get("pmad")) !== null && _ref2 !== void 0 ? _ref2 : void 0,
@@ -2125,12 +2321,14 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2125
2321
  this.timing.failedVastUrls.add(vastTagUrl);
2126
2322
  }
2127
2323
  this.countFunnelStage("request_outcome:".concat(outcome));
2128
- this.logOrchestratorFunnel("request_outcome", {
2324
+ this.logOrchestratorFunnel("request_outcome", _object_spread({
2129
2325
  outcome: outcome,
2130
2326
  errorMessage: message,
2131
2327
  consecutiveFailures: this.timing.consecutiveFailures,
2132
- unusableResponsesInBreak: this.unusableResponsesInBreak
2133
- });
2328
+ unusableResponsesInBreak: this.unusableResponsesInBreak,
2329
+ vastAdCount: diag === null || diag === void 0 ? void 0 : diag.vastAdCount,
2330
+ impressionCount: diag === null || diag === void 0 ? void 0 : diag.impressionCount
2331
+ }, this.requestFloorFields(diag)));
2134
2332
  }
2135
2333
  },
2136
2334
  {
@@ -2169,6 +2367,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2169
2367
  break;
2170
2368
  case "impression_fired":
2171
2369
  diag.impressionFired = true;
2370
+ diag.impressionCount++;
2172
2371
  break;
2173
2372
  default:
2174
2373
  if (REQUEST_FAILURE_STAGES.has(payload.stage) && !diag.failureReason) {
@@ -2225,6 +2424,67 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2225
2424
  }
2226
2425
  }
2227
2426
  },
2427
+ {
2428
+ key: "opportunityFloorFields",
2429
+ value: function opportunityFloorFields() {
2430
+ var floor = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.opportunityFloor;
2431
+ if (!floor) return {};
2432
+ return {
2433
+ floorStatus: floor.status,
2434
+ floorCents: floor.floorCents,
2435
+ floorSource: floor.source,
2436
+ floorReason: floor.reason,
2437
+ floorSelector: floor.selector,
2438
+ floorConfigVersion: floor.configurationVersion,
2439
+ adPosition: floor.position
2440
+ };
2441
+ }
2442
+ },
2443
+ {
2444
+ key: "requestFloorFields",
2445
+ value: function requestFloorFields(diag) {
2446
+ if (!diag || diag.floorApplied === void 0) return {};
2447
+ return {
2448
+ floorApplied: diag.floorApplied,
2449
+ floorCents: diag.floorCents,
2450
+ floorSource: diag.floorSource,
2451
+ floorReason: diag.floorReason,
2452
+ floorConfigVersion: diag.floorConfigVersion
2453
+ };
2454
+ }
2455
+ },
2456
+ {
2457
+ key: "applyOpportunityFloor",
2458
+ value: function applyOpportunityFloor(url) {
2459
+ var floor = this.opportunityFloor;
2460
+ if (!floor) return url;
2461
+ var result = applyFloorToVastUrl(url, floor);
2462
+ var diag = this.currentRequestId != null ? this.requestDiagnostics.get(this.currentRequestId) : void 0;
2463
+ if (diag) {
2464
+ diag.floorApplied = result.applied;
2465
+ if (result.applied && floor.floorCents != null) diag.floorCents = floor.floorCents;
2466
+ diag.floorSource = result.applied ? floor.source : "none";
2467
+ if (result.reason) diag.floorReason = result.reason;
2468
+ diag.floorConfigVersion = floor.configurationVersion;
2469
+ }
2470
+ if (floor.status === "skipped" && floor.reason === "disabled") {
2471
+ this.countFunnelStage("floor_skipped:disabled");
2472
+ return result.url;
2473
+ }
2474
+ this.logOrchestratorFunnel(result.applied ? "floor_applied" : "floor_skipped", {
2475
+ reason: result.reason,
2476
+ floorCents: result.applied ? floor.floorCents : void 0,
2477
+ floorSource: result.applied ? floor.source : "none",
2478
+ floorSelector: floor.selector,
2479
+ floorConfigVersion: floor.configurationVersion,
2480
+ adPosition: floor.position
2481
+ });
2482
+ if (!result.applied && result.reason) {
2483
+ this.countFunnelStage("floor_skipped:".concat(result.reason));
2484
+ }
2485
+ return result.url;
2486
+ }
2487
+ },
2228
2488
  {
2229
2489
  key: "countFunnelStage",
2230
2490
  value: function countFunnelStage(stage) {
@@ -2247,7 +2507,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2247
2507
  },
2248
2508
  {
2249
2509
  key: "noteOpportunity",
2250
- value: function noteOpportunity(source, breakKey) {
2510
+ value: function noteOpportunity(source, breakKey, position) {
2251
2511
  if (breakKey && breakKey === this.opportunityBreakKey && this.opportunityEpoch === this.timing.adBreakEpoch) {
2252
2512
  this.logOrchestratorFunnel("duplicate_break_start", {
2253
2513
  source: source,
@@ -2257,11 +2517,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2257
2517
  }
2258
2518
  this.opportunityBreakKey = breakKey;
2259
2519
  this.opportunityEpoch = this.timing.adBreakEpoch;
2260
- this.logOrchestratorFunnel("opportunity_created", {
2520
+ try {
2521
+ this.opportunityFloor = this.host.getFloorSnapshot(position);
2522
+ } catch (unused) {
2523
+ this.opportunityFloor = void 0;
2524
+ }
2525
+ this.logOrchestratorFunnel("opportunity_created", _object_spread({
2261
2526
  source: source,
2262
2527
  breakKey: breakKey,
2263
2528
  expectedDurationMs: this.timing.expectedAdBreakDurationMs
2264
- });
2529
+ }, this.opportunityFloorFields()));
2265
2530
  }
2266
2531
  },
2267
2532
  {
@@ -2288,6 +2553,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2288
2553
  supportedMediaCount: 0,
2289
2554
  playStarted: false,
2290
2555
  impressionFired: false,
2556
+ impressionCount: 0,
2291
2557
  startedAt: Date.now()
2292
2558
  });
2293
2559
  (_adPlayer_setFunnelContext = adPlayer.setFunnelContext) === null || _adPlayer_setFunnelContext === void 0 ? void 0 : _adPlayer_setFunnelContext.call(adPlayer, {
@@ -2372,7 +2638,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2372
2638
  value: function playSingleAd(vastTagUrl) {
2373
2639
  var trigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "vmap";
2374
2640
  return _async_to_generator(function() {
2375
- var epoch, generation, requestToken, ap, requestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
2641
+ var epoch, generation, requestToken, ap, budgetedUrl, requestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
2376
2642
  return _ts_generator(this, function(_state) {
2377
2643
  switch(_state.label){
2378
2644
  case 0:
@@ -2410,10 +2676,11 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2410
2676
  requestToken = ++this.timing.adRequestTokenCounter;
2411
2677
  this.timing.activeAdRequestToken = requestToken;
2412
2678
  ap = this.host.getAdPlayer();
2413
- requestUrl = this.withCurrentPodBudget(vastTagUrl);
2414
- this.currentVastUrl = requestUrl;
2679
+ budgetedUrl = this.withCurrentPodBudget(vastTagUrl);
2415
2680
  this.setSlotState("REQUESTING", trigger);
2416
2681
  this.beginFunnelRequest(ap, requestToken, trigger);
2682
+ requestUrl = this.applyOpportunityFloor(budgetedUrl);
2683
+ this.currentVastUrl = requestUrl;
2417
2684
  _state.label = 1;
2418
2685
  case 1:
2419
2686
  _state.trys.push([
@@ -2546,10 +2813,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2546
2813
  endReason: endReason
2547
2814
  });
2548
2815
  }
2549
- console.log("[AdBreak][FUNNEL] Break summary", {
2816
+ console.log("[AdBreak][FUNNEL] Break summary", _object_spread_props(_object_spread({
2550
2817
  breakId: breakId,
2551
2818
  endReason: endReason,
2552
- opportunities: count("opportunity_created"),
2819
+ opportunities: count("opportunity_created")
2820
+ }, this.opportunityFloorFields()), {
2821
+ floorAppliedRequests: count("floor_applied"),
2822
+ floorSkippedRequests: count("floor_skipped") + count("floor_skipped:disabled"),
2553
2823
  vastUrlsGenerated: count("vast_url_generated"),
2554
2824
  requests: requests,
2555
2825
  requestRetries: requestRetries,
@@ -2601,13 +2871,14 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2601
2871
  visibilityHidden: count("while_hidden"),
2602
2872
  playbackFailures: count("play_failed") + count("media_error") + count("hls_fatal") + count("stall") + count("decode_failure") + count("media_unsupported"),
2603
2873
  stages: funnel
2604
- });
2874
+ }));
2605
2875
  }
2606
2876
  },
2607
2877
  {
2608
2878
  key: "handleAdPodComplete",
2609
2879
  value: function handleAdPodComplete() {
2610
2880
  var reason = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "unspecified";
2881
+ var _this_breakFunnel_play_called, _this_breakFunnel_impression_fired;
2611
2882
  if (this.debug) {
2612
2883
  console.log("[StormcloudVideoPlayer] Ad pod complete - cleaning up", {
2613
2884
  reason: reason
@@ -2632,6 +2903,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2632
2903
  }
2633
2904
  this.finalizeRequestDiagnostics(this.currentRequestId, "break_ended:".concat(reason));
2634
2905
  this.currentRequestId = void 0;
2906
+ var contentWasInterrupted = this.showAds || this.isShowingPlaceholder || ((_this_breakFunnel_play_called = this.breakFunnel["play_called"]) !== null && _this_breakFunnel_play_called !== void 0 ? _this_breakFunnel_play_called : 0) > 0 || ((_this_breakFunnel_impression_fired = this.breakFunnel["impression_fired"]) !== null && _this_breakFunnel_impression_fired !== void 0 ? _this_breakFunnel_impression_fired : 0) > 0;
2635
2907
  this.timing.resetForBreakEnd();
2636
2908
  this.placeholder.hide();
2637
2909
  this.clearPendingAdBreak();
@@ -2650,6 +2922,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2650
2922
  this.unusableResponsesInBreak = 0;
2651
2923
  adPlayer.stop().catch(function() {});
2652
2924
  if (!alreadyEnded) this.logBreakFunnel(reason);
2925
+ this.opportunityFloor = void 0;
2653
2926
  this.setSlotState("IDLE", "break_complete");
2654
2927
  var restoredMuted = this.host.getAdPlayer().getOriginalMutedState();
2655
2928
  var restoredVolume = this.host.getAdPlayer().getOriginalVolume();
@@ -2670,6 +2943,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
2670
2943
  this.monitorLiveResumeStall(this.host.video.currentTime);
2671
2944
  return;
2672
2945
  }
2946
+ if (!contentWasInterrupted) {
2947
+ if (this.debug) {
2948
+ console.log("[StormcloudVideoPlayer] Live break end \u2014 no ad was shown, leaving playback position unchanged");
2949
+ }
2950
+ this.resumeContentPlayback();
2951
+ return;
2952
+ }
2673
2953
  var liveSyncPos = this.host.getLiveSyncPosition();
2674
2954
  if (liveSyncPos != null && liveSyncPos > this.host.video.currentTime) {
2675
2955
  if (this.debug) {