stormcloud-video-player 0.7.14 → 0.7.16

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.
@@ -2753,6 +2753,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2753
2753
  this.maxTotalAdRequestsPerBreak = 20;
2754
2754
  this.pendingAdBreak = null;
2755
2755
  this.savedMutedStateBeforeAd = null;
2756
+ this.adLayerInitialized = false;
2756
2757
  this.consecutiveFailures = 0;
2757
2758
  this.maxConsecutiveFailures = 5;
2758
2759
  this.lastAdRequestTime = 0;
@@ -3401,12 +3402,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3401
3402
  this.video.autoplay = !!this.config.autoplay;
3402
3403
  this.video.muted = !!this.config.muted;
3403
3404
  if (!this.config.disableAds) {
3404
- this.adLayer.initialize();
3405
- if (!this.config.disableFiller) {
3406
- this.ensureFillerVideo();
3407
- }
3408
- this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
3409
- this.attachAdLayerEventListeners();
3405
+ this.initializeAdLayer();
3410
3406
  }
3411
3407
  this.timeUpdateHandler = function() {
3412
3408
  _this.onTimeUpdate(_this.video.currentTime);
@@ -3507,6 +3503,31 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3507
3503
  return this.showAds;
3508
3504
  }
3509
3505
  },
3506
+ {
3507
+ key: "initializeAdLayer",
3508
+ value: function initializeAdLayer() {
3509
+ if (this.adLayerInitialized) return;
3510
+ this.adLayer.initialize();
3511
+ if (!this.config.disableFiller) {
3512
+ this.ensureFillerVideo();
3513
+ }
3514
+ this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
3515
+ this.attachAdLayerEventListeners();
3516
+ this.adLayerInitialized = true;
3517
+ }
3518
+ },
3519
+ {
3520
+ key: "setDisableAds",
3521
+ value: function setDisableAds(disabled) {
3522
+ this.config.disableAds = disabled;
3523
+ if (!disabled && this.attached) {
3524
+ this.initializeAdLayer();
3525
+ }
3526
+ if (this.config.debugAdTiming) {
3527
+ console.log("[StormcloudVideoPlayer] setDisableAds:", disabled);
3528
+ }
3529
+ }
3530
+ },
3510
3531
  {
3511
3532
  key: "syncMainContentAudioWhenVisible",
3512
3533
  value: function syncMainContentAudioWhenVisible() {
@@ -5741,60 +5762,303 @@ function TextOverlay(param) {
5741
5762
  children: text
5742
5763
  });
5743
5764
  }
5765
+ function fetchRSSItems(rssUrl, maxItems) {
5766
+ return _async_to_generator(function() {
5767
+ var resp, data, parser, doc;
5768
+ return _ts_generator(this, function(_state) {
5769
+ switch(_state.label){
5770
+ case 0:
5771
+ return [
5772
+ 4,
5773
+ fetch("https://api.allorigins.win/get?url=".concat(encodeURIComponent(rssUrl)))
5774
+ ];
5775
+ case 1:
5776
+ resp = _state.sent();
5777
+ return [
5778
+ 4,
5779
+ resp.json()
5780
+ ];
5781
+ case 2:
5782
+ data = _state.sent();
5783
+ if (!data.contents) throw new Error("No content from RSS feed");
5784
+ parser = new DOMParser();
5785
+ doc = parser.parseFromString(data.contents, "text/xml");
5786
+ if (doc.querySelector("parsererror")) throw new Error("Invalid RSS XML");
5787
+ return [
5788
+ 2,
5789
+ Array.from(doc.querySelectorAll("item")).map(function(item) {
5790
+ var _item_querySelector, _item_querySelector1, _item_querySelector2, _item_querySelector3, _item_querySelector4;
5791
+ return {
5792
+ title: (((_item_querySelector = item.querySelector("title")) === null || _item_querySelector === void 0 ? void 0 : _item_querySelector.textContent) || "").replace(/<[^>]*>/g, "").trim(),
5793
+ description: (((_item_querySelector1 = item.querySelector("description")) === null || _item_querySelector1 === void 0 ? void 0 : _item_querySelector1.textContent) || "").replace(/<[^>]*>/g, "").trim(),
5794
+ pubDate: ((_item_querySelector2 = item.querySelector("pubDate")) === null || _item_querySelector2 === void 0 ? void 0 : _item_querySelector2.textContent) || "",
5795
+ author: ((_item_querySelector3 = item.querySelector("author, dc\\:creator")) === null || _item_querySelector3 === void 0 ? void 0 : _item_querySelector3.textContent) || "",
5796
+ category: ((_item_querySelector4 = item.querySelector("category")) === null || _item_querySelector4 === void 0 ? void 0 : _item_querySelector4.textContent) || ""
5797
+ };
5798
+ }).filter(function(i) {
5799
+ return i.title;
5800
+ }).slice(0, maxItems)
5801
+ ];
5802
+ }
5803
+ });
5804
+ })();
5805
+ }
5744
5806
  function ScrollerOverlay(param) {
5745
5807
  var overlay = param.overlay;
5746
- var _ref, _ref1, _ref2, _ref3, _ref4;
5808
+ var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12;
5747
5809
  var cfg = overlay.scroller_config;
5748
- var text = (cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text) && cfg.custom_text ? cfg.custom_text : overlay.content || (cfg === null || cfg === void 0 ? void 0 : cfg.custom_text) || "";
5749
- var scrollSpeed = (_ref = cfg === null || cfg === void 0 ? void 0 : cfg.scroll_speed) !== null && _ref !== void 0 ? _ref : 50;
5750
- var direction = (_ref1 = cfg === null || cfg === void 0 ? void 0 : cfg.direction) !== null && _ref1 !== void 0 ? _ref1 : "left";
5751
- var fontSize = (cfg === null || cfg === void 0 ? void 0 : cfg.font_size) ? "".concat(cfg.font_size, "px") : "clamp(10px, 1.2vw, 18px)";
5810
+ var uid = (0, import_react.useId)().replace(/:/g, "");
5811
+ var _ref13 = _sliced_to_array((0, import_react.useState)([]), 2), rssItems = _ref13[0], setRssItems = _ref13[1];
5812
+ var _ref14 = _sliced_to_array((0, import_react.useState)(false), 2), rssLoading = _ref14[0], setRssLoading = _ref14[1];
5813
+ var rssUrl = (cfg === null || cfg === void 0 ? void 0 : cfg.rss_url) || "";
5814
+ var maxItems = (_ref = cfg === null || cfg === void 0 ? void 0 : cfg.max_items) !== null && _ref !== void 0 ? _ref : 10;
5815
+ var autoRefresh = (cfg === null || cfg === void 0 ? void 0 : cfg.auto_refresh) !== false;
5816
+ var updateInterval = (_ref1 = cfg === null || cfg === void 0 ? void 0 : cfg.update_interval) !== null && _ref1 !== void 0 ? _ref1 : 5;
5817
+ (0, import_react.useEffect)(function() {
5818
+ if (!rssUrl || (cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text) && (cfg === null || cfg === void 0 ? void 0 : cfg.custom_text)) return;
5819
+ var cancelled = false;
5820
+ setRssLoading(true);
5821
+ fetchRSSItems(rssUrl, maxItems).then(function(items) {
5822
+ if (!cancelled) setRssItems(items);
5823
+ }).catch(function() {}).finally(function() {
5824
+ if (!cancelled) setRssLoading(false);
5825
+ });
5826
+ return function() {
5827
+ cancelled = true;
5828
+ };
5829
+ }, [
5830
+ rssUrl,
5831
+ maxItems,
5832
+ cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text,
5833
+ cfg === null || cfg === void 0 ? void 0 : cfg.custom_text
5834
+ ]);
5835
+ (0, import_react.useEffect)(function() {
5836
+ if (!rssUrl || !autoRefresh || (cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text) && (cfg === null || cfg === void 0 ? void 0 : cfg.custom_text)) return;
5837
+ var interval = setInterval(function() {
5838
+ fetchRSSItems(rssUrl, maxItems).then(setRssItems).catch(function() {});
5839
+ }, updateInterval * 60 * 1e3);
5840
+ return function() {
5841
+ return clearInterval(interval);
5842
+ };
5843
+ }, [
5844
+ rssUrl,
5845
+ autoRefresh,
5846
+ updateInterval,
5847
+ maxItems,
5848
+ cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text,
5849
+ cfg === null || cfg === void 0 ? void 0 : cfg.custom_text
5850
+ ]);
5851
+ var sep = (_ref2 = cfg === null || cfg === void 0 ? void 0 : cfg.separator_char) !== null && _ref2 !== void 0 ? _ref2 : "\u25C6";
5852
+ var segments;
5853
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text) && (cfg === null || cfg === void 0 ? void 0 : cfg.custom_text)) {
5854
+ segments = [
5855
+ cfg.custom_text
5856
+ ];
5857
+ } else if (rssItems.length > 0) {
5858
+ segments = rssItems.map(function(item) {
5859
+ var parts = [];
5860
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.show_title) !== false && item.title) parts.push(item.title);
5861
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.show_description) && item.description) parts.push(item.description);
5862
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.show_timestamp) && item.pubDate) {
5863
+ try {
5864
+ parts.push(new Date(item.pubDate).toLocaleDateString());
5865
+ } catch (unused) {}
5866
+ }
5867
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.show_author) && item.author) parts.push("— ".concat(item.author));
5868
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.show_category) && item.category) parts.push("[".concat(item.category, "]"));
5869
+ return parts.join(" ");
5870
+ });
5871
+ } else if (rssLoading) {
5872
+ segments = [
5873
+ "Loading feed\u2026"
5874
+ ];
5875
+ } else if (overlay.content) {
5876
+ segments = [
5877
+ overlay.content
5878
+ ];
5879
+ } else {
5880
+ segments = rssUrl ? [
5881
+ "Fetching RSS feed\u2026"
5882
+ ] : [
5883
+ "RSS Ticker"
5884
+ ];
5885
+ }
5886
+ var scrollSpeed = (_ref3 = cfg === null || cfg === void 0 ? void 0 : cfg.scroll_speed) !== null && _ref3 !== void 0 ? _ref3 : 40;
5887
+ var direction = (_ref4 = cfg === null || cfg === void 0 ? void 0 : cfg.direction) !== null && _ref4 !== void 0 ? _ref4 : "left";
5888
+ var fontSize = (_ref5 = cfg === null || cfg === void 0 ? void 0 : cfg.font_size) !== null && _ref5 !== void 0 ? _ref5 : 15;
5752
5889
  var fontFamily = (cfg === null || cfg === void 0 ? void 0 : cfg.font_family) || "Roboto, 'Segoe UI', Arial, sans-serif";
5753
- var fontWeight = (cfg === null || cfg === void 0 ? void 0 : cfg.font_weight) || "600";
5890
+ var fontWeight = (cfg === null || cfg === void 0 ? void 0 : cfg.font_weight) || "700";
5754
5891
  var textColor = (cfg === null || cfg === void 0 ? void 0 : cfg.text_color) || "#ffffff";
5755
- var bgColor = (cfg === null || cfg === void 0 ? void 0 : cfg.background_color) || "transparent";
5756
- var bgOpacity = (cfg === null || cfg === void 0 ? void 0 : cfg.background_opacity) !== void 0 ? cfg.background_opacity / 100 : 0;
5757
- var borderColor = (cfg === null || cfg === void 0 ? void 0 : cfg.border_color) || "transparent";
5758
- var borderWidth = (_ref2 = cfg === null || cfg === void 0 ? void 0 : cfg.border_width) !== null && _ref2 !== void 0 ? _ref2 : 0;
5759
- var borderRadius = (_ref3 = cfg === null || cfg === void 0 ? void 0 : cfg.border_radius) !== null && _ref3 !== void 0 ? _ref3 : 0;
5760
- var padding = (_ref4 = cfg === null || cfg === void 0 ? void 0 : cfg.padding) !== null && _ref4 !== void 0 ? _ref4 : 4;
5761
- var isVertical = direction === "up" || direction === "down";
5892
+ var bgColor = (cfg === null || cfg === void 0 ? void 0 : cfg.background_color) || "#0d0d1a";
5893
+ var bgOpacity = (cfg === null || cfg === void 0 ? void 0 : cfg.background_opacity) !== void 0 ? cfg.background_opacity / 100 : 0.95;
5894
+ var borderRadius = (_ref6 = cfg === null || cfg === void 0 ? void 0 : cfg.border_radius) !== null && _ref6 !== void 0 ? _ref6 : 0;
5895
+ var itemSpacing = (_ref7 = cfg === null || cfg === void 0 ? void 0 : cfg.item_spacing) !== null && _ref7 !== void 0 ? _ref7 : 60;
5896
+ var label = (_ref8 = cfg === null || cfg === void 0 ? void 0 : cfg.label) !== null && _ref8 !== void 0 ? _ref8 : "NEWS";
5897
+ var labelLine2 = (_ref9 = cfg === null || cfg === void 0 ? void 0 : cfg.label_line2) !== null && _ref9 !== void 0 ? _ref9 : "";
5898
+ var labelColor = (_ref10 = cfg === null || cfg === void 0 ? void 0 : cfg.label_color) !== null && _ref10 !== void 0 ? _ref10 : "#f97316";
5899
+ var labelTextColor = (_ref11 = cfg === null || cfg === void 0 ? void 0 : cfg.label_text_color) !== null && _ref11 !== void 0 ? _ref11 : "#ffffff";
5900
+ var accentColor = (_ref12 = cfg === null || cfg === void 0 ? void 0 : cfg.accent_color) !== null && _ref12 !== void 0 ? _ref12 : labelColor;
5901
+ var showAccentLine = (cfg === null || cfg === void 0 ? void 0 : cfg.show_accent_line) !== false;
5902
+ var isHorizontal = direction === "left" || direction === "right";
5762
5903
  var isReverse = direction === "right" || direction === "down";
5763
- var durationSec = Math.max(3, 120 - scrollSpeed);
5764
- var animId = "sc-scroller-".concat(overlay.id);
5765
- var keyframes = isVertical ? "@keyframes ".concat(animId, " {\n 0% { transform: translateY(").concat(isReverse ? "-100%" : "100%", "); }\n 100% { transform: translateY(").concat(isReverse ? "100%" : "-100%", "); }\n }") : "@keyframes ".concat(animId, " {\n 0% { transform: translateX(").concat(isReverse ? "-100%" : "100%", "); }\n 100% { transform: translateX(").concat(isReverse ? "100%" : "-100%", "); }\n }");
5904
+ var fullText = segments.join(" ".concat(sep, " "));
5905
+ var durationSec = Math.max(6, fullText.length * 9 / scrollSpeed);
5906
+ var animId = "sc-ticker-".concat(overlay.id, "-").concat(uid);
5907
+ var keyframes = isHorizontal ? "@keyframes ".concat(animId, " {\n ").concat(isReverse ? "0% { transform: translateX(-50%); } 100% { transform: translateX(0%); }" : "0% { transform: translateX(0); } 100% { transform: translateX(-50%); }", "\n }") : "@keyframes ".concat(animId, " {\n ").concat(isReverse ? "0% { transform: translateY(-50%); } 100% { transform: translateY(0%); }" : "0% { transform: translateY(0); } 100% { transform: translateY(-50%); }", "\n }");
5766
5908
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
5767
5909
  children: [
5768
5910
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", {
5769
5911
  children: keyframes
5770
5912
  }),
5771
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5913
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
5772
5914
  style: {
5773
5915
  width: "100%",
5774
5916
  height: "100%",
5775
- overflow: "hidden",
5776
5917
  display: "flex",
5777
- alignItems: "center",
5778
- backgroundColor: bgOpacity > 0 ? "rgba(".concat(hexToRgb(bgColor), ", ").concat(bgOpacity, ")") : void 0,
5779
- border: borderWidth > 0 ? "".concat(borderWidth, "px solid ").concat(borderColor) : void 0,
5918
+ flexDirection: "column",
5919
+ overflow: "hidden",
5780
5920
  borderRadius: borderRadius > 0 ? "".concat(borderRadius, "px") : void 0,
5781
- padding: "".concat(padding, "px"),
5782
- boxSizing: "border-box",
5783
- pointerEvents: "none"
5921
+ backgroundColor: "rgba(".concat(hexToRgb(bgColor), ", ").concat(bgOpacity, ")"),
5922
+ fontFamily: fontFamily,
5923
+ fontSize: "".concat(fontSize, "px"),
5924
+ fontWeight: fontWeight,
5925
+ color: textColor,
5926
+ pointerEvents: "none",
5927
+ userSelect: "none"
5784
5928
  },
5785
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5786
- style: {
5787
- whiteSpace: "nowrap",
5788
- fontSize: fontSize,
5789
- fontFamily: fontFamily,
5790
- fontWeight: fontWeight,
5791
- color: textColor,
5792
- animation: "".concat(animId, " ").concat(durationSec, "s linear infinite"),
5793
- textShadow: "0 1px 4px rgba(0,0,0,0.5)",
5794
- userSelect: "none"
5795
- },
5796
- children: text
5797
- })
5929
+ children: [
5930
+ showAccentLine && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5931
+ style: {
5932
+ height: 3,
5933
+ background: accentColor,
5934
+ flexShrink: 0,
5935
+ width: "100%"
5936
+ }
5937
+ }),
5938
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
5939
+ style: {
5940
+ display: "flex",
5941
+ flex: 1,
5942
+ overflow: "hidden",
5943
+ minHeight: 0
5944
+ },
5945
+ children: [
5946
+ label && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
5947
+ style: {
5948
+ background: labelColor,
5949
+ color: labelTextColor,
5950
+ padding: "0 14px",
5951
+ display: "flex",
5952
+ flexDirection: "column",
5953
+ alignItems: "center",
5954
+ justifyContent: "center",
5955
+ flexShrink: 0,
5956
+ minWidth: 72,
5957
+ textAlign: "center",
5958
+ gap: 1
5959
+ },
5960
+ children: [
5961
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
5962
+ style: {
5963
+ fontWeight: 800,
5964
+ fontSize: "0.82em",
5965
+ letterSpacing: "0.05em",
5966
+ lineHeight: 1.1,
5967
+ textTransform: "uppercase",
5968
+ whiteSpace: "nowrap"
5969
+ },
5970
+ children: label
5971
+ }),
5972
+ labelLine2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
5973
+ style: {
5974
+ fontWeight: 500,
5975
+ fontSize: "0.62em",
5976
+ letterSpacing: "0.03em",
5977
+ lineHeight: 1.1,
5978
+ opacity: 0.85,
5979
+ whiteSpace: "nowrap"
5980
+ },
5981
+ children: labelLine2
5982
+ })
5983
+ ]
5984
+ }),
5985
+ label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5986
+ style: {
5987
+ width: 3,
5988
+ background: accentColor,
5989
+ flexShrink: 0
5990
+ }
5991
+ }),
5992
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5993
+ style: {
5994
+ flex: 1,
5995
+ overflow: "hidden",
5996
+ position: "relative",
5997
+ display: "flex",
5998
+ alignItems: "center"
5999
+ },
6000
+ children: isHorizontal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6001
+ style: {
6002
+ display: "inline-flex",
6003
+ whiteSpace: "nowrap",
6004
+ animation: "".concat(animId, " ").concat(durationSec, "s linear infinite"),
6005
+ willChange: "transform"
6006
+ },
6007
+ children: [
6008
+ 0,
6009
+ 1
6010
+ ].map(function(copy) {
6011
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6012
+ style: {
6013
+ paddingRight: "".concat(itemSpacing, "px")
6014
+ },
6015
+ children: segments.map(function(seg, i) {
6016
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.default.Fragment, {
6017
+ children: [
6018
+ i > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6019
+ style: {
6020
+ opacity: 0.5,
6021
+ margin: "0 8px"
6022
+ },
6023
+ children: sep
6024
+ }),
6025
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6026
+ style: {
6027
+ textShadow: "0 1px 3px rgba(0,0,0,0.6)"
6028
+ },
6029
+ children: seg
6030
+ })
6031
+ ]
6032
+ }, i);
6033
+ })
6034
+ }, copy);
6035
+ })
6036
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6037
+ style: {
6038
+ display: "flex",
6039
+ flexDirection: "column",
6040
+ whiteSpace: "nowrap",
6041
+ animation: "".concat(animId, " ").concat(durationSec, "s linear infinite"),
6042
+ willChange: "transform"
6043
+ },
6044
+ children: [
6045
+ 0,
6046
+ 1
6047
+ ].map(function(copy) {
6048
+ return segments.map(function(seg, i) {
6049
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6050
+ style: {
6051
+ paddingBottom: "".concat(itemSpacing / 4, "px")
6052
+ },
6053
+ children: seg
6054
+ }, "".concat(copy, "-").concat(i));
6055
+ });
6056
+ })
6057
+ })
6058
+ })
6059
+ ]
6060
+ })
6061
+ ]
5798
6062
  })
5799
6063
  ]
5800
6064
  });
@@ -7009,12 +7273,13 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
7009
7273
  var _import_react2_default_useState21 = _sliced_to_array(import_react2.default.useState(false), 2), showDebugPanel = _import_react2_default_useState21[0], setShowDebugPanel = _import_react2_default_useState21[1];
7010
7274
  var _import_react2_default_useState22 = _sliced_to_array(import_react2.default.useState([]), 2), debugMarkers = _import_react2_default_useState22[0], setDebugMarkers = _import_react2_default_useState22[1];
7011
7275
  var _import_react2_default_useState23 = _sliced_to_array(import_react2.default.useState(false), 2), showAiPanel = _import_react2_default_useState23[0], setShowAiPanel = _import_react2_default_useState23[1];
7012
- var _import_react2_default_useState24 = _sliced_to_array(import_react2.default.useState({
7276
+ var _import_react2_default_useState24 = _sliced_to_array(import_react2.default.useState(disableAds !== null && disableAds !== void 0 ? disableAds : false), 2), adsDisabled = _import_react2_default_useState24[0], setAdsDisabled = _import_react2_default_useState24[1];
7277
+ var _import_react2_default_useState25 = _sliced_to_array(import_react2.default.useState({
7013
7278
  context: null,
7014
7279
  isLoading: false,
7015
7280
  error: null,
7016
7281
  lastPolledAt: null
7017
- }), 2), aiLiveContext = _import_react2_default_useState24[0], setAiLiveContext = _import_react2_default_useState24[1];
7282
+ }), 2), aiLiveContext = _import_react2_default_useState25[0], setAiLiveContext = _import_react2_default_useState25[1];
7018
7283
  var getResponsiveScale = function getResponsiveScale() {
7019
7284
  if (viewportWidth < 480) return 0.7;
7020
7285
  if (viewportWidth < 768) return 0.8;
@@ -8501,6 +8766,31 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8501
8766
  gap: "".concat(8 * responsiveScale, "px")
8502
8767
  },
8503
8768
  children: [
8769
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", {
8770
+ className: "sc-ctrl-btn",
8771
+ onClick: function onClick() {
8772
+ var _playerRef_current;
8773
+ var next = !adsDisabled;
8774
+ setAdsDisabled(next);
8775
+ (_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.setDisableAds(next);
8776
+ resetControlsTimer();
8777
+ },
8778
+ style: {
8779
+ padding: "".concat(8 * responsiveScale, "px"),
8780
+ borderRadius: "50%",
8781
+ minWidth: "".concat(36 * responsiveScale, "px"),
8782
+ minHeight: "".concat(36 * responsiveScale, "px"),
8783
+ background: adsDisabled ? "rgba(239, 68, 68, 0.28)" : "transparent",
8784
+ fontFamily: "'SF Mono', 'Cascadia Code', monospace",
8785
+ fontSize: "".concat(12 * responsiveScale, "px"),
8786
+ fontWeight: 700,
8787
+ letterSpacing: "0.03em",
8788
+ color: adsDisabled ? "rgba(252, 165, 165, 0.9)" : "rgba(255, 255, 255, 0.75)",
8789
+ textDecoration: adsDisabled ? "line-through" : "none"
8790
+ },
8791
+ title: adsDisabled ? "Enable ads" : "Disable ads",
8792
+ children: "AD"
8793
+ }),
8504
8794
  swirlProjectId && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", {
8505
8795
  className: "sc-ctrl-btn",
8506
8796
  onClick: function onClick() {
@@ -8794,6 +9084,31 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8794
9084
  })
8795
9085
  ]
8796
9086
  }),
9087
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", {
9088
+ className: "sc-ctrl-btn",
9089
+ onClick: function onClick() {
9090
+ var _playerRef_current;
9091
+ var next = !adsDisabled;
9092
+ setAdsDisabled(next);
9093
+ (_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.setDisableAds(next);
9094
+ resetControlsTimer();
9095
+ },
9096
+ style: {
9097
+ padding: "".concat(8 * responsiveScale, "px"),
9098
+ borderRadius: "50%",
9099
+ minWidth: "".concat(36 * responsiveScale, "px"),
9100
+ minHeight: "".concat(36 * responsiveScale, "px"),
9101
+ background: adsDisabled ? "rgba(239, 68, 68, 0.28)" : "rgba(0, 0, 0, 0.6)",
9102
+ fontFamily: "'SF Mono', 'Cascadia Code', monospace",
9103
+ fontSize: "".concat(12 * responsiveScale, "px"),
9104
+ fontWeight: 700,
9105
+ letterSpacing: "0.03em",
9106
+ color: adsDisabled ? "rgba(252, 165, 165, 0.9)" : "rgba(255, 255, 255, 0.75)",
9107
+ textDecoration: adsDisabled ? "line-through" : "none"
9108
+ },
9109
+ title: adsDisabled ? "Enable ads" : "Disable ads",
9110
+ children: "AD"
9111
+ }),
8797
9112
  swirlProjectId && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", {
8798
9113
  className: "sc-ctrl-btn",
8799
9114
  onClick: function onClick() {