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.
package/lib/index.cjs CHANGED
@@ -2931,6 +2931,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2931
2931
  this.maxTotalAdRequestsPerBreak = 20;
2932
2932
  this.pendingAdBreak = null;
2933
2933
  this.savedMutedStateBeforeAd = null;
2934
+ this.adLayerInitialized = false;
2934
2935
  this.consecutiveFailures = 0;
2935
2936
  this.maxConsecutiveFailures = 5;
2936
2937
  this.lastAdRequestTime = 0;
@@ -3579,12 +3580,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3579
3580
  this.video.autoplay = !!this.config.autoplay;
3580
3581
  this.video.muted = !!this.config.muted;
3581
3582
  if (!this.config.disableAds) {
3582
- this.adLayer.initialize();
3583
- if (!this.config.disableFiller) {
3584
- this.ensureFillerVideo();
3585
- }
3586
- this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
3587
- this.attachAdLayerEventListeners();
3583
+ this.initializeAdLayer();
3588
3584
  }
3589
3585
  this.timeUpdateHandler = function() {
3590
3586
  _this.onTimeUpdate(_this.video.currentTime);
@@ -3685,6 +3681,31 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3685
3681
  return this.showAds;
3686
3682
  }
3687
3683
  },
3684
+ {
3685
+ key: "initializeAdLayer",
3686
+ value: function initializeAdLayer() {
3687
+ if (this.adLayerInitialized) return;
3688
+ this.adLayer.initialize();
3689
+ if (!this.config.disableFiller) {
3690
+ this.ensureFillerVideo();
3691
+ }
3692
+ this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
3693
+ this.attachAdLayerEventListeners();
3694
+ this.adLayerInitialized = true;
3695
+ }
3696
+ },
3697
+ {
3698
+ key: "setDisableAds",
3699
+ value: function setDisableAds(disabled) {
3700
+ this.config.disableAds = disabled;
3701
+ if (!disabled && this.attached) {
3702
+ this.initializeAdLayer();
3703
+ }
3704
+ if (this.config.debugAdTiming) {
3705
+ console.log("[StormcloudVideoPlayer] setDisableAds:", disabled);
3706
+ }
3707
+ }
3708
+ },
3688
3709
  {
3689
3710
  key: "syncMainContentAudioWhenVisible",
3690
3711
  value: function syncMainContentAudioWhenVisible() {
@@ -5919,60 +5940,303 @@ function TextOverlay(param) {
5919
5940
  children: text
5920
5941
  });
5921
5942
  }
5943
+ function fetchRSSItems(rssUrl, maxItems) {
5944
+ return _async_to_generator(function() {
5945
+ var resp, data, parser, doc;
5946
+ return _ts_generator(this, function(_state) {
5947
+ switch(_state.label){
5948
+ case 0:
5949
+ return [
5950
+ 4,
5951
+ fetch("https://api.allorigins.win/get?url=".concat(encodeURIComponent(rssUrl)))
5952
+ ];
5953
+ case 1:
5954
+ resp = _state.sent();
5955
+ return [
5956
+ 4,
5957
+ resp.json()
5958
+ ];
5959
+ case 2:
5960
+ data = _state.sent();
5961
+ if (!data.contents) throw new Error("No content from RSS feed");
5962
+ parser = new DOMParser();
5963
+ doc = parser.parseFromString(data.contents, "text/xml");
5964
+ if (doc.querySelector("parsererror")) throw new Error("Invalid RSS XML");
5965
+ return [
5966
+ 2,
5967
+ Array.from(doc.querySelectorAll("item")).map(function(item) {
5968
+ var _item_querySelector, _item_querySelector1, _item_querySelector2, _item_querySelector3, _item_querySelector4;
5969
+ return {
5970
+ title: (((_item_querySelector = item.querySelector("title")) === null || _item_querySelector === void 0 ? void 0 : _item_querySelector.textContent) || "").replace(/<[^>]*>/g, "").trim(),
5971
+ description: (((_item_querySelector1 = item.querySelector("description")) === null || _item_querySelector1 === void 0 ? void 0 : _item_querySelector1.textContent) || "").replace(/<[^>]*>/g, "").trim(),
5972
+ pubDate: ((_item_querySelector2 = item.querySelector("pubDate")) === null || _item_querySelector2 === void 0 ? void 0 : _item_querySelector2.textContent) || "",
5973
+ author: ((_item_querySelector3 = item.querySelector("author, dc\\:creator")) === null || _item_querySelector3 === void 0 ? void 0 : _item_querySelector3.textContent) || "",
5974
+ category: ((_item_querySelector4 = item.querySelector("category")) === null || _item_querySelector4 === void 0 ? void 0 : _item_querySelector4.textContent) || ""
5975
+ };
5976
+ }).filter(function(i) {
5977
+ return i.title;
5978
+ }).slice(0, maxItems)
5979
+ ];
5980
+ }
5981
+ });
5982
+ })();
5983
+ }
5922
5984
  function ScrollerOverlay(param) {
5923
5985
  var overlay = param.overlay;
5924
- var _ref, _ref1, _ref2, _ref3, _ref4;
5986
+ var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12;
5925
5987
  var cfg = overlay.scroller_config;
5926
- 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) || "";
5927
- var scrollSpeed = (_ref = cfg === null || cfg === void 0 ? void 0 : cfg.scroll_speed) !== null && _ref !== void 0 ? _ref : 50;
5928
- var direction = (_ref1 = cfg === null || cfg === void 0 ? void 0 : cfg.direction) !== null && _ref1 !== void 0 ? _ref1 : "left";
5929
- var fontSize = (cfg === null || cfg === void 0 ? void 0 : cfg.font_size) ? "".concat(cfg.font_size, "px") : "clamp(10px, 1.2vw, 18px)";
5988
+ var uid = (0, import_react.useId)().replace(/:/g, "");
5989
+ var _ref13 = _sliced_to_array((0, import_react.useState)([]), 2), rssItems = _ref13[0], setRssItems = _ref13[1];
5990
+ var _ref14 = _sliced_to_array((0, import_react.useState)(false), 2), rssLoading = _ref14[0], setRssLoading = _ref14[1];
5991
+ var rssUrl = (cfg === null || cfg === void 0 ? void 0 : cfg.rss_url) || "";
5992
+ var maxItems = (_ref = cfg === null || cfg === void 0 ? void 0 : cfg.max_items) !== null && _ref !== void 0 ? _ref : 10;
5993
+ var autoRefresh = (cfg === null || cfg === void 0 ? void 0 : cfg.auto_refresh) !== false;
5994
+ var updateInterval = (_ref1 = cfg === null || cfg === void 0 ? void 0 : cfg.update_interval) !== null && _ref1 !== void 0 ? _ref1 : 5;
5995
+ (0, import_react.useEffect)(function() {
5996
+ if (!rssUrl || (cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text) && (cfg === null || cfg === void 0 ? void 0 : cfg.custom_text)) return;
5997
+ var cancelled = false;
5998
+ setRssLoading(true);
5999
+ fetchRSSItems(rssUrl, maxItems).then(function(items) {
6000
+ if (!cancelled) setRssItems(items);
6001
+ }).catch(function() {}).finally(function() {
6002
+ if (!cancelled) setRssLoading(false);
6003
+ });
6004
+ return function() {
6005
+ cancelled = true;
6006
+ };
6007
+ }, [
6008
+ rssUrl,
6009
+ maxItems,
6010
+ cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text,
6011
+ cfg === null || cfg === void 0 ? void 0 : cfg.custom_text
6012
+ ]);
6013
+ (0, import_react.useEffect)(function() {
6014
+ 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;
6015
+ var interval = setInterval(function() {
6016
+ fetchRSSItems(rssUrl, maxItems).then(setRssItems).catch(function() {});
6017
+ }, updateInterval * 60 * 1e3);
6018
+ return function() {
6019
+ return clearInterval(interval);
6020
+ };
6021
+ }, [
6022
+ rssUrl,
6023
+ autoRefresh,
6024
+ updateInterval,
6025
+ maxItems,
6026
+ cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text,
6027
+ cfg === null || cfg === void 0 ? void 0 : cfg.custom_text
6028
+ ]);
6029
+ var sep = (_ref2 = cfg === null || cfg === void 0 ? void 0 : cfg.separator_char) !== null && _ref2 !== void 0 ? _ref2 : "\u25C6";
6030
+ var segments;
6031
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text) && (cfg === null || cfg === void 0 ? void 0 : cfg.custom_text)) {
6032
+ segments = [
6033
+ cfg.custom_text
6034
+ ];
6035
+ } else if (rssItems.length > 0) {
6036
+ segments = rssItems.map(function(item) {
6037
+ var parts = [];
6038
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.show_title) !== false && item.title) parts.push(item.title);
6039
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.show_description) && item.description) parts.push(item.description);
6040
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.show_timestamp) && item.pubDate) {
6041
+ try {
6042
+ parts.push(new Date(item.pubDate).toLocaleDateString());
6043
+ } catch (unused) {}
6044
+ }
6045
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.show_author) && item.author) parts.push("— ".concat(item.author));
6046
+ if ((cfg === null || cfg === void 0 ? void 0 : cfg.show_category) && item.category) parts.push("[".concat(item.category, "]"));
6047
+ return parts.join(" ");
6048
+ });
6049
+ } else if (rssLoading) {
6050
+ segments = [
6051
+ "Loading feed\u2026"
6052
+ ];
6053
+ } else if (overlay.content) {
6054
+ segments = [
6055
+ overlay.content
6056
+ ];
6057
+ } else {
6058
+ segments = rssUrl ? [
6059
+ "Fetching RSS feed\u2026"
6060
+ ] : [
6061
+ "RSS Ticker"
6062
+ ];
6063
+ }
6064
+ var scrollSpeed = (_ref3 = cfg === null || cfg === void 0 ? void 0 : cfg.scroll_speed) !== null && _ref3 !== void 0 ? _ref3 : 40;
6065
+ var direction = (_ref4 = cfg === null || cfg === void 0 ? void 0 : cfg.direction) !== null && _ref4 !== void 0 ? _ref4 : "left";
6066
+ var fontSize = (_ref5 = cfg === null || cfg === void 0 ? void 0 : cfg.font_size) !== null && _ref5 !== void 0 ? _ref5 : 15;
5930
6067
  var fontFamily = (cfg === null || cfg === void 0 ? void 0 : cfg.font_family) || "Roboto, 'Segoe UI', Arial, sans-serif";
5931
- var fontWeight = (cfg === null || cfg === void 0 ? void 0 : cfg.font_weight) || "600";
6068
+ var fontWeight = (cfg === null || cfg === void 0 ? void 0 : cfg.font_weight) || "700";
5932
6069
  var textColor = (cfg === null || cfg === void 0 ? void 0 : cfg.text_color) || "#ffffff";
5933
- var bgColor = (cfg === null || cfg === void 0 ? void 0 : cfg.background_color) || "transparent";
5934
- var bgOpacity = (cfg === null || cfg === void 0 ? void 0 : cfg.background_opacity) !== void 0 ? cfg.background_opacity / 100 : 0;
5935
- var borderColor = (cfg === null || cfg === void 0 ? void 0 : cfg.border_color) || "transparent";
5936
- var borderWidth = (_ref2 = cfg === null || cfg === void 0 ? void 0 : cfg.border_width) !== null && _ref2 !== void 0 ? _ref2 : 0;
5937
- var borderRadius = (_ref3 = cfg === null || cfg === void 0 ? void 0 : cfg.border_radius) !== null && _ref3 !== void 0 ? _ref3 : 0;
5938
- var padding = (_ref4 = cfg === null || cfg === void 0 ? void 0 : cfg.padding) !== null && _ref4 !== void 0 ? _ref4 : 4;
5939
- var isVertical = direction === "up" || direction === "down";
6070
+ var bgColor = (cfg === null || cfg === void 0 ? void 0 : cfg.background_color) || "#0d0d1a";
6071
+ var bgOpacity = (cfg === null || cfg === void 0 ? void 0 : cfg.background_opacity) !== void 0 ? cfg.background_opacity / 100 : 0.95;
6072
+ var borderRadius = (_ref6 = cfg === null || cfg === void 0 ? void 0 : cfg.border_radius) !== null && _ref6 !== void 0 ? _ref6 : 0;
6073
+ var itemSpacing = (_ref7 = cfg === null || cfg === void 0 ? void 0 : cfg.item_spacing) !== null && _ref7 !== void 0 ? _ref7 : 60;
6074
+ var label = (_ref8 = cfg === null || cfg === void 0 ? void 0 : cfg.label) !== null && _ref8 !== void 0 ? _ref8 : "NEWS";
6075
+ var labelLine2 = (_ref9 = cfg === null || cfg === void 0 ? void 0 : cfg.label_line2) !== null && _ref9 !== void 0 ? _ref9 : "";
6076
+ var labelColor = (_ref10 = cfg === null || cfg === void 0 ? void 0 : cfg.label_color) !== null && _ref10 !== void 0 ? _ref10 : "#f97316";
6077
+ var labelTextColor = (_ref11 = cfg === null || cfg === void 0 ? void 0 : cfg.label_text_color) !== null && _ref11 !== void 0 ? _ref11 : "#ffffff";
6078
+ var accentColor = (_ref12 = cfg === null || cfg === void 0 ? void 0 : cfg.accent_color) !== null && _ref12 !== void 0 ? _ref12 : labelColor;
6079
+ var showAccentLine = (cfg === null || cfg === void 0 ? void 0 : cfg.show_accent_line) !== false;
6080
+ var isHorizontal = direction === "left" || direction === "right";
5940
6081
  var isReverse = direction === "right" || direction === "down";
5941
- var durationSec = Math.max(3, 120 - scrollSpeed);
5942
- var animId = "sc-scroller-".concat(overlay.id);
5943
- 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 }");
6082
+ var fullText = segments.join(" ".concat(sep, " "));
6083
+ var durationSec = Math.max(6, fullText.length * 9 / scrollSpeed);
6084
+ var animId = "sc-ticker-".concat(overlay.id, "-").concat(uid);
6085
+ 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 }");
5944
6086
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
5945
6087
  children: [
5946
6088
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", {
5947
6089
  children: keyframes
5948
6090
  }),
5949
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6091
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
5950
6092
  style: {
5951
6093
  width: "100%",
5952
6094
  height: "100%",
5953
- overflow: "hidden",
5954
6095
  display: "flex",
5955
- alignItems: "center",
5956
- backgroundColor: bgOpacity > 0 ? "rgba(".concat(hexToRgb(bgColor), ", ").concat(bgOpacity, ")") : void 0,
5957
- border: borderWidth > 0 ? "".concat(borderWidth, "px solid ").concat(borderColor) : void 0,
6096
+ flexDirection: "column",
6097
+ overflow: "hidden",
5958
6098
  borderRadius: borderRadius > 0 ? "".concat(borderRadius, "px") : void 0,
5959
- padding: "".concat(padding, "px"),
5960
- boxSizing: "border-box",
5961
- pointerEvents: "none"
6099
+ backgroundColor: "rgba(".concat(hexToRgb(bgColor), ", ").concat(bgOpacity, ")"),
6100
+ fontFamily: fontFamily,
6101
+ fontSize: "".concat(fontSize, "px"),
6102
+ fontWeight: fontWeight,
6103
+ color: textColor,
6104
+ pointerEvents: "none",
6105
+ userSelect: "none"
5962
6106
  },
5963
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5964
- style: {
5965
- whiteSpace: "nowrap",
5966
- fontSize: fontSize,
5967
- fontFamily: fontFamily,
5968
- fontWeight: fontWeight,
5969
- color: textColor,
5970
- animation: "".concat(animId, " ").concat(durationSec, "s linear infinite"),
5971
- textShadow: "0 1px 4px rgba(0,0,0,0.5)",
5972
- userSelect: "none"
5973
- },
5974
- children: text
5975
- })
6107
+ children: [
6108
+ showAccentLine && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6109
+ style: {
6110
+ height: 3,
6111
+ background: accentColor,
6112
+ flexShrink: 0,
6113
+ width: "100%"
6114
+ }
6115
+ }),
6116
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6117
+ style: {
6118
+ display: "flex",
6119
+ flex: 1,
6120
+ overflow: "hidden",
6121
+ minHeight: 0
6122
+ },
6123
+ children: [
6124
+ label && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6125
+ style: {
6126
+ background: labelColor,
6127
+ color: labelTextColor,
6128
+ padding: "0 14px",
6129
+ display: "flex",
6130
+ flexDirection: "column",
6131
+ alignItems: "center",
6132
+ justifyContent: "center",
6133
+ flexShrink: 0,
6134
+ minWidth: 72,
6135
+ textAlign: "center",
6136
+ gap: 1
6137
+ },
6138
+ children: [
6139
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6140
+ style: {
6141
+ fontWeight: 800,
6142
+ fontSize: "0.82em",
6143
+ letterSpacing: "0.05em",
6144
+ lineHeight: 1.1,
6145
+ textTransform: "uppercase",
6146
+ whiteSpace: "nowrap"
6147
+ },
6148
+ children: label
6149
+ }),
6150
+ labelLine2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6151
+ style: {
6152
+ fontWeight: 500,
6153
+ fontSize: "0.62em",
6154
+ letterSpacing: "0.03em",
6155
+ lineHeight: 1.1,
6156
+ opacity: 0.85,
6157
+ whiteSpace: "nowrap"
6158
+ },
6159
+ children: labelLine2
6160
+ })
6161
+ ]
6162
+ }),
6163
+ label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6164
+ style: {
6165
+ width: 3,
6166
+ background: accentColor,
6167
+ flexShrink: 0
6168
+ }
6169
+ }),
6170
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6171
+ style: {
6172
+ flex: 1,
6173
+ overflow: "hidden",
6174
+ position: "relative",
6175
+ display: "flex",
6176
+ alignItems: "center"
6177
+ },
6178
+ children: isHorizontal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6179
+ style: {
6180
+ display: "inline-flex",
6181
+ whiteSpace: "nowrap",
6182
+ animation: "".concat(animId, " ").concat(durationSec, "s linear infinite"),
6183
+ willChange: "transform"
6184
+ },
6185
+ children: [
6186
+ 0,
6187
+ 1
6188
+ ].map(function(copy) {
6189
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6190
+ style: {
6191
+ paddingRight: "".concat(itemSpacing, "px")
6192
+ },
6193
+ children: segments.map(function(seg, i) {
6194
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.default.Fragment, {
6195
+ children: [
6196
+ i > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6197
+ style: {
6198
+ opacity: 0.5,
6199
+ margin: "0 8px"
6200
+ },
6201
+ children: sep
6202
+ }),
6203
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6204
+ style: {
6205
+ textShadow: "0 1px 3px rgba(0,0,0,0.6)"
6206
+ },
6207
+ children: seg
6208
+ })
6209
+ ]
6210
+ }, i);
6211
+ })
6212
+ }, copy);
6213
+ })
6214
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6215
+ style: {
6216
+ display: "flex",
6217
+ flexDirection: "column",
6218
+ whiteSpace: "nowrap",
6219
+ animation: "".concat(animId, " ").concat(durationSec, "s linear infinite"),
6220
+ willChange: "transform"
6221
+ },
6222
+ children: [
6223
+ 0,
6224
+ 1
6225
+ ].map(function(copy) {
6226
+ return segments.map(function(seg, i) {
6227
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6228
+ style: {
6229
+ paddingBottom: "".concat(itemSpacing / 4, "px")
6230
+ },
6231
+ children: seg
6232
+ }, "".concat(copy, "-").concat(i));
6233
+ });
6234
+ })
6235
+ })
6236
+ })
6237
+ ]
6238
+ })
6239
+ ]
5976
6240
  })
5977
6241
  ]
5978
6242
  });
@@ -7187,12 +7451,13 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
7187
7451
  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];
7188
7452
  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];
7189
7453
  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];
7190
- var _import_react2_default_useState24 = _sliced_to_array(import_react2.default.useState({
7454
+ 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];
7455
+ var _import_react2_default_useState25 = _sliced_to_array(import_react2.default.useState({
7191
7456
  context: null,
7192
7457
  isLoading: false,
7193
7458
  error: null,
7194
7459
  lastPolledAt: null
7195
- }), 2), aiLiveContext = _import_react2_default_useState24[0], setAiLiveContext = _import_react2_default_useState24[1];
7460
+ }), 2), aiLiveContext = _import_react2_default_useState25[0], setAiLiveContext = _import_react2_default_useState25[1];
7196
7461
  var getResponsiveScale = function getResponsiveScale() {
7197
7462
  if (viewportWidth < 480) return 0.7;
7198
7463
  if (viewportWidth < 768) return 0.8;
@@ -8679,6 +8944,31 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8679
8944
  gap: "".concat(8 * responsiveScale, "px")
8680
8945
  },
8681
8946
  children: [
8947
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", {
8948
+ className: "sc-ctrl-btn",
8949
+ onClick: function onClick() {
8950
+ var _playerRef_current;
8951
+ var next = !adsDisabled;
8952
+ setAdsDisabled(next);
8953
+ (_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.setDisableAds(next);
8954
+ resetControlsTimer();
8955
+ },
8956
+ style: {
8957
+ padding: "".concat(8 * responsiveScale, "px"),
8958
+ borderRadius: "50%",
8959
+ minWidth: "".concat(36 * responsiveScale, "px"),
8960
+ minHeight: "".concat(36 * responsiveScale, "px"),
8961
+ background: adsDisabled ? "rgba(239, 68, 68, 0.28)" : "transparent",
8962
+ fontFamily: "'SF Mono', 'Cascadia Code', monospace",
8963
+ fontSize: "".concat(12 * responsiveScale, "px"),
8964
+ fontWeight: 700,
8965
+ letterSpacing: "0.03em",
8966
+ color: adsDisabled ? "rgba(252, 165, 165, 0.9)" : "rgba(255, 255, 255, 0.75)",
8967
+ textDecoration: adsDisabled ? "line-through" : "none"
8968
+ },
8969
+ title: adsDisabled ? "Enable ads" : "Disable ads",
8970
+ children: "AD"
8971
+ }),
8682
8972
  swirlProjectId && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", {
8683
8973
  className: "sc-ctrl-btn",
8684
8974
  onClick: function onClick() {
@@ -8972,6 +9262,31 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8972
9262
  })
8973
9263
  ]
8974
9264
  }),
9265
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", {
9266
+ className: "sc-ctrl-btn",
9267
+ onClick: function onClick() {
9268
+ var _playerRef_current;
9269
+ var next = !adsDisabled;
9270
+ setAdsDisabled(next);
9271
+ (_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.setDisableAds(next);
9272
+ resetControlsTimer();
9273
+ },
9274
+ style: {
9275
+ padding: "".concat(8 * responsiveScale, "px"),
9276
+ borderRadius: "50%",
9277
+ minWidth: "".concat(36 * responsiveScale, "px"),
9278
+ minHeight: "".concat(36 * responsiveScale, "px"),
9279
+ background: adsDisabled ? "rgba(239, 68, 68, 0.28)" : "rgba(0, 0, 0, 0.6)",
9280
+ fontFamily: "'SF Mono', 'Cascadia Code', monospace",
9281
+ fontSize: "".concat(12 * responsiveScale, "px"),
9282
+ fontWeight: 700,
9283
+ letterSpacing: "0.03em",
9284
+ color: adsDisabled ? "rgba(252, 165, 165, 0.9)" : "rgba(255, 255, 255, 0.75)",
9285
+ textDecoration: adsDisabled ? "line-through" : "none"
9286
+ },
9287
+ title: adsDisabled ? "Enable ads" : "Disable ads",
9288
+ children: "AD"
9289
+ }),
8975
9290
  swirlProjectId && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", {
8976
9291
  className: "sc-ctrl-btn",
8977
9292
  onClick: function onClick() {