stormcloud-video-player 0.7.49 → 0.7.51

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.
@@ -1715,6 +1715,116 @@ function createAdStormPlayer(contentVideo, options) {
1715
1715
  }
1716
1716
  };
1717
1717
  }
1718
+ // src/utils/mqttClient.ts
1719
+ var import_mqtt = __toESM(require("mqtt"), 1);
1720
+ // src/utils/mqttConfig.ts
1721
+ var DEFAULT_MQTT_CONFIG = {
1722
+ enabled: true,
1723
+ brokerAddress: "vecbae77.ala.us-east-1.emqxsl.com",
1724
+ brokerPort: 8883,
1725
+ wsPort: 8084,
1726
+ username: "for-sonifi",
1727
+ password: "sonifi-mqtt",
1728
+ topicPrefix: "adstorm/players",
1729
+ qos: 1
1730
+ };
1731
+ var mqttConfig = _object_spread({}, DEFAULT_MQTT_CONFIG);
1732
+ function applyMQTTConfig(overrides) {
1733
+ Object.assign(mqttConfig, overrides);
1734
+ }
1735
+ function isMQTTEnabled() {
1736
+ return mqttConfig.enabled;
1737
+ }
1738
+ function buildMQTTBrokerUrl() {
1739
+ if (mqttConfig.brokerUrl) return mqttConfig.brokerUrl;
1740
+ return "wss://".concat(mqttConfig.brokerAddress, ":").concat(mqttConfig.wsPort, "/mqtt");
1741
+ }
1742
+ function buildPlayerTopic(licenseKey, channel) {
1743
+ return "".concat(mqttConfig.topicPrefix, "/").concat(licenseKey, "/").concat(channel);
1744
+ }
1745
+ // src/utils/mqttClient.ts
1746
+ var LOG = "[StormcloudVideoPlayer][MQTT]";
1747
+ var client = null;
1748
+ var status = "disconnected";
1749
+ function configureMQTT(overrides) {
1750
+ applyMQTTConfig(overrides);
1751
+ disconnectMQTT();
1752
+ }
1753
+ function initMQTTClient() {
1754
+ if (client || !isMQTTEnabled()) return;
1755
+ var url = buildMQTTBrokerUrl();
1756
+ status = "connecting";
1757
+ var clientId = "stormcloud-vp-".concat(Math.random().toString(36).slice(2, 9));
1758
+ try {
1759
+ client = import_mqtt.default.connect(url, {
1760
+ clientId: clientId,
1761
+ username: mqttConfig.username,
1762
+ password: mqttConfig.password,
1763
+ keepalive: 60,
1764
+ clean: true,
1765
+ reconnectPeriod: 5e3,
1766
+ connectTimeout: 1e4,
1767
+ queueQoSZero: false
1768
+ });
1769
+ } catch (err) {
1770
+ status = "error";
1771
+ console.warn("".concat(LOG, " connect() threw:"), err);
1772
+ return;
1773
+ }
1774
+ client.on("connect", function() {
1775
+ status = "connected";
1776
+ console.info("".concat(LOG, " connected to ").concat(url));
1777
+ });
1778
+ client.on("reconnect", function() {
1779
+ status = "connecting";
1780
+ console.info("".concat(LOG, " reconnecting..."));
1781
+ });
1782
+ client.on("offline", function() {
1783
+ if (status !== "error") {
1784
+ status = "disconnected";
1785
+ }
1786
+ console.warn("".concat(LOG, " offline"));
1787
+ });
1788
+ client.on("error", function(err) {
1789
+ status = "error";
1790
+ console.warn("".concat(LOG, " error:"), err.message);
1791
+ });
1792
+ client.on("close", function() {
1793
+ if (status === "connected" || status === "connecting") {
1794
+ status = "disconnected";
1795
+ }
1796
+ });
1797
+ }
1798
+ function ensureMQTTClient() {
1799
+ if (isMQTTEnabled() && !client) {
1800
+ initMQTTClient();
1801
+ }
1802
+ }
1803
+ function publishMQTT(topic, payload) {
1804
+ if (!isMQTTEnabled()) {
1805
+ return false;
1806
+ }
1807
+ ensureMQTTClient();
1808
+ if (!client) {
1809
+ return false;
1810
+ }
1811
+ try {
1812
+ client.publish(topic, JSON.stringify(payload), {
1813
+ qos: mqttConfig.qos
1814
+ });
1815
+ return true;
1816
+ } catch (err) {
1817
+ console.warn("".concat(LOG, " publish failed on ").concat(topic, ":"), err);
1818
+ return false;
1819
+ }
1820
+ }
1821
+ function disconnectMQTT() {
1822
+ if (client) {
1823
+ client.end(true);
1824
+ client = null;
1825
+ status = "disconnected";
1826
+ }
1827
+ }
1718
1828
  // src/utils/tracking.ts
1719
1829
  var cachedBrowserId = null;
1720
1830
  function getClientInfo() {
@@ -1945,139 +2055,120 @@ function getBrowserID(clientInfo) {
1945
2055
  });
1946
2056
  })();
1947
2057
  }
1948
- var TRACK_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/track";
1949
- function sendTrackRequest(licenseKey, body) {
2058
+ function canPublish(licenseKey) {
2059
+ return Boolean(isMQTTEnabled() && licenseKey);
2060
+ }
2061
+ function buildPlayerMetricEvent() {
1950
2062
  return _async_to_generator(function() {
1951
- var headers, response;
2063
+ var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, playerId, captureAt;
2064
+ var _arguments = arguments;
1952
2065
  return _ts_generator(this, function(_state) {
1953
2066
  switch(_state.label){
1954
2067
  case 0:
1955
- headers = {
1956
- "Content-Type": "application/json"
1957
- };
1958
- if (licenseKey) {
1959
- headers["Authorization"] = "Bearer ".concat(licenseKey);
1960
- }
2068
+ context = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, flags = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
2069
+ clientInfo = getClientInfo();
1961
2070
  return [
1962
2071
  4,
1963
- fetch(TRACK_URL, {
1964
- method: "POST",
1965
- headers: headers,
1966
- body: JSON.stringify(body)
1967
- })
2072
+ getBrowserID(clientInfo)
1968
2073
  ];
1969
2074
  case 1:
1970
- response = _state.sent();
1971
- if (!response.ok) {
1972
- throw new Error("HTTP error! status: ".concat(response.status));
1973
- }
1974
- return [
1975
- 4,
1976
- response.json()
1977
- ];
1978
- case 2:
1979
- _state.sent();
2075
+ playerId = _state.sent();
2076
+ captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
1980
2077
  return [
1981
- 2
2078
+ 2,
2079
+ _object_spread({
2080
+ player_id: playerId,
2081
+ device_type: clientInfo.deviceType,
2082
+ os: clientInfo.os.toLowerCase(),
2083
+ ad_loaded: (_flags_adLoaded = flags.adLoaded) !== null && _flags_adLoaded !== void 0 ? _flags_adLoaded : false,
2084
+ ad_detect: (_flags_adDetect = flags.adDetect) !== null && _flags_adDetect !== void 0 ? _flags_adDetect : false,
2085
+ capture_at: captureAt
2086
+ }, context.inputStreamType ? {
2087
+ input_stream_type: context.inputStreamType
2088
+ } : {})
1982
2089
  ];
1983
2090
  }
1984
2091
  });
1985
- })();
2092
+ }).apply(this, arguments);
1986
2093
  }
1987
- function sendInitialTracking(licenseKey) {
1988
- return _async_to_generator(function() {
1989
- var clientInfo, browserId, trackingData, headers, response, error;
2094
+ function publishTracking(licenseKey, channel, body) {
2095
+ ensureMQTTClient();
2096
+ publishMQTT(buildPlayerTopic(licenseKey, channel), body);
2097
+ }
2098
+ function sendInitialTracking(_0) {
2099
+ return _async_to_generator(function(licenseKey) {
2100
+ var context, metricEvent, error;
2101
+ var _arguments = arguments;
1990
2102
  return _ts_generator(this, function(_state) {
1991
2103
  switch(_state.label){
1992
2104
  case 0:
2105
+ context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
2106
+ if (!canPublish(licenseKey)) return [
2107
+ 2
2108
+ ];
2109
+ _state.label = 1;
2110
+ case 1:
1993
2111
  _state.trys.push([
1994
- 0,
1995
- 4,
2112
+ 1,
2113
+ 3,
1996
2114
  ,
1997
- 5
2115
+ 4
1998
2116
  ]);
1999
- clientInfo = getClientInfo();
2000
2117
  return [
2001
2118
  4,
2002
- getBrowserID(clientInfo)
2003
- ];
2004
- case 1:
2005
- browserId = _state.sent();
2006
- trackingData = _object_spread({
2007
- browserId: browserId
2008
- }, clientInfo);
2009
- headers = {
2010
- "Content-Type": "application/json"
2011
- };
2012
- if (licenseKey) {
2013
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2014
- }
2015
- return [
2016
- 4,
2017
- fetch(TRACK_URL, {
2018
- method: "POST",
2019
- headers: headers,
2020
- body: JSON.stringify(trackingData)
2119
+ buildPlayerMetricEvent(context, {
2120
+ adLoaded: false,
2121
+ adDetect: false
2021
2122
  })
2022
2123
  ];
2023
2124
  case 2:
2024
- response = _state.sent();
2025
- if (!response.ok) {
2026
- throw new Error("HTTP error! status: ".concat(response.status));
2027
- }
2028
- return [
2029
- 4,
2030
- response.json()
2031
- ];
2032
- case 3:
2033
- _state.sent();
2125
+ metricEvent = _state.sent();
2126
+ publishTracking(licenseKey, "metrics", {
2127
+ events: [
2128
+ metricEvent
2129
+ ]
2130
+ });
2034
2131
  return [
2035
2132
  3,
2036
- 5
2133
+ 4
2037
2134
  ];
2038
- case 4:
2135
+ case 3:
2039
2136
  error = _state.sent();
2040
2137
  console.error("[StormcloudVideoPlayer] Error sending initial tracking data:", error);
2041
2138
  return [
2042
2139
  3,
2043
- 5
2140
+ 4
2044
2141
  ];
2045
- case 5:
2142
+ case 4:
2046
2143
  return [
2047
2144
  2
2048
2145
  ];
2049
2146
  }
2050
2147
  });
2051
- })();
2148
+ }).apply(this, arguments);
2052
2149
  }
2053
- function sendAdLoadedTracking(licenseKey, adLoadedInfo) {
2054
- return _async_to_generator(function() {
2055
- var clientInfo, browserId, trackingData, error;
2150
+ function sendAdLoadedTracking(_0, _1) {
2151
+ return _async_to_generator(function(licenseKey, adLoadedInfo) {
2152
+ var context, error;
2153
+ var _arguments = arguments;
2056
2154
  return _ts_generator(this, function(_state) {
2057
2155
  switch(_state.label){
2058
2156
  case 0:
2157
+ context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2158
+ _state.label = 1;
2159
+ case 1:
2059
2160
  _state.trys.push([
2060
- 0,
2161
+ 1,
2061
2162
  3,
2062
2163
  ,
2063
2164
  4
2064
2165
  ]);
2065
- clientInfo = getClientInfo();
2066
- return [
2067
- 4,
2068
- getBrowserID(clientInfo)
2069
- ];
2070
- case 1:
2071
- browserId = _state.sent();
2072
- trackingData = _object_spread({
2073
- browserId: browserId
2074
- }, clientInfo);
2075
2166
  return [
2076
2167
  4,
2077
- sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
2078
- licenseKey: licenseKey,
2079
- adLoadedInfo: adLoadedInfo
2080
- }))
2168
+ sendHeartbeat(licenseKey, context, {
2169
+ adLoaded: true,
2170
+ captureAt: adLoadedInfo.timestamp
2171
+ })
2081
2172
  ];
2082
2173
  case 2:
2083
2174
  _state.sent();
@@ -2098,39 +2189,46 @@ function sendAdLoadedTracking(licenseKey, adLoadedInfo) {
2098
2189
  ];
2099
2190
  }
2100
2191
  });
2101
- })();
2192
+ }).apply(this, arguments);
2102
2193
  }
2103
- function sendAdImpressionTracking(licenseKey, adImpressionInfo) {
2104
- return _async_to_generator(function() {
2105
- var clientInfo, browserId, trackingData, error;
2194
+ function sendAdImpressionTracking(_0, _1) {
2195
+ return _async_to_generator(function(licenseKey, adImpressionInfo) {
2196
+ var context, metricEvent, error;
2197
+ var _arguments = arguments;
2106
2198
  return _ts_generator(this, function(_state) {
2107
2199
  switch(_state.label){
2108
2200
  case 0:
2201
+ context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2202
+ if (!canPublish(licenseKey)) return [
2203
+ 2
2204
+ ];
2205
+ _state.label = 1;
2206
+ case 1:
2109
2207
  _state.trys.push([
2110
- 0,
2208
+ 1,
2111
2209
  3,
2112
2210
  ,
2113
2211
  4
2114
2212
  ]);
2115
- clientInfo = getClientInfo();
2116
2213
  return [
2117
2214
  4,
2118
- getBrowserID(clientInfo)
2119
- ];
2120
- case 1:
2121
- browserId = _state.sent();
2122
- trackingData = _object_spread({
2123
- browserId: browserId
2124
- }, clientInfo);
2125
- return [
2126
- 4,
2127
- sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
2128
- licenseKey: licenseKey,
2129
- adImpressionInfo: adImpressionInfo
2130
- }))
2215
+ buildPlayerMetricEvent(context, {
2216
+ captureAt: adImpressionInfo.timestamp
2217
+ })
2131
2218
  ];
2132
2219
  case 2:
2133
- _state.sent();
2220
+ metricEvent = _state.sent();
2221
+ publishTracking(licenseKey, "heartbeat", metricEvent);
2222
+ publishTracking(licenseKey, "impressions", {
2223
+ events: [
2224
+ {
2225
+ player_id: metricEvent.player_id,
2226
+ ad_played_count: 1,
2227
+ ad_url: adImpressionInfo.adUrl,
2228
+ capture_at: adImpressionInfo.timestamp
2229
+ }
2230
+ ]
2231
+ });
2134
2232
  return [
2135
2233
  3,
2136
2234
  4
@@ -2148,74 +2246,52 @@ function sendAdImpressionTracking(licenseKey, adImpressionInfo) {
2148
2246
  ];
2149
2247
  }
2150
2248
  });
2151
- })();
2249
+ }).apply(this, arguments);
2152
2250
  }
2153
- function sendHeartbeat(licenseKey) {
2154
- return _async_to_generator(function() {
2155
- var clientInfo, browserId, heartbeatData, headers, response, error;
2251
+ function sendHeartbeat(_0) {
2252
+ return _async_to_generator(function(licenseKey) {
2253
+ var context, flags, heartbeatData, error;
2254
+ var _arguments = arguments;
2156
2255
  return _ts_generator(this, function(_state) {
2157
2256
  switch(_state.label){
2158
2257
  case 0:
2258
+ context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2259
+ if (!canPublish(licenseKey)) return [
2260
+ 2
2261
+ ];
2262
+ _state.label = 1;
2263
+ case 1:
2159
2264
  _state.trys.push([
2160
- 0,
2161
- 4,
2265
+ 1,
2266
+ 3,
2162
2267
  ,
2163
- 5
2268
+ 4
2164
2269
  ]);
2165
- clientInfo = getClientInfo();
2166
2270
  return [
2167
2271
  4,
2168
- getBrowserID(clientInfo)
2169
- ];
2170
- case 1:
2171
- browserId = _state.sent();
2172
- heartbeatData = {
2173
- browserId: browserId,
2174
- timestamp: /* @__PURE__ */ new Date().toISOString()
2175
- };
2176
- headers = {
2177
- "Content-Type": "application/json"
2178
- };
2179
- if (licenseKey) {
2180
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2181
- }
2182
- return [
2183
- 4,
2184
- fetch("https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/heartbeat", {
2185
- method: "POST",
2186
- headers: headers,
2187
- body: JSON.stringify(heartbeatData)
2188
- })
2272
+ buildPlayerMetricEvent(context, flags)
2189
2273
  ];
2190
2274
  case 2:
2191
- response = _state.sent();
2192
- if (!response.ok) {
2193
- throw new Error("HTTP error! status: ".concat(response.status));
2194
- }
2195
- return [
2196
- 4,
2197
- response.json()
2198
- ];
2199
- case 3:
2200
- _state.sent();
2275
+ heartbeatData = _state.sent();
2276
+ publishTracking(licenseKey, "heartbeat", heartbeatData);
2201
2277
  return [
2202
2278
  3,
2203
- 5
2279
+ 4
2204
2280
  ];
2205
- case 4:
2281
+ case 3:
2206
2282
  error = _state.sent();
2207
2283
  console.error("[StormcloudVideoPlayer] Error sending heartbeat:", error);
2208
2284
  return [
2209
2285
  3,
2210
- 5
2286
+ 4
2211
2287
  ];
2212
- case 5:
2288
+ case 4:
2213
2289
  return [
2214
2290
  2
2215
2291
  ];
2216
2292
  }
2217
2293
  });
2218
- })();
2294
+ }).apply(this, arguments);
2219
2295
  }
2220
2296
  // src/utils/polyfills.ts
2221
2297
  function polyfillURLSearchParams() {
@@ -2777,6 +2853,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2777
2853
  this.config = _object_spread({}, browserOverrides, config);
2778
2854
  this.video = config.videoElement;
2779
2855
  this.adTransitionGapMs = (_this_config_adTransitionGapMs = this.config.adTransitionGapMs) !== null && _this_config_adTransitionGapMs !== void 0 ? _this_config_adTransitionGapMs : 100;
2856
+ if (this.config.mqttConfig) {
2857
+ configureMQTT(this.config.mqttConfig);
2858
+ }
2780
2859
  logBrowserInfo(config.debugAdTiming);
2781
2860
  var browserForAdLayer = detectBrowser();
2782
2861
  var isSinglePipeline = browserForAdLayer.isSmartTV || !!this.config.singlePipelineMode;
@@ -3144,7 +3223,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3144
3223
  source: _this.getAdSource(),
3145
3224
  adIndex: _this.currentAdIndex,
3146
3225
  timestamp: /* @__PURE__ */ new Date().toISOString()
3147
- });
3226
+ }, _this.getPlayerAnalyticsContext());
3148
3227
  }
3149
3228
  });
3150
3229
  this.adLayer.on("ad_error", function(errorPayload) {
@@ -3449,7 +3528,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3449
3528
  key: "initializeTracking",
3450
3529
  value: function initializeTracking() {
3451
3530
  var _this = this;
3452
- sendInitialTracking(this.config.licenseKey).then(function() {
3531
+ sendInitialTracking(this.config.licenseKey, this.getPlayerAnalyticsContext()).then(function() {
3453
3532
  _this.heartbeatInterval = window.setInterval(function() {
3454
3533
  _this.sendHeartbeatIfNeeded();
3455
3534
  }, 5e3);
@@ -3470,7 +3549,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3470
3549
  var now = Date.now();
3471
3550
  if (!this.lastHeartbeatTime || now - this.lastHeartbeatTime > 3e4) {
3472
3551
  this.lastHeartbeatTime = now;
3473
- sendHeartbeat(this.config.licenseKey).catch(function(error) {
3552
+ sendHeartbeat(this.config.licenseKey, this.getPlayerAnalyticsContext()).catch(function(error) {
3474
3553
  if (_this.config.debugAdTiming) {
3475
3554
  console.warn("[StormcloudVideoPlayer] Failed to send heartbeat:", error);
3476
3555
  }
@@ -3564,6 +3643,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3564
3643
  return "other";
3565
3644
  }
3566
3645
  },
3646
+ {
3647
+ key: "getPlayerAnalyticsContext",
3648
+ value: function getPlayerAnalyticsContext() {
3649
+ return {
3650
+ inputStreamType: this.getStreamType()
3651
+ };
3652
+ }
3653
+ },
3567
3654
  {
3568
3655
  key: "shouldShowNativeControls",
3569
3656
  value: function shouldShowNativeControls() {
@@ -4218,7 +4305,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4218
4305
  sendAdLoadedTracking(_this.config.licenseKey, {
4219
4306
  source: _this.getAdSource(),
4220
4307
  timestamp: /* @__PURE__ */ new Date().toISOString()
4221
- });
4308
+ }, _this.getPlayerAnalyticsContext());
4222
4309
  }
4223
4310
  return [
4224
4311
  4,
@@ -4328,7 +4415,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4328
4415
  sendAdLoadedTracking(_this.config.licenseKey, {
4329
4416
  source: _this.getAdSource(),
4330
4417
  timestamp: /* @__PURE__ */ new Date().toISOString()
4331
- });
4418
+ }, _this.getPlayerAnalyticsContext());
4332
4419
  }
4333
4420
  return [
4334
4421
  4,
@@ -4495,7 +4582,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4495
4582
  sendAdLoadedTracking(this.config.licenseKey, {
4496
4583
  source: this.getAdSource(),
4497
4584
  timestamp: /* @__PURE__ */ new Date().toISOString()
4498
- });
4585
+ }, this.getPlayerAnalyticsContext());
4499
4586
  }
4500
4587
  _state.label = 1;
4501
4588
  case 1:
@@ -4694,7 +4781,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4694
4781
  sendAdLoadedTracking(this.config.licenseKey, {
4695
4782
  source: this.getAdSource(),
4696
4783
  timestamp: /* @__PURE__ */ new Date().toISOString()
4697
- });
4784
+ }, this.getPlayerAnalyticsContext());
4698
4785
  }
4699
4786
  return [
4700
4787
  4,
@@ -5639,6 +5726,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5639
5726
  clearInterval(this.heartbeatInterval);
5640
5727
  this.heartbeatInterval = void 0;
5641
5728
  }
5729
+ if (isMQTTEnabled()) {
5730
+ disconnectMQTT();
5731
+ }
5642
5732
  (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
5643
5733
  (_this_adLayer = this.adLayer) === null || _this_adLayer === void 0 ? void 0 : _this_adLayer.destroy();
5644
5734
  this.consecutiveFailures = 0;
@@ -7239,38 +7329,44 @@ function hexToRgb(hex) {
7239
7329
  return "".concat(num >> 16 & 255, ",").concat(num >> 8 & 255, ",").concat(num & 255);
7240
7330
  }
7241
7331
  var FADE_DURATION_MS = 1e3;
7242
- var VALID_ENTER_ANIMATIONS = /* @__PURE__ */ new Set([
7243
- "fade",
7244
- "slide_left",
7245
- "slide_right",
7246
- "slide_up",
7247
- "slide_down"
7248
- ]);
7332
+ var ENTER_ANIMATION_ALIASES = {
7333
+ fade: "fade",
7334
+ slide_from_left: "slide_from_left",
7335
+ slide_from_right: "slide_from_right",
7336
+ slide_from_top: "slide_from_top",
7337
+ slide_from_bottom: "slide_from_bottom",
7338
+ slide_left: "slide_from_left",
7339
+ slide_right: "slide_from_right",
7340
+ slide_up: "slide_from_top",
7341
+ slide_down: "slide_from_bottom"
7342
+ };
7343
+ function normalizeEnterAnimation(v) {
7344
+ var _ENTER_ANIMATION_ALIASES_v;
7345
+ if (typeof v !== "string") return null;
7346
+ return (_ENTER_ANIMATION_ALIASES_v = ENTER_ANIMATION_ALIASES[v]) !== null && _ENTER_ANIMATION_ALIASES_v !== void 0 ? _ENTER_ANIMATION_ALIASES_v : null;
7347
+ }
7249
7348
  function getEnterAnimation(overlay) {
7250
7349
  var flat = overlay.enter_animation;
7251
- if (typeof flat === "string" && VALID_ENTER_ANIMATIONS.has(flat)) {
7252
- return flat;
7253
- }
7350
+ var fromFlat = normalizeEnterAnimation(flat);
7351
+ if (fromFlat) return fromFlat;
7254
7352
  if (overlay.content) {
7255
7353
  try {
7256
7354
  var parsed = JSON.parse(overlay.content);
7257
- var v = parsed === null || parsed === void 0 ? void 0 : parsed.enterAnimation;
7258
- if (typeof v === "string" && VALID_ENTER_ANIMATIONS.has(v)) {
7259
- return v;
7260
- }
7355
+ var fromContent = normalizeEnterAnimation(parsed === null || parsed === void 0 ? void 0 : parsed.enterAnimation);
7356
+ if (fromContent) return fromContent;
7261
7357
  } catch (unused) {}
7262
7358
  }
7263
7359
  return "fade";
7264
7360
  }
7265
7361
  function enterHiddenTransform(anim) {
7266
7362
  switch(anim){
7267
- case "slide_left":
7363
+ case "slide_from_left":
7268
7364
  return "translateX(-120%)";
7269
- case "slide_right":
7365
+ case "slide_from_right":
7270
7366
  return "translateX(120%)";
7271
- case "slide_up":
7367
+ case "slide_from_top":
7272
7368
  return "translateY(-120%)";
7273
- case "slide_down":
7369
+ case "slide_from_bottom":
7274
7370
  return "translateY(120%)";
7275
7371
  default:
7276
7372
  return "";
@@ -7831,7 +7927,18 @@ var CRITICAL_PROPS = [
7831
7927
  "licenseKey",
7832
7928
  "lowLatencyMode",
7833
7929
  "driftToleranceMs",
7834
- "debugAdTiming"
7930
+ "immediateManifestAds",
7931
+ "debugAdTiming",
7932
+ "showCustomControls",
7933
+ "adFailsafeTimeoutMs",
7934
+ "minSegmentsBeforePlay",
7935
+ "disableAds",
7936
+ "disableFiller",
7937
+ "singlePipelineMode",
7938
+ "mqttConfig",
7939
+ "adBreakCheckIntervalMs",
7940
+ "maxAdBreakExtensionMs",
7941
+ "adTransitionGapMs"
7835
7942
  ];
7836
7943
  var CONTROLS_HIDE_DELAY = 3e3;
7837
7944
  var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
@@ -7842,7 +7949,7 @@ var PANEL_BASE_RIGHT_OFFSET = 10;
7842
7949
  var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props) {
7843
7950
  var _ref;
7844
7951
  var _aiLiveContext_context;
7845
- var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, minSegmentsBeforePlay = props.minSegmentsBeforePlay, disableAds = props.disableAds, disableFiller = props.disableFiller, swirlProjectId = props.swirlProjectId, swirlShowcaseDemo = props.swirlShowcaseDemo, swirlOverlayApiBaseUrl = props.swirlOverlayApiBaseUrl, swirlOverlayCoordinateSpace = props.swirlOverlayCoordinateSpace, adcisionChannelId = props.adcisionChannelId, disableOverlays = props.disableOverlays, showAdsControl = props.showAdsControl, showOverlaysControl = props.showOverlaysControl, showAiContextControl = props.showAiContextControl, showDebugControl = props.showDebugControl, restVideoAttrs = _object_without_properties(props, [
7952
+ var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, adFailsafeTimeoutMs = props.adFailsafeTimeoutMs, minSegmentsBeforePlay = props.minSegmentsBeforePlay, disableAds = props.disableAds, disableFiller = props.disableFiller, singlePipelineMode = props.singlePipelineMode, mqttConfig2 = props.mqttConfig, adBreakCheckIntervalMs = props.adBreakCheckIntervalMs, maxAdBreakExtensionMs = props.maxAdBreakExtensionMs, adTransitionGapMs = props.adTransitionGapMs, swirlProjectId = props.swirlProjectId, swirlShowcaseDemo = props.swirlShowcaseDemo, swirlOverlayApiBaseUrl = props.swirlOverlayApiBaseUrl, swirlOverlayCoordinateSpace = props.swirlOverlayCoordinateSpace, adcisionChannelId = props.adcisionChannelId, disableOverlays = props.disableOverlays, showAdsControl = props.showAdsControl, showOverlaysControl = props.showOverlaysControl, showAiContextControl = props.showAiContextControl, showDebugControl = props.showDebugControl, restVideoAttrs = _object_without_properties(props, [
7846
7953
  "src",
7847
7954
  "autoplay",
7848
7955
  "muted",
@@ -7867,9 +7974,15 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
7867
7974
  "poster",
7868
7975
  "children",
7869
7976
  "licenseKey",
7977
+ "adFailsafeTimeoutMs",
7870
7978
  "minSegmentsBeforePlay",
7871
7979
  "disableAds",
7872
7980
  "disableFiller",
7981
+ "singlePipelineMode",
7982
+ "mqttConfig",
7983
+ "adBreakCheckIntervalMs",
7984
+ "maxAdBreakExtensionMs",
7985
+ "adTransitionGapMs",
7873
7986
  "swirlProjectId",
7874
7987
  "swirlShowcaseDemo",
7875
7988
  "swirlOverlayApiBaseUrl",
@@ -8110,7 +8223,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8110
8223
  var debugPanelBottomOffset = shouldShowEnhancedControls ? Math.max(74, 92 * responsiveScale) : Math.max(52, 58 * responsiveScale);
8111
8224
  var criticalPropsKey = (0, import_react2.useMemo)(function() {
8112
8225
  var baseParts = CRITICAL_PROPS.map(function(prop) {
8113
- return prop === "src" ? "src:".concat(effectiveSrc) : "".concat(prop, ":").concat(props[prop]);
8226
+ return prop === "src" ? "src:".concat(effectiveSrc) : "".concat(prop, ":").concat(JSON.stringify(props[prop]));
8114
8227
  }).join("|");
8115
8228
  return "".concat(baseParts, "|adcisionChannelId:").concat(adcisionChannelId !== null && adcisionChannelId !== void 0 ? adcisionChannelId : "");
8116
8229
  }, [
@@ -8119,8 +8232,19 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8119
8232
  licenseKey,
8120
8233
  lowLatencyMode,
8121
8234
  driftToleranceMs,
8235
+ immediateManifestAds,
8122
8236
  adcisionChannelId,
8123
- debugAdTiming
8237
+ debugAdTiming,
8238
+ showCustomControls,
8239
+ adFailsafeTimeoutMs,
8240
+ minSegmentsBeforePlay,
8241
+ disableAds,
8242
+ disableFiller,
8243
+ singlePipelineMode,
8244
+ mqttConfig2,
8245
+ adBreakCheckIntervalMs,
8246
+ maxAdBreakExtensionMs,
8247
+ adTransitionGapMs
8124
8248
  ]);
8125
8249
  (0, import_react2.useEffect)(function() {
8126
8250
  if (typeof window === "undefined") return;
@@ -8154,9 +8278,15 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
8154
8278
  if (onFullscreenToggle !== void 0) cfg.onFullscreenToggle = onFullscreenToggle;
8155
8279
  if (onControlClick !== void 0) cfg.onControlClick = onControlClick;
8156
8280
  if (licenseKey !== void 0) cfg.licenseKey = licenseKey;
8281
+ if (adFailsafeTimeoutMs !== void 0) cfg.adFailsafeTimeoutMs = adFailsafeTimeoutMs;
8157
8282
  if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
8158
8283
  if (disableAds !== void 0) cfg.disableAds = disableAds;
8159
8284
  cfg.disableFiller = disableFiller !== null && disableFiller !== void 0 ? disableFiller : true;
8285
+ if (singlePipelineMode !== void 0) cfg.singlePipelineMode = singlePipelineMode;
8286
+ if (mqttConfig2 !== void 0) cfg.mqttConfig = mqttConfig2;
8287
+ if (adBreakCheckIntervalMs !== void 0) cfg.adBreakCheckIntervalMs = adBreakCheckIntervalMs;
8288
+ if (maxAdBreakExtensionMs !== void 0) cfg.maxAdBreakExtensionMs = maxAdBreakExtensionMs;
8289
+ if (adTransitionGapMs !== void 0) cfg.adTransitionGapMs = adTransitionGapMs;
8160
8290
  if (adcisionChannelId !== void 0) {
8161
8291
  cfg.projectId = String(adcisionChannelId);
8162
8292
  cfg.channelId = adcisionChannelId;