stormcloud-video-player 0.3.53 → 0.3.55

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.js CHANGED
@@ -180,12 +180,22 @@ function _object_spread_props(target, source) {
180
180
  }
181
181
  function _object_without_properties(source, excluded) {
182
182
  if (source == null) return {};
183
- var target = _object_without_properties_loose(source, excluded);
184
- var key, i;
183
+ var target = {}, sourceKeys, key, i;
184
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
185
+ sourceKeys = Reflect.ownKeys(Object(source));
186
+ for(i = 0; i < sourceKeys.length; i++){
187
+ key = sourceKeys[i];
188
+ if (excluded.indexOf(key) >= 0) continue;
189
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
190
+ target[key] = source[key];
191
+ }
192
+ return target;
193
+ }
194
+ target = _object_without_properties_loose(source, excluded);
185
195
  if (Object.getOwnPropertySymbols) {
186
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
187
- for(i = 0; i < sourceSymbolKeys.length; i++){
188
- key = sourceSymbolKeys[i];
196
+ sourceKeys = Object.getOwnPropertySymbols(source);
197
+ for(i = 0; i < sourceKeys.length; i++){
198
+ key = sourceKeys[i];
189
199
  if (excluded.indexOf(key) >= 0) continue;
190
200
  if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
191
201
  target[key] = source[key];
@@ -195,12 +205,11 @@ function _object_without_properties(source, excluded) {
195
205
  }
196
206
  function _object_without_properties_loose(source, excluded) {
197
207
  if (source == null) return {};
198
- var target = {};
199
- var sourceKeys = Object.keys(source);
200
- var key, i;
208
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
201
209
  for(i = 0; i < sourceKeys.length; i++){
202
210
  key = sourceKeys[i];
203
211
  if (excluded.indexOf(key) >= 0) continue;
212
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
204
213
  target[key] = source[key];
205
214
  }
206
215
  return target;
@@ -253,9 +262,17 @@ function _ts_generator(thisArg, body) {
253
262
  },
254
263
  trys: [],
255
264
  ops: []
256
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
257
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
258
- return this;
265
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
266
+ return d(g, "next", {
267
+ value: verb(0)
268
+ }), d(g, "throw", {
269
+ value: verb(1)
270
+ }), d(g, "return", {
271
+ value: verb(2)
272
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
273
+ value: function() {
274
+ return this;
275
+ }
259
276
  }), g;
260
277
  function verb(n) {
261
278
  return function(v) {
@@ -350,7 +367,7 @@ function _ts_values(o) {
350
367
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
351
368
  }
352
369
  // src/ui/StormcloudVideoPlayer.tsx
353
- import React, { useEffect, useRef, useMemo } from "react";
370
+ import React, { useEffect, useRef, useMemo, useCallback } from "react";
354
371
  // src/player/StormcloudVideoPlayer.ts
355
372
  import Hls2 from "hls.js";
356
373
  // src/utils/browserCompat.ts
@@ -709,7 +726,7 @@ function createImaController(video, options) {
709
726
  var fn = _step.value;
710
727
  try {
711
728
  fn(payload);
712
- } catch (e) {}
729
+ } catch (unused) {}
713
730
  }
714
731
  } catch (err) {
715
732
  _didIteratorError = true;
@@ -747,7 +764,7 @@ function createImaController(video, options) {
747
764
  console.error("StormcloudVideoPlayer: The host page is inside a sandboxed iframe without 'allow-scripts'. Google IMA cannot run ads within sandboxed frames. Remove the sandbox attribute or include 'allow-scripts allow-same-origin'.");
748
765
  }
749
766
  }
750
- } catch (e) {}
767
+ } catch (unused) {}
751
768
  if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
752
769
  var existing = document.querySelector('script[data-ima="true"]');
753
770
  if (existing) {
@@ -789,9 +806,6 @@ function createImaController(video, options) {
789
806
  var adDisplayContainer;
790
807
  var adContainerEl;
791
808
  var lastAdTagUrl;
792
- var retryAttempts = 0;
793
- var maxRetries = 2;
794
- var backoffBaseMs = 500;
795
809
  var adsLoadedPromise;
796
810
  var adsLoadedResolve;
797
811
  var adsLoadedReject;
@@ -995,7 +1009,7 @@ function createImaController(video, options) {
995
1009
  if (adsManager) {
996
1010
  try {
997
1011
  adsManager.destroy();
998
- } catch (e) {}
1012
+ } catch (unused) {}
999
1013
  adsManager = void 0;
1000
1014
  }
1001
1015
  if (adVideoElement) {
@@ -1006,7 +1020,7 @@ function createImaController(video, options) {
1006
1020
  if (adsLoader) {
1007
1021
  try {
1008
1022
  adsLoader.destroy();
1009
- } catch (e) {}
1023
+ } catch (unused) {}
1010
1024
  adsLoader = void 0;
1011
1025
  }
1012
1026
  }
@@ -1024,7 +1038,7 @@ function createImaController(video, options) {
1024
1038
  try {
1025
1039
  var _adDisplayContainer_initialize;
1026
1040
  (_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
1027
- } catch (e) {}
1041
+ } catch (unused) {}
1028
1042
  }
1029
1043
  }).catch(function() {});
1030
1044
  },
@@ -1088,7 +1102,6 @@ function createImaController(video, options) {
1088
1102
  _state.sent();
1089
1103
  google = window.google;
1090
1104
  lastAdTagUrl = vastTagUrl;
1091
- retryAttempts = 0;
1092
1105
  if (!adDisplayContainer) {
1093
1106
  container = document.createElement("div");
1094
1107
  container.style.position = "absolute";
@@ -1172,32 +1185,23 @@ function createImaController(video, options) {
1172
1185
  }
1173
1186
  }, 300);
1174
1187
  }
1175
- hideContentVideo();
1188
+ showContentVideo();
1176
1189
  if (adsLoadedReject) {
1177
1190
  adsLoadedReject(new Error("Ad playback error"));
1178
1191
  adsLoadedReject = void 0;
1179
1192
  adsLoadedResolve = void 0;
1180
1193
  }
1181
- if (lastAdTagUrl && retryAttempts < maxRetries && !isNoFill) {
1182
- var delay = backoffBaseMs * Math.pow(2, retryAttempts++);
1183
- window.setTimeout(function() {
1184
- try {
1185
- makeAdsRequest(google, lastAdTagUrl);
1186
- } catch (e) {}
1187
- }, delay);
1188
- } else {
1189
- emit("ad_error", {
1190
- code: errorCode,
1191
- vastErrorCode: vastErrorCode,
1192
- message: errorMessage,
1193
- cause: innerError,
1194
- isNoFill: isNoFill
1195
- });
1196
- if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
1197
- if (video.paused) {
1198
- var _video_play;
1199
- (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
1200
- }
1194
+ emit("ad_error", {
1195
+ code: errorCode,
1196
+ vastErrorCode: vastErrorCode,
1197
+ message: errorMessage,
1198
+ cause: innerError,
1199
+ isNoFill: isNoFill
1200
+ });
1201
+ if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
1202
+ if (video.paused) {
1203
+ var _video_play;
1204
+ (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
1201
1205
  }
1202
1206
  }
1203
1207
  });
@@ -1215,7 +1219,7 @@ function createImaController(video, options) {
1215
1219
  if (adsManager) {
1216
1220
  try {
1217
1221
  adsManager.setVolume(adVolume);
1218
- } catch (e) {}
1222
+ } catch (unused) {}
1219
1223
  }
1220
1224
  emit("content_pause");
1221
1225
  });
@@ -1229,7 +1233,7 @@ function createImaController(video, options) {
1229
1233
  if (adsManager) {
1230
1234
  try {
1231
1235
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1232
- } catch (e) {}
1236
+ } catch (unused) {}
1233
1237
  }
1234
1238
  }
1235
1239
  if (adContainerEl) {
@@ -1243,7 +1247,7 @@ function createImaController(video, options) {
1243
1247
  adsManager.addEventListener(AdEvent.CONTENT_RESUME_REQUESTED, function() {
1244
1248
  adPlaying = false;
1245
1249
  setAdPlayingFlag(false);
1246
- hideContentVideo();
1250
+ showContentVideo();
1247
1251
  emit("content_resume");
1248
1252
  });
1249
1253
  adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, function() {
@@ -1259,7 +1263,7 @@ function createImaController(video, options) {
1259
1263
  }
1260
1264
  }, 300);
1261
1265
  }
1262
- hideContentVideo();
1266
+ showContentVideo();
1263
1267
  emit("all_ads_completed");
1264
1268
  });
1265
1269
  if (adsLoadedResolve) {
@@ -1281,7 +1285,7 @@ function createImaController(video, options) {
1281
1285
  }
1282
1286
  }, 300);
1283
1287
  }
1284
- hideContentVideo();
1288
+ showContentVideo();
1285
1289
  if (adsLoadedReject) {
1286
1290
  adsLoadedReject(new Error("Failed to setup ads manager"));
1287
1291
  adsLoadedReject = void 0;
@@ -1324,7 +1328,7 @@ function createImaController(video, options) {
1324
1328
  }
1325
1329
  }, 300);
1326
1330
  }
1327
- hideContentVideo();
1331
+ showContentVideo();
1328
1332
  if (adsLoadedReject) {
1329
1333
  adsLoadedReject(new Error(isNoFill ? "No ads available" : "Ads loader error"));
1330
1334
  adsLoadedReject = void 0;
@@ -1390,7 +1394,7 @@ function createImaController(video, options) {
1390
1394
  }
1391
1395
  try {
1392
1396
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1393
- } catch (e) {}
1397
+ } catch (unused) {}
1394
1398
  adsManager.start();
1395
1399
  return [
1396
1400
  2,
@@ -1472,7 +1476,7 @@ function createImaController(video, options) {
1472
1476
  try {
1473
1477
  ;
1474
1478
  adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
1475
- } catch (e) {}
1479
+ } catch (unused) {}
1476
1480
  destroyAdsManager();
1477
1481
  return [
1478
1482
  2
@@ -1503,7 +1507,7 @@ function createImaController(video, options) {
1503
1507
  try {
1504
1508
  var _adsLoader_destroy;
1505
1509
  adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
1506
- } catch (e) {}
1510
+ } catch (unused) {}
1507
1511
  adDisplayContainer = void 0;
1508
1512
  adsLoader = void 0;
1509
1513
  contentVideoHidden = false;
@@ -1552,7 +1556,7 @@ function createImaController(video, options) {
1552
1556
  if (adsManager && adPlaying) {
1553
1557
  try {
1554
1558
  adsManager.setVolume(clampedVolume);
1555
- } catch (e) {}
1559
+ } catch (unused) {}
1556
1560
  }
1557
1561
  },
1558
1562
  getAdVolume: function getAdVolume() {
@@ -2656,9 +2660,6 @@ function sendInitialTracking(licenseKey) {
2656
2660
  headers = {
2657
2661
  "Content-Type": "application/json"
2658
2662
  };
2659
- if (licenseKey) {
2660
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2661
- }
2662
2663
  return [
2663
2664
  4,
2664
2665
  fetch("https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/track", {
@@ -2764,6 +2765,234 @@ function sendHeartbeat(licenseKey) {
2764
2765
  });
2765
2766
  })();
2766
2767
  }
2768
+ var TRACK_API_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/track";
2769
+ function mapToAdTrackingSource(source, adPlayerType) {
2770
+ if (source === "prebid" || source === "ima" || source === "hls") {
2771
+ return source;
2772
+ }
2773
+ if (source === "preload" || source === "ssp") {
2774
+ return source === "ssp" ? "prebid" : "ima";
2775
+ }
2776
+ return adPlayerType === "hls" ? "hls" : "ima";
2777
+ }
2778
+ function postAdTracking(licenseKey, body) {
2779
+ return _async_to_generator(function() {
2780
+ var headers, response;
2781
+ return _ts_generator(this, function(_state) {
2782
+ switch(_state.label){
2783
+ case 0:
2784
+ headers = {
2785
+ "Content-Type": "application/json"
2786
+ };
2787
+ if (licenseKey) {
2788
+ headers["Authorization"] = "Bearer ".concat(licenseKey);
2789
+ }
2790
+ return [
2791
+ 4,
2792
+ fetch(TRACK_API_URL, {
2793
+ method: "POST",
2794
+ headers: headers,
2795
+ body: JSON.stringify(body)
2796
+ })
2797
+ ];
2798
+ case 1:
2799
+ response = _state.sent();
2800
+ if (!response.ok) {
2801
+ throw new Error("HTTP error! status: ".concat(response.status));
2802
+ }
2803
+ return [
2804
+ 4,
2805
+ response.json()
2806
+ ];
2807
+ case 2:
2808
+ _state.sent();
2809
+ return [
2810
+ 2
2811
+ ];
2812
+ }
2813
+ });
2814
+ })();
2815
+ }
2816
+ function sendAdDetectTracking(licenseKey, payload) {
2817
+ return _async_to_generator(function() {
2818
+ var _payload_source, _payload_timestamp, clientInfo, browserId, adDetectInfo, body, error;
2819
+ return _ts_generator(this, function(_state) {
2820
+ switch(_state.label){
2821
+ case 0:
2822
+ _state.trys.push([
2823
+ 0,
2824
+ 3,
2825
+ ,
2826
+ 4
2827
+ ]);
2828
+ clientInfo = getClientInfo();
2829
+ return [
2830
+ 4,
2831
+ getBrowserID(clientInfo)
2832
+ ];
2833
+ case 1:
2834
+ browserId = _state.sent();
2835
+ adDetectInfo = _object_spread({
2836
+ source: (_payload_source = payload.source) !== null && _payload_source !== void 0 ? _payload_source : "scte35",
2837
+ timestamp: (_payload_timestamp = payload.timestamp) !== null && _payload_timestamp !== void 0 ? _payload_timestamp : /* @__PURE__ */ new Date().toISOString()
2838
+ }, payload.durationSeconds != null && {
2839
+ durationSeconds: payload.durationSeconds
2840
+ }, payload.ptsSeconds != null && {
2841
+ ptsSeconds: payload.ptsSeconds
2842
+ }, payload.detectedAtFragmentSn != null && {
2843
+ detectedAtFragmentSn: payload.detectedAtFragmentSn
2844
+ });
2845
+ body = _object_spread_props(_object_spread({
2846
+ browserId: browserId
2847
+ }, clientInfo, licenseKey && {
2848
+ licenseKey: licenseKey
2849
+ }), {
2850
+ adDetectInfo: adDetectInfo
2851
+ });
2852
+ return [
2853
+ 4,
2854
+ postAdTracking(licenseKey, body)
2855
+ ];
2856
+ case 2:
2857
+ _state.sent();
2858
+ return [
2859
+ 3,
2860
+ 4
2861
+ ];
2862
+ case 3:
2863
+ error = _state.sent();
2864
+ console.error("[StormcloudVideoPlayer] Error sending ad-detect tracking:", error);
2865
+ return [
2866
+ 3,
2867
+ 4
2868
+ ];
2869
+ case 4:
2870
+ return [
2871
+ 2
2872
+ ];
2873
+ }
2874
+ });
2875
+ })();
2876
+ }
2877
+ function sendAdLoadedTracking(licenseKey, payload, adPlayerType) {
2878
+ return _async_to_generator(function() {
2879
+ var clientInfo, browserId, source, adLoadedInfo, body, error;
2880
+ return _ts_generator(this, function(_state) {
2881
+ switch(_state.label){
2882
+ case 0:
2883
+ _state.trys.push([
2884
+ 0,
2885
+ 3,
2886
+ ,
2887
+ 4
2888
+ ]);
2889
+ clientInfo = getClientInfo();
2890
+ return [
2891
+ 4,
2892
+ getBrowserID(clientInfo)
2893
+ ];
2894
+ case 1:
2895
+ browserId = _state.sent();
2896
+ source = mapToAdTrackingSource(payload.source, adPlayerType);
2897
+ adLoadedInfo = _object_spread({
2898
+ source: source,
2899
+ timestamp: /* @__PURE__ */ new Date().toISOString()
2900
+ }, payload.vastUrl != null && {
2901
+ vastUrl: payload.vastUrl
2902
+ }, payload.durationSeconds != null && {
2903
+ durationSeconds: payload.durationSeconds
2904
+ });
2905
+ body = _object_spread_props(_object_spread({
2906
+ browserId: browserId
2907
+ }, clientInfo, licenseKey && {
2908
+ licenseKey: licenseKey
2909
+ }), {
2910
+ adLoadedInfo: adLoadedInfo
2911
+ });
2912
+ return [
2913
+ 4,
2914
+ postAdTracking(licenseKey, body)
2915
+ ];
2916
+ case 2:
2917
+ _state.sent();
2918
+ return [
2919
+ 3,
2920
+ 4
2921
+ ];
2922
+ case 3:
2923
+ error = _state.sent();
2924
+ console.error("[StormcloudVideoPlayer] Error sending ad-loaded tracking:", error);
2925
+ return [
2926
+ 3,
2927
+ 4
2928
+ ];
2929
+ case 4:
2930
+ return [
2931
+ 2
2932
+ ];
2933
+ }
2934
+ });
2935
+ })();
2936
+ }
2937
+ function sendAdImpressionTracking(licenseKey, payload, adPlayerType) {
2938
+ return _async_to_generator(function() {
2939
+ var clientInfo, browserId, source, adImpressionInfo, body, error;
2940
+ return _ts_generator(this, function(_state) {
2941
+ switch(_state.label){
2942
+ case 0:
2943
+ _state.trys.push([
2944
+ 0,
2945
+ 3,
2946
+ ,
2947
+ 4
2948
+ ]);
2949
+ clientInfo = getClientInfo();
2950
+ return [
2951
+ 4,
2952
+ getBrowserID(clientInfo)
2953
+ ];
2954
+ case 1:
2955
+ browserId = _state.sent();
2956
+ source = mapToAdTrackingSource(payload.source, adPlayerType);
2957
+ adImpressionInfo = _object_spread({
2958
+ source: source,
2959
+ adIndex: payload.adIndex,
2960
+ timestamp: /* @__PURE__ */ new Date().toISOString()
2961
+ }, payload.durationSeconds != null && {
2962
+ durationSeconds: payload.durationSeconds
2963
+ });
2964
+ body = _object_spread_props(_object_spread({
2965
+ browserId: browserId
2966
+ }, clientInfo, licenseKey && {
2967
+ licenseKey: licenseKey
2968
+ }), {
2969
+ adImpressionInfo: adImpressionInfo
2970
+ });
2971
+ return [
2972
+ 4,
2973
+ postAdTracking(licenseKey, body)
2974
+ ];
2975
+ case 2:
2976
+ _state.sent();
2977
+ return [
2978
+ 3,
2979
+ 4
2980
+ ];
2981
+ case 3:
2982
+ error = _state.sent();
2983
+ console.error("[StormcloudVideoPlayer] Error sending ad-impression tracking:", error);
2984
+ return [
2985
+ 3,
2986
+ 4
2987
+ ];
2988
+ case 4:
2989
+ return [
2990
+ 2
2991
+ ];
2992
+ }
2993
+ });
2994
+ })();
2995
+ }
2767
2996
  // src/utils/polyfills.ts
2768
2997
  function polyfillURLSearchParams() {
2769
2998
  if (typeof URLSearchParams !== "undefined") {
@@ -3048,18 +3277,26 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3048
3277
  this.maxPlaceholderDurationMs = 5e3;
3049
3278
  this.isShowingPlaceholder = false;
3050
3279
  this.totalAdRequestsInBreak = 0;
3051
- this.maxTotalAdRequestsPerBreak = 20;
3280
+ this.maxTotalAdRequestsPerBreak = 10;
3052
3281
  this.pendingAdBreak = null;
3053
3282
  this.consecutiveFailures = 0;
3054
3283
  this.maxConsecutiveFailures = 5;
3055
3284
  this.lastAdRequestTime = 0;
3056
- this.minAdRequestIntervalMs = 2500;
3285
+ this.minAdRequestIntervalMs = 3e3;
3057
3286
  this.backoffBaseMs = 1e3;
3058
3287
  this.maxBackoffMs = 15e3;
3288
+ this.globalConsecutiveNoFills = 0;
3289
+ this.globalNoFillThreshold = 3;
3290
+ this.globalNoFillCooldownUntil = 0;
3291
+ this.globalNoFillBackoffBaseMs = 5e3;
3292
+ this.globalNoFillBackoffMaxMs = 6e4;
3293
+ this.globalLastGamRequestTime = 0;
3294
+ this.globalMinGamIntervalMs = 3e3;
3059
3295
  this.preloadPool = [];
3060
- this.maxPreloadPoolSize = 3;
3296
+ this.maxPreloadPoolSize = 2;
3061
3297
  this.preloadPoolActive = false;
3062
3298
  this.preloadPoolLoopRunning = false;
3299
+ this.adDetectSentForCurrentBreak = false;
3063
3300
  this.continuousFetchLoopRunning = false;
3064
3301
  initializePolyfills();
3065
3302
  var browserOverrides = getBrowserConfigOverrides();
@@ -3200,7 +3437,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3200
3437
  });
3201
3438
  this.hls.on(Hls2.Events.MANIFEST_PARSED, function(_, data) {
3202
3439
  return _async_to_generator(function() {
3203
- var _this_hls_levels, _this_hls, _this_hls_levels_some, adBehavior, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
3440
+ var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
3204
3441
  return _ts_generator(this, function(_state) {
3205
3442
  switch(_state.label){
3206
3443
  case 0:
@@ -3209,10 +3446,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3209
3446
  } else {
3210
3447
  ;
3211
3448
  ;
3212
- this.isLiveStream = (_this_hls_levels_some = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
3449
+ this.isLiveStream = (_ref = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
3213
3450
  var _level_details, _level_details1;
3214
3451
  return (level === null || level === void 0 ? void 0 : (_level_details = level.details) === null || _level_details === void 0 ? void 0 : _level_details.live) === true || (level === null || level === void 0 ? void 0 : (_level_details1 = level.details) === null || _level_details1 === void 0 ? void 0 : _level_details1.type) === "LIVE";
3215
- })) !== null && _this_hls_levels_some !== void 0 ? _this_hls_levels_some : false;
3452
+ })) !== null && _ref !== void 0 ? _ref : false;
3216
3453
  }
3217
3454
  if (this.config.debugAdTiming) {
3218
3455
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -3276,9 +3513,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3276
3513
  var tag = "";
3277
3514
  var value = "";
3278
3515
  if (Array.isArray(entry)) {
3279
- var _entry_;
3516
+ var _entry_, _entry_1;
3280
3517
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
3281
- var _entry_1;
3282
3518
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
3283
3519
  } else if (typeof entry === "string") {
3284
3520
  var idx = entry.indexOf(":");
@@ -3401,9 +3637,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3401
3637
  var tag = "";
3402
3638
  var value = "";
3403
3639
  if (Array.isArray(entry)) {
3404
- var _entry_;
3640
+ var _entry_, _entry_1;
3405
3641
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
3406
- var _entry_1;
3407
3642
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
3408
3643
  } else if (typeof entry === "string") {
3409
3644
  var idx = entry.indexOf(":");
@@ -3453,10 +3688,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3453
3688
  }
3454
3689
  });
3455
3690
  } else if (tag.includes("EXT-X-DATERANGE")) {
3691
+ var _attrs_CLASS;
3456
3692
  var attrs = _this.parseAttributeList(value);
3457
3693
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
3458
3694
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
3459
- var _attrs_CLASS;
3460
3695
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
3461
3696
  var duration = _this.toNumber(attrs["DURATION"]);
3462
3697
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -3531,6 +3766,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3531
3766
  value: function attachImaEventListeners() {
3532
3767
  var _this = this;
3533
3768
  this.ima.on("all_ads_completed", function() {
3769
+ sendAdImpressionTracking(_this.config.licenseKey, {
3770
+ adIndex: _this.currentAdIndex
3771
+ }, _this.config.adPlayerType).catch(function() {});
3534
3772
  var remaining = _this.getRemainingAdMs();
3535
3773
  _this.consecutiveFailures = 0;
3536
3774
  if (_this.config.debugAdTiming) {
@@ -3570,6 +3808,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3570
3808
  _this.clearAdRequestWatchdog();
3571
3809
  _this.activeAdRequestToken = null;
3572
3810
  _this.showAds = true;
3811
+ _this.resetGamNoFillCounter();
3573
3812
  if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null) {
3574
3813
  if (_this.adStopTimerId == null) {
3575
3814
  _this.currentAdBreakStartWallClockMs = Date.now();
@@ -3592,6 +3831,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3592
3831
  }
3593
3832
  });
3594
3833
  this.ima.on("content_resume", function() {
3834
+ sendAdImpressionTracking(_this.config.licenseKey, {
3835
+ adIndex: _this.currentAdIndex
3836
+ }, _this.config.adPlayerType).catch(function() {});
3595
3837
  if (!_this.video.muted) {
3596
3838
  _this.video.muted = true;
3597
3839
  _this.video.volume = 0;
@@ -3858,11 +4100,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3858
4100
  }
3859
4101
  var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
3860
4102
  if (daterangeMatch) {
3861
- var _daterangeMatch_;
4103
+ var _daterangeMatch_, _attrs_CLASS;
3862
4104
  var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
3863
4105
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
3864
4106
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
3865
- var _attrs_CLASS;
3866
4107
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
3867
4108
  var duration = this.toNumber(attrs["DURATION"]);
3868
4109
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -3938,7 +4179,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3938
4179
  var out = "";
3939
4180
  for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
3940
4181
  return out;
3941
- } catch (e) {
4182
+ } catch (unused) {
3942
4183
  return void 0;
3943
4184
  }
3944
4185
  }
@@ -3957,6 +4198,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3957
4198
  });
3958
4199
  }
3959
4200
  if (marker.type === "start") {
4201
+ var _this_config_immediateManifestAds;
3960
4202
  var _this_pendingAdBreak;
3961
4203
  if (!this.video.muted) {
3962
4204
  this.video.muted = true;
@@ -3975,13 +4217,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3975
4217
  }
3976
4218
  return;
3977
4219
  }
4220
+ if (!this.adDetectSentForCurrentBreak) {
4221
+ this.adDetectSentForCurrentBreak = true;
4222
+ var detectPayload = {};
4223
+ if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
4224
+ if (marker.ptsSeconds != null) detectPayload.ptsSeconds = marker.ptsSeconds;
4225
+ sendAdDetectTracking(this.config.licenseKey, detectPayload).catch(function() {});
4226
+ }
3978
4227
  var hasPrefetchedAds = this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0;
3979
4228
  this.inAdBreak = true;
3980
4229
  var durationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : ((_this_pendingAdBreak = this.pendingAdBreak) === null || _this_pendingAdBreak === void 0 ? void 0 : _this_pendingAdBreak.marker.durationSeconds) != null ? this.pendingAdBreak.marker.durationSeconds * 1e3 : void 0;
3981
4230
  this.expectedAdBreakDurationMs = durationMs;
3982
4231
  this.currentAdBreakStartWallClockMs = Date.now();
3983
4232
  var isManifestMarker = this.isManifestBasedMarker(marker);
3984
- var _this_config_immediateManifestAds;
3985
4233
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
3986
4234
  if (this.config.debugAdTiming) {
3987
4235
  console.log("[StormcloudVideoPlayer] Ad start decision:", {
@@ -4136,9 +4384,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4136
4384
  var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
4137
4385
  var match;
4138
4386
  while((match = regex.exec(value)) !== null){
4139
- var _match_;
4387
+ var _match_, _ref, _match_1;
4140
4388
  var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
4141
- var _match_1, _ref;
4142
4389
  var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
4143
4390
  if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
4144
4391
  rawVal = rawVal.slice(1, -1);
@@ -4483,13 +4730,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4483
4730
  {
4484
4731
  key: "shouldShowNativeControls",
4485
4732
  value: function shouldShowNativeControls() {
4733
+ var _this_config_showCustomControls;
4486
4734
  var streamType = this.getStreamType();
4487
4735
  if (streamType === "other") {
4488
- var _this_config_showCustomControls;
4489
- return !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false);
4736
+ var _this_config_showCustomControls1;
4737
+ return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
4490
4738
  }
4491
- var _this_config_showCustomControls1;
4492
- return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
4739
+ return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
4493
4740
  }
4494
4741
  },
4495
4742
  {
@@ -4534,6 +4781,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4534
4781
  isFetching: false,
4535
4782
  fetchStartTime: Date.now()
4536
4783
  });
4784
+ this.adDetectSentForCurrentBreak = true;
4785
+ var detectPayload = {};
4786
+ if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
4787
+ if (marker.ptsSeconds != null) detectPayload.ptsSeconds = marker.ptsSeconds;
4788
+ if (fragmentSn !== void 0) detectPayload.detectedAtFragmentSn = fragmentSn;
4789
+ sendAdDetectTracking(this.config.licenseKey, detectPayload).catch(function() {});
4537
4790
  if (this.config.debugAdTiming) {
4538
4791
  console.log("[PREFETCH] \uD83D\uDD04 Starting ad prefetch for upcoming ad break");
4539
4792
  console.log("[PREFETCH] \uD83D\uDCCB Pre-generated ".concat(generatedUrls.length, " VAST URLs"));
@@ -4597,6 +4850,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4597
4850
  var _this, loadPromise;
4598
4851
  return _ts_generator(this, function(_state) {
4599
4852
  _this = this;
4853
+ if (this.isGamInCooldown()) {
4854
+ if (this.config.debugAdTiming) {
4855
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping preload");
4856
+ }
4857
+ return [
4858
+ 2
4859
+ ];
4860
+ }
4600
4861
  if (this.preloadPool.some(function(entry) {
4601
4862
  return entry.vastUrl === vastUrl;
4602
4863
  }) || this.failedVastUrls.has(vastUrl) || this.isUrlInCooldown(vastUrl)) {
@@ -4626,26 +4887,32 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4626
4887
  case 1:
4627
4888
  _state.trys.push([
4628
4889
  1,
4629
- 4,
4890
+ 5,
4630
4891
  ,
4631
- 5
4892
+ 6
4632
4893
  ]);
4633
4894
  continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
4634
4895
  preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
4635
4896
  preloadIma.initialize();
4636
- errorListener = function(payload) {
4897
+ errorListener = function errorListener(payload) {
4637
4898
  hasAdError = true;
4638
4899
  adErrorPayload = payload;
4639
4900
  };
4640
4901
  preloadIma.on("ad_error", errorListener);
4641
- errorListenerCleanup = function() {
4902
+ errorListenerCleanup = function errorListenerCleanup() {
4642
4903
  return preloadIma.off("ad_error", errorListener);
4643
4904
  };
4644
4905
  return [
4645
4906
  4,
4646
- preloadIma.requestAds(vastUrl)
4907
+ this.enforceGlobalRateLimit()
4647
4908
  ];
4648
4909
  case 2:
4910
+ _state.sent();
4911
+ return [
4912
+ 4,
4913
+ preloadIma.requestAds(vastUrl)
4914
+ ];
4915
+ case 3:
4649
4916
  _state.sent();
4650
4917
  preloadIma.pause();
4651
4918
  return [
@@ -4654,7 +4921,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4654
4921
  return setTimeout(resolve, 1500);
4655
4922
  })
4656
4923
  ];
4657
- case 3:
4924
+ case 4:
4658
4925
  _state.sent();
4659
4926
  preloadIma.pause();
4660
4927
  if (hasAdError) {
@@ -4663,6 +4930,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4663
4930
  errorListenerCleanup();
4664
4931
  }
4665
4932
  preloadIma.destroy();
4933
+ this.recordGamNoFill();
4666
4934
  if (isNoFill) {
4667
4935
  if (this.config.debugAdTiming) {
4668
4936
  console.log("[PRELOAD-POOL] ⚠️ Ad preload returned no-fill: ".concat(vastUrl));
@@ -4689,7 +4957,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4689
4957
  isReady: true,
4690
4958
  loadPromise: Promise.resolve()
4691
4959
  };
4692
- lateErrorListener = function(payload) {
4960
+ lateErrorListener = function lateErrorListener(payload) {
4693
4961
  var index = _this.preloadPool.findIndex(function(entry) {
4694
4962
  return entry.vastUrl === vastUrl;
4695
4963
  });
@@ -4700,7 +4968,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4700
4968
  }
4701
4969
  try {
4702
4970
  preloadIma.destroy();
4703
- } catch (e) {}
4971
+ } catch (unused) {}
4704
4972
  }
4705
4973
  };
4706
4974
  preloadIma.on("ad_error", lateErrorListener);
@@ -4713,13 +4981,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4713
4981
  }
4714
4982
  return [
4715
4983
  3,
4716
- 5
4984
+ 6
4717
4985
  ];
4718
- case 4:
4986
+ case 5:
4719
4987
  error = _state.sent();
4720
4988
  if (errorListenerCleanup) {
4721
4989
  errorListenerCleanup();
4722
4990
  }
4991
+ this.recordGamNoFill();
4723
4992
  if (this.config.debugAdTiming) {
4724
4993
  console.warn("[PRELOAD-POOL] ⚠️ Failed to preload ad: ".concat(vastUrl), error);
4725
4994
  }
@@ -4730,9 +4999,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4730
4999
  }
4731
5000
  return [
4732
5001
  3,
4733
- 5
5002
+ 6
4734
5003
  ];
4735
- case 5:
5004
+ case 6:
4736
5005
  return [
4737
5006
  2
4738
5007
  ];
@@ -4771,6 +5040,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4771
5040
  3,
4772
5041
  10
4773
5042
  ];
5043
+ if (this.isGamInCooldown()) {
5044
+ if (this.config.debugAdTiming) {
5045
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping preload pool loop");
5046
+ }
5047
+ return [
5048
+ 3,
5049
+ 10
5050
+ ];
5051
+ }
4774
5052
  if (!(!this.inAdBreak && this.preloadPool.length >= this.maxPreloadPoolSize)) return [
4775
5053
  3,
4776
5054
  3
@@ -4803,7 +5081,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4803
5081
  3,
4804
5082
  8
4805
5083
  ];
4806
- if (!this.preloadPoolActive) {
5084
+ if (!this.preloadPoolActive || this.isGamInCooldown()) {
4807
5085
  return [
4808
5086
  3,
4809
5087
  8
@@ -4984,6 +5262,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4984
5262
  firstAdUrl = preloaded.vastUrl;
4985
5263
  preloadedController = preloaded.imaController;
4986
5264
  usePreloadedAd = true;
5265
+ sendAdLoadedTracking(this.config.licenseKey, {
5266
+ source: "preload",
5267
+ vastUrl: firstAdUrl
5268
+ }, this.config.adPlayerType).catch(function() {});
4987
5269
  if (this.config.debugAdTiming) {
4988
5270
  console.log("[CONTINUOUS-FETCH] \uD83D\uDE80 Using preloaded ad from pool (preloaded in advance, ready immediately!)");
4989
5271
  console.log("[CONTINUOUS-FETCH] Pool still has ".concat(this.preloadPool.length, " preloaded ads ready"));
@@ -5019,9 +5301,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5019
5301
  case 1:
5020
5302
  _state.trys.push([
5021
5303
  1,
5022
- 7,
5304
+ 8,
5023
5305
  ,
5024
- 13
5306
+ 14
5025
5307
  ]);
5026
5308
  if (!(usePreloadedAd && preloadedController)) return [
5027
5309
  3,
@@ -5057,16 +5339,26 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5057
5339
  this.ima.setAdVolume(adVolume);
5058
5340
  return [
5059
5341
  3,
5060
- 6
5342
+ 7
5061
5343
  ];
5062
5344
  case 3:
5345
+ return [
5346
+ 4,
5347
+ this.enforceGlobalRateLimit()
5348
+ ];
5349
+ case 4:
5350
+ _state.sent();
5063
5351
  this.lastAdRequestTime = Date.now();
5064
5352
  return [
5065
5353
  4,
5066
5354
  this.ima.requestAds(firstAdUrl)
5067
5355
  ];
5068
- case 4:
5356
+ case 5:
5069
5357
  _state.sent();
5358
+ sendAdLoadedTracking(this.config.licenseKey, {
5359
+ source: "ssp",
5360
+ vastUrl: firstAdUrl
5361
+ }, this.config.adPlayerType).catch(function() {});
5070
5362
  if (this.config.debugAdTiming) {
5071
5363
  console.log("[CONTINUOUS-FETCH] \u2705 First ad request successful, starting playback");
5072
5364
  }
@@ -5080,7 +5372,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5080
5372
  4,
5081
5373
  this.ima.play()
5082
5374
  ];
5083
- case 5:
5375
+ case 6:
5084
5376
  _state.sent();
5085
5377
  if (this.expectedAdBreakDurationMs != null) {
5086
5378
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -5088,36 +5380,36 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5088
5380
  }
5089
5381
  adVolume1 = currentMuted ? 0 : currentVolume;
5090
5382
  this.ima.setAdVolume(adVolume1);
5091
- _state.label = 6;
5092
- case 6:
5383
+ _state.label = 7;
5384
+ case 7:
5093
5385
  return [
5094
5386
  3,
5095
- 13
5387
+ 14
5096
5388
  ];
5097
- case 7:
5389
+ case 8:
5098
5390
  error = _state.sent();
5099
5391
  if (this.config.debugAdTiming) {
5100
5392
  console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
5101
5393
  }
5102
5394
  if (!!usePreloadedAd) return [
5103
5395
  3,
5104
- 11
5396
+ 12
5105
5397
  ];
5106
5398
  fallbackPreloaded = this.getPreloadedAd();
5107
5399
  if (!fallbackPreloaded) return [
5108
5400
  3,
5109
- 11
5401
+ 12
5110
5402
  ];
5111
5403
  if (this.config.debugAdTiming) {
5112
5404
  console.log("[CONTINUOUS-FETCH] \uD83D\uDD04 First ad failed, using preloaded fallback");
5113
5405
  }
5114
- _state.label = 8;
5115
- case 8:
5406
+ _state.label = 9;
5407
+ case 9:
5116
5408
  _state.trys.push([
5117
- 8,
5118
- 10,
5409
+ 9,
5410
+ 11,
5119
5411
  ,
5120
- 11
5412
+ 12
5121
5413
  ]);
5122
5414
  this.ima.destroy();
5123
5415
  this.video.muted = true;
@@ -5136,7 +5428,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5136
5428
  4,
5137
5429
  this.ima.play()
5138
5430
  ];
5139
- case 9:
5431
+ case 10:
5140
5432
  _state.sent();
5141
5433
  if (this.expectedAdBreakDurationMs != null) {
5142
5434
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -5147,16 +5439,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5147
5439
  return [
5148
5440
  2
5149
5441
  ];
5150
- case 10:
5442
+ case 11:
5151
5443
  fallbackError = _state.sent();
5152
5444
  if (this.config.debugAdTiming) {
5153
5445
  console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F Preloaded fallback also failed:", fallbackError);
5154
5446
  }
5155
5447
  return [
5156
5448
  3,
5157
- 11
5449
+ 12
5158
5450
  ];
5159
- case 11:
5451
+ case 12:
5160
5452
  if (this.isTemporaryAdError(error)) {
5161
5453
  this.temporaryFailureUrls.set(firstAdUrl, Date.now());
5162
5454
  if (this.config.debugAdTiming) {
@@ -5174,13 +5466,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5174
5466
  4,
5175
5467
  this.tryNextAvailableAdWithRateLimit()
5176
5468
  ];
5177
- case 12:
5469
+ case 13:
5178
5470
  _state.sent();
5179
5471
  return [
5180
5472
  3,
5181
- 13
5473
+ 14
5182
5474
  ];
5183
- case 13:
5475
+ case 14:
5184
5476
  return [
5185
5477
  2
5186
5478
  ];
@@ -5231,6 +5523,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5231
5523
  "break"
5232
5524
  ];
5233
5525
  }
5526
+ if (_this.isGamInCooldown()) {
5527
+ if (_this.config.debugAdTiming) {
5528
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping URL generation");
5529
+ }
5530
+ return [
5531
+ 2,
5532
+ "break"
5533
+ ];
5534
+ }
5234
5535
  if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
5235
5536
  if (_this.config.debugAdTiming) {
5236
5537
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
@@ -5427,9 +5728,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5427
5728
  2
5428
5729
  ];
5429
5730
  }
5430
- if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
5731
+ if (this.isGamInCooldown()) {
5431
5732
  if (this.config.debugAdTiming) {
5432
- console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(this.consecutiveFailures, "), ending ad break"));
5733
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, ending ad break gracefully");
5734
+ }
5735
+ this.handleAdPodComplete();
5736
+ return [
5737
+ 2
5738
+ ];
5739
+ }
5740
+ if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
5741
+ if (this.config.debugAdTiming) {
5742
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(this.consecutiveFailures, "), ending ad break"));
5433
5743
  }
5434
5744
  this.handleAdPodComplete();
5435
5745
  return [
@@ -5445,6 +5755,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5445
5755
  if (this.config.debugAdTiming) {
5446
5756
  console.log("[CONTINUOUS-FETCH] \uD83C\uDFAF Using preloaded ad from pool (".concat(this.preloadPool.length, " remaining in pool)"));
5447
5757
  }
5758
+ sendAdLoadedTracking(this.config.licenseKey, {
5759
+ source: "preload",
5760
+ vastUrl: preloaded.vastUrl
5761
+ }, this.config.adPlayerType).catch(function() {});
5448
5762
  _state.label = 1;
5449
5763
  case 1:
5450
5764
  _state.trys.push([
@@ -5623,6 +5937,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5623
5937
  case 0:
5624
5938
  remaining = this.getRemainingAdMs();
5625
5939
  waitTime = Math.min(this.maxPlaceholderDurationMs, remaining);
5940
+ if (this.isGamInCooldown()) {
5941
+ if (this.config.debugAdTiming) {
5942
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping placeholder wait");
5943
+ }
5944
+ this.handleAdPodComplete();
5945
+ return [
5946
+ 2
5947
+ ];
5948
+ }
5626
5949
  if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
5627
5950
  if (this.config.debugAdTiming) {
5628
5951
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Skipping placeholder - too many consecutive failures");
@@ -5886,11 +6209,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5886
6209
  {
5887
6210
  key: "ensureAdStoppedByTimer",
5888
6211
  value: function ensureAdStoppedByTimer() {
6212
+ var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
5889
6213
  if (!this.inAdBreak) return;
5890
6214
  this.adStopTimerId = void 0;
5891
6215
  var adPlaying = this.ima.isAdPlaying();
5892
6216
  var pendingAds = this.adPodQueue.length > 0;
5893
- var _this_config_adBreakCheckIntervalMs;
5894
6217
  var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
5895
6218
  var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
5896
6219
  var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
@@ -5898,7 +6221,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5898
6221
  if (this.currentAdBreakStartWallClockMs != null) {
5899
6222
  elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
5900
6223
  }
5901
- var _this_expectedAdBreakDurationMs;
5902
6224
  var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
5903
6225
  var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
5904
6226
  var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
@@ -6012,6 +6334,73 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6012
6334
  }
6013
6335
  }
6014
6336
  },
6337
+ {
6338
+ key: "isGamInCooldown",
6339
+ value: function isGamInCooldown() {
6340
+ return Date.now() < this.globalNoFillCooldownUntil;
6341
+ }
6342
+ },
6343
+ {
6344
+ key: "recordGamNoFill",
6345
+ value: function recordGamNoFill() {
6346
+ this.globalConsecutiveNoFills++;
6347
+ if (this.globalConsecutiveNoFills >= this.globalNoFillThreshold) {
6348
+ var exponent = this.globalConsecutiveNoFills - this.globalNoFillThreshold;
6349
+ var backoff = Math.min(this.globalNoFillBackoffBaseMs * Math.pow(2, exponent), this.globalNoFillBackoffMaxMs);
6350
+ this.globalNoFillCooldownUntil = Date.now() + backoff;
6351
+ if (this.config.debugAdTiming) {
6352
+ console.log("[CIRCUIT-BREAKER] GAM cooldown activated: ".concat(backoff, "ms (").concat(this.globalConsecutiveNoFills, " consecutive no-fills)"));
6353
+ }
6354
+ }
6355
+ }
6356
+ },
6357
+ {
6358
+ key: "resetGamNoFillCounter",
6359
+ value: function resetGamNoFillCounter() {
6360
+ if (this.globalConsecutiveNoFills > 0 && this.config.debugAdTiming) {
6361
+ console.log("[CIRCUIT-BREAKER] Resetting no-fill counter (was ".concat(this.globalConsecutiveNoFills, ")"));
6362
+ }
6363
+ this.globalConsecutiveNoFills = 0;
6364
+ this.globalNoFillCooldownUntil = 0;
6365
+ }
6366
+ },
6367
+ {
6368
+ key: "enforceGlobalRateLimit",
6369
+ value: function enforceGlobalRateLimit() {
6370
+ return _async_to_generator(function() {
6371
+ var now, elapsed, waitMs;
6372
+ return _ts_generator(this, function(_state) {
6373
+ switch(_state.label){
6374
+ case 0:
6375
+ now = Date.now();
6376
+ elapsed = now - this.globalLastGamRequestTime;
6377
+ if (!(elapsed < this.globalMinGamIntervalMs)) return [
6378
+ 3,
6379
+ 2
6380
+ ];
6381
+ waitMs = this.globalMinGamIntervalMs - elapsed;
6382
+ if (this.config.debugAdTiming) {
6383
+ console.log("[RATE-LIMIT] Waiting ".concat(waitMs, "ms before next GAM request"));
6384
+ }
6385
+ return [
6386
+ 4,
6387
+ new Promise(function(resolve) {
6388
+ return setTimeout(resolve, waitMs);
6389
+ })
6390
+ ];
6391
+ case 1:
6392
+ _state.sent();
6393
+ _state.label = 2;
6394
+ case 2:
6395
+ this.globalLastGamRequestTime = Date.now();
6396
+ return [
6397
+ 2
6398
+ ];
6399
+ }
6400
+ });
6401
+ }).call(this);
6402
+ }
6403
+ },
6015
6404
  {
6016
6405
  key: "playSingleAd",
6017
6406
  value: function playSingleAd(vastTagUrl) {
@@ -6043,6 +6432,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6043
6432
  }
6044
6433
  throw new Error("Too many consecutive failures");
6045
6434
  }
6435
+ if (this.isGamInCooldown()) {
6436
+ if (this.config.debugAdTiming) {
6437
+ console.warn("[CIRCUIT-BREAKER] GAM in cooldown, skipping ad request");
6438
+ }
6439
+ throw new Error("GAM in cooldown");
6440
+ }
6046
6441
  this.recreateImaController();
6047
6442
  requestToken = ++this.adRequestTokenCounter;
6048
6443
  this.activeAdRequestToken = requestToken;
@@ -6051,37 +6446,47 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6051
6446
  case 1:
6052
6447
  _state.trys.push([
6053
6448
  1,
6054
- 11,
6449
+ 12,
6055
6450
  ,
6056
- 16
6451
+ 17
6057
6452
  ]);
6453
+ return [
6454
+ 4,
6455
+ this.enforceGlobalRateLimit()
6456
+ ];
6457
+ case 2:
6458
+ _state.sent();
6058
6459
  this.lastAdRequestTime = Date.now();
6059
6460
  return [
6060
6461
  4,
6061
6462
  this.ima.requestAds(vastTagUrl)
6062
6463
  ];
6063
- case 2:
6464
+ case 3:
6064
6465
  _state.sent();
6466
+ sendAdLoadedTracking(this.config.licenseKey, {
6467
+ source: "ssp",
6468
+ vastUrl: vastTagUrl
6469
+ }, this.config.adPlayerType).catch(function() {});
6065
6470
  this.clearAdRequestWatchdog();
6066
6471
  if (this.activeAdRequestToken !== requestToken) {
6067
6472
  return [
6068
6473
  2
6069
6474
  ];
6070
6475
  }
6071
- _state.label = 3;
6072
- case 3:
6476
+ _state.label = 4;
6477
+ case 4:
6073
6478
  _state.trys.push([
6074
- 3,
6075
- 5,
6479
+ 4,
6480
+ 6,
6076
6481
  ,
6077
- 10
6482
+ 11
6078
6483
  ]);
6079
6484
  this.startAdFailsafeTimer(requestToken);
6080
6485
  return [
6081
6486
  4,
6082
6487
  this.ima.play()
6083
6488
  ];
6084
- case 4:
6489
+ case 5:
6085
6490
  _state.sent();
6086
6491
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6087
6492
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -6095,9 +6500,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6095
6500
  this.temporaryFailureUrls.delete(vastTagUrl);
6096
6501
  return [
6097
6502
  3,
6098
- 10
6503
+ 11
6099
6504
  ];
6100
- case 5:
6505
+ case 6:
6101
6506
  playError = _state.sent();
6102
6507
  if (this.config.debugAdTiming) {
6103
6508
  console.error("[AD-ERROR] Failed to play ad:", playError);
@@ -6105,18 +6510,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6105
6510
  preloadedFallback = this.getPreloadedAd();
6106
6511
  if (!preloadedFallback) return [
6107
6512
  3,
6108
- 9
6513
+ 10
6109
6514
  ];
6110
6515
  if (this.config.debugAdTiming) {
6111
6516
  console.log("[AD-ERROR] Play failed, trying preloaded fallback ad");
6112
6517
  }
6113
- _state.label = 6;
6114
- case 6:
6518
+ _state.label = 7;
6519
+ case 7:
6115
6520
  _state.trys.push([
6116
- 6,
6117
- 8,
6521
+ 7,
6522
+ 9,
6118
6523
  ,
6119
- 9
6524
+ 10
6120
6525
  ]);
6121
6526
  this.clearAdFailsafeTimer();
6122
6527
  this.ima.destroy();
@@ -6132,7 +6537,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6132
6537
  4,
6133
6538
  this.ima.play()
6134
6539
  ];
6135
- case 7:
6540
+ case 8:
6136
6541
  _state.sent();
6137
6542
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6138
6543
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -6145,16 +6550,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6145
6550
  return [
6146
6551
  2
6147
6552
  ];
6148
- case 8:
6553
+ case 9:
6149
6554
  fallbackError = _state.sent();
6150
6555
  if (this.config.debugAdTiming) {
6151
6556
  console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError);
6152
6557
  }
6153
6558
  return [
6154
6559
  3,
6155
- 9
6560
+ 10
6156
6561
  ];
6157
- case 9:
6562
+ case 10:
6158
6563
  if (this.isTemporaryAdError(playError)) {
6159
6564
  this.temporaryFailureUrls.set(vastTagUrl, Date.now());
6160
6565
  if (this.config.debugAdTiming) {
@@ -6171,12 +6576,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6171
6576
  this.activeAdRequestToken = null;
6172
6577
  }
6173
6578
  throw playError;
6174
- case 10:
6579
+ case 11:
6175
6580
  return [
6176
6581
  3,
6177
- 16
6582
+ 17
6178
6583
  ];
6179
- case 11:
6584
+ case 12:
6180
6585
  error = _state.sent();
6181
6586
  errorMessage = (error === null || error === void 0 ? void 0 : error.message) || "";
6182
6587
  if (this.config.debugAdTiming) {
@@ -6185,18 +6590,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6185
6590
  preloadedFallback1 = this.getPreloadedAd();
6186
6591
  if (!preloadedFallback1) return [
6187
6592
  3,
6188
- 15
6593
+ 16
6189
6594
  ];
6190
6595
  if (this.config.debugAdTiming) {
6191
6596
  console.log("[AD-ERROR] Request failed, trying preloaded fallback ad");
6192
6597
  }
6193
- _state.label = 12;
6194
- case 12:
6598
+ _state.label = 13;
6599
+ case 13:
6195
6600
  _state.trys.push([
6196
- 12,
6197
- 14,
6601
+ 13,
6602
+ 15,
6198
6603
  ,
6199
- 15
6604
+ 16
6200
6605
  ]);
6201
6606
  this.clearAdRequestWatchdog();
6202
6607
  this.clearAdFailsafeTimer();
@@ -6213,7 +6618,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6213
6618
  4,
6214
6619
  this.ima.play()
6215
6620
  ];
6216
- case 13:
6621
+ case 14:
6217
6622
  _state.sent();
6218
6623
  currentMuted2 = this.video.muted;
6219
6624
  currentVolume2 = this.video.volume;
@@ -6222,16 +6627,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6222
6627
  return [
6223
6628
  2
6224
6629
  ];
6225
- case 14:
6630
+ case 15:
6226
6631
  fallbackError1 = _state.sent();
6227
6632
  if (this.config.debugAdTiming) {
6228
6633
  console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError1);
6229
6634
  }
6230
6635
  return [
6231
6636
  3,
6232
- 15
6637
+ 16
6233
6638
  ];
6234
- case 15:
6639
+ case 16:
6235
6640
  if (this.isTemporaryAdError(error)) {
6236
6641
  this.temporaryFailureUrls.set(vastTagUrl, Date.now());
6237
6642
  if (this.config.debugAdTiming) {
@@ -6249,7 +6654,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6249
6654
  this.activeAdRequestToken = null;
6250
6655
  }
6251
6656
  throw error;
6252
- case 16:
6657
+ case 17:
6253
6658
  return [
6254
6659
  2
6255
6660
  ];
@@ -6276,6 +6681,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6276
6681
  }
6277
6682
  this.adRequestQueue = [];
6278
6683
  this.inAdBreak = false;
6684
+ this.adDetectSentForCurrentBreak = false;
6279
6685
  this.expectedAdBreakDurationMs = void 0;
6280
6686
  this.currentAdBreakStartWallClockMs = void 0;
6281
6687
  this.clearAdStartTimer();
@@ -6285,6 +6691,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6285
6691
  this.currentAdIndex = 0;
6286
6692
  this.totalAdsInBreak = 0;
6287
6693
  this.consecutiveFailures = 0;
6694
+ this.globalConsecutiveNoFills = 0;
6288
6695
  this.ima.stop().catch(function() {});
6289
6696
  var restoredMuted = this.ima.getOriginalMutedState();
6290
6697
  var restoredVolume = this.ima.getOriginalVolume();
@@ -6316,6 +6723,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6316
6723
  key: "handleAdFailure",
6317
6724
  value: function handleAdFailure() {
6318
6725
  this.consecutiveFailures++;
6726
+ this.recordGamNoFill();
6319
6727
  var remaining = this.getRemainingAdMs();
6320
6728
  if (this.config.debugAdTiming) {
6321
6729
  console.log("[CONTINUOUS-FETCH] Ad failure: remaining=".concat(remaining, "ms, queued ads=").concat(this.adRequestQueue.length, ", consecutiveFailures=").concat(this.consecutiveFailures), this.adRequestQueue.length > 0 ? {
@@ -6343,8 +6751,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6343
6751
  key: "startAdRequestWatchdog",
6344
6752
  value: function startAdRequestWatchdog(token) {
6345
6753
  var _this = this;
6346
- this.clearAdRequestWatchdog();
6347
6754
  var _this_config_adFailsafeTimeoutMs;
6755
+ this.clearAdRequestWatchdog();
6348
6756
  var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
6349
6757
  this.adRequestWatchdogToken = token;
6350
6758
  this.adRequestWatchdogId = window.setTimeout(function() {
@@ -6387,8 +6795,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6387
6795
  key: "startAdFailsafeTimer",
6388
6796
  value: function startAdFailsafeTimer(token) {
6389
6797
  var _this = this;
6390
- this.clearAdFailsafeTimer();
6391
6798
  var _this_config_adFailsafeTimeoutMs;
6799
+ this.clearAdFailsafeTimer();
6392
6800
  var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
6393
6801
  this.adFailsafeToken = token;
6394
6802
  this.adFailsafeTimerId = window.setTimeout(function() {
@@ -6713,6 +7121,7 @@ var CRITICAL_PROPS = [
6713
7121
  "driftToleranceMs",
6714
7122
  "vastMode"
6715
7123
  ];
7124
+ var CONTROLS_HIDE_DELAY = 3e3;
6716
7125
  var StormcloudVideoPlayerComponent = React.memo(function(props) {
6717
7126
  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, vastMode = props.vastMode, vastTagUrl = props.vastTagUrl, adPlayerType = props.adPlayerType, minSegmentsBeforePlay = props.minSegmentsBeforePlay, restVideoAttrs = _object_without_properties(props, [
6718
7127
  "src",
@@ -6747,6 +7156,8 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6747
7156
  var videoRef = useRef(null);
6748
7157
  var playerRef = useRef(null);
6749
7158
  var bufferingTimeoutRef = useRef(null);
7159
+ var controlsTimerRef = useRef(null);
7160
+ var wrapperRef = useRef(null);
6750
7161
  var _React_useState = _sliced_to_array(React.useState({
6751
7162
  showAds: false,
6752
7163
  currentIndex: 0,
@@ -6766,23 +7177,51 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6766
7177
  var _React_useState12 = _sliced_to_array(React.useState(false), 2), isBuffering = _React_useState12[0], setIsBuffering = _React_useState12[1];
6767
7178
  var _React_useState13 = _sliced_to_array(React.useState(false), 2), showCenterPlay = _React_useState13[0], setShowCenterPlay = _React_useState13[1];
6768
7179
  var _React_useState14 = _sliced_to_array(React.useState(false), 2), showLicenseWarning = _React_useState14[0], setShowLicenseWarning = _React_useState14[1];
6769
- var _React_useState15 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerWidth : 1920), 2), viewportWidth = _React_useState15[0], setViewportWidth = _React_useState15[1];
6770
- var _React_useState16 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerHeight > window.innerWidth : false), 2), isPortrait = _React_useState16[0], setIsPortrait = _React_useState16[1];
6771
- var getResponsiveScale = function() {
7180
+ var _React_useState15 = _sliced_to_array(React.useState(true), 2), controlsVisible = _React_useState15[0], setControlsVisible = _React_useState15[1];
7181
+ var _React_useState16 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerWidth : 1920), 2), viewportWidth = _React_useState16[0], setViewportWidth = _React_useState16[1];
7182
+ var _React_useState17 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerHeight > window.innerWidth : false), 2), isPortrait = _React_useState17[0], setIsPortrait = _React_useState17[1];
7183
+ var getResponsiveScale = function getResponsiveScale() {
6772
7184
  if (viewportWidth < 480) return 0.7;
6773
7185
  if (viewportWidth < 768) return 0.8;
6774
7186
  if (viewportWidth < 1024) return 0.9;
6775
7187
  return 1;
6776
7188
  };
6777
7189
  var responsiveScale = getResponsiveScale();
6778
- var formatTime = function(seconds) {
7190
+ var resetControlsTimer = useCallback(function() {
7191
+ if (controlsTimerRef.current) {
7192
+ clearTimeout(controlsTimerRef.current);
7193
+ }
7194
+ setControlsVisible(true);
7195
+ controlsTimerRef.current = window.setTimeout(function() {
7196
+ if (!showVolumeSlider && !showSpeedMenu) {
7197
+ setControlsVisible(false);
7198
+ }
7199
+ }, CONTROLS_HIDE_DELAY);
7200
+ }, [
7201
+ showVolumeSlider,
7202
+ showSpeedMenu
7203
+ ]);
7204
+ var handleWrapperMouseMove = useCallback(function() {
7205
+ resetControlsTimer();
7206
+ }, [
7207
+ resetControlsTimer
7208
+ ]);
7209
+ var handleWrapperMouseLeave = useCallback(function() {
7210
+ if (!showVolumeSlider && !showSpeedMenu) {
7211
+ setControlsVisible(false);
7212
+ }
7213
+ }, [
7214
+ showVolumeSlider,
7215
+ showSpeedMenu
7216
+ ]);
7217
+ var formatTime = function formatTime(seconds) {
6779
7218
  if (!isFinite(seconds)) return "0:00:00";
6780
7219
  var hours = Math.floor(seconds / 3600);
6781
7220
  var minutes = Math.floor(seconds % 3600 / 60);
6782
7221
  var remainingSeconds = Math.floor(seconds % 60);
6783
7222
  return "".concat(hours, ":").concat(minutes.toString().padStart(2, "0"), ":").concat(remainingSeconds.toString().padStart(2, "0"));
6784
7223
  };
6785
- var handlePlayPause = function() {
7224
+ var handlePlayPause = function handlePlayPause() {
6786
7225
  if (videoRef.current) {
6787
7226
  if (videoRef.current.paused) {
6788
7227
  var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
@@ -6800,8 +7239,9 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6800
7239
  setShowCenterPlay(true);
6801
7240
  }
6802
7241
  }
7242
+ resetControlsTimer();
6803
7243
  };
6804
- var handleCenterPlayClick = function() {
7244
+ var handleCenterPlayClick = function handleCenterPlayClick() {
6805
7245
  if (videoRef.current && videoRef.current.paused) {
6806
7246
  var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
6807
7247
  if (hasValidSource) {
@@ -6815,7 +7255,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6815
7255
  }
6816
7256
  }
6817
7257
  };
6818
- var handleTimelineSeek = function(e) {
7258
+ var handleTimelineSeek = function handleTimelineSeek(e) {
6819
7259
  if (videoRef.current && duration > 0 && isFinite(duration)) {
6820
7260
  var rect = e.currentTarget.getBoundingClientRect();
6821
7261
  var clickX = e.clientX - rect.left;
@@ -6825,14 +7265,15 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6825
7265
  videoRef.current.currentTime = newTime;
6826
7266
  }
6827
7267
  }
7268
+ resetControlsTimer();
6828
7269
  };
6829
- var handleVolumeChange = function(newVolume) {
7270
+ var handleVolumeChange = function handleVolumeChange(newVolume) {
6830
7271
  if (playerRef.current && isFinite(newVolume)) {
6831
7272
  var clampedVolume = Math.max(0, Math.min(1, newVolume));
6832
7273
  playerRef.current.setVolume(clampedVolume);
6833
7274
  }
6834
7275
  };
6835
- var handlePlaybackRateChange = function(rate) {
7276
+ var handlePlaybackRateChange = function handlePlaybackRateChange(rate) {
6836
7277
  if (videoRef.current && isFinite(rate) && rate > 0) {
6837
7278
  videoRef.current.playbackRate = rate;
6838
7279
  }
@@ -6869,7 +7310,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6869
7310
  if (playerRef.current) {
6870
7311
  try {
6871
7312
  playerRef.current.destroy();
6872
- } catch (e) {}
7313
+ } catch (unused) {}
6873
7314
  playerRef.current = null;
6874
7315
  }
6875
7316
  var cfg = {
@@ -6909,7 +7350,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6909
7350
  return function() {
6910
7351
  try {
6911
7352
  player.destroy();
6912
- } catch (e) {}
7353
+ } catch (unused) {}
6913
7354
  playerRef.current = null;
6914
7355
  };
6915
7356
  }, [
@@ -6933,7 +7374,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6933
7374
  ]);
6934
7375
  useEffect(function() {
6935
7376
  if (!playerRef.current) return;
6936
- var checkAdStatus = function() {
7377
+ var checkAdStatus = function checkAdStatus() {
6937
7378
  if (playerRef.current) {
6938
7379
  var _videoRef_current_dataset, _videoRef_current;
6939
7380
  var showAdsFromMethod = playerRef.current.isShowingAds();
@@ -6963,7 +7404,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6963
7404
  }, []);
6964
7405
  useEffect(function() {
6965
7406
  if (typeof window === "undefined" || !playerRef.current) return;
6966
- var handleResize = function() {
7407
+ var handleResize = function handleResize() {
6967
7408
  if (playerRef.current && videoRef.current) {
6968
7409
  if (typeof playerRef.current.resize === "function") {
6969
7410
  playerRef.current.resize();
@@ -6979,8 +7420,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6979
7420
  }, []);
6980
7421
  useEffect(function() {
6981
7422
  if (!playerRef.current || !videoRef.current) return;
6982
- var updateStates = function() {
6983
- var _videoRef_current;
7423
+ var updateStates = function updateStates() {
6984
7424
  if (playerRef.current && videoRef.current) {
6985
7425
  setIsMuted(playerRef.current.isMuted());
6986
7426
  setIsPlaying(!videoRef.current.paused);
@@ -6993,12 +7433,11 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6993
7433
  var rateValue = videoRef.current.playbackRate;
6994
7434
  setPlaybackRate(isFinite(rateValue) && rateValue > 0 ? rateValue : 1);
6995
7435
  }
6996
- setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
7436
+ setIsFullscreen(document.fullscreenElement === wrapperRef.current);
6997
7437
  };
6998
7438
  var interval = setInterval(updateStates, 200);
6999
- var handleFullscreenChange = function() {
7000
- var _videoRef_current;
7001
- setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
7439
+ var handleFullscreenChange = function handleFullscreenChange() {
7440
+ setIsFullscreen(document.fullscreenElement === wrapperRef.current);
7002
7441
  };
7003
7442
  document.addEventListener("fullscreenchange", handleFullscreenChange);
7004
7443
  return function() {
@@ -7008,7 +7447,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7008
7447
  }, []);
7009
7448
  useEffect(function() {
7010
7449
  if (!videoRef.current) return;
7011
- var handleLoadedMetadata = function() {
7450
+ var handleLoadedMetadata = function handleLoadedMetadata() {
7012
7451
  if (videoRef.current) {
7013
7452
  var video2 = videoRef.current;
7014
7453
  void video2.offsetHeight;
@@ -7018,19 +7457,19 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7018
7457
  console.log("[StormcloudUI] Video event: loadedmetadata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7019
7458
  }
7020
7459
  };
7021
- var handleLoadedData = function() {
7460
+ var handleLoadedData = function handleLoadedData() {
7022
7461
  if (debugAdTiming) {
7023
7462
  var _videoRef_current;
7024
7463
  console.log("[StormcloudUI] Video event: loadeddata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7025
7464
  }
7026
7465
  };
7027
- var handleLoadStart = function() {
7466
+ var handleLoadStart = function handleLoadStart() {
7028
7467
  if (debugAdTiming) {
7029
7468
  var _videoRef_current;
7030
7469
  console.log("[StormcloudUI] Video event: loadstart, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7031
7470
  }
7032
7471
  };
7033
- var handleCanPlay = function() {
7472
+ var handleCanPlay = function handleCanPlay() {
7034
7473
  setIsLoading(false);
7035
7474
  if (bufferingTimeoutRef.current) {
7036
7475
  clearTimeout(bufferingTimeoutRef.current);
@@ -7042,7 +7481,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7042
7481
  console.log("[StormcloudUI] Video event: canplay, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- clearing loading state, isLoading=false");
7043
7482
  }
7044
7483
  };
7045
- var handleCanPlayThrough = function() {
7484
+ var handleCanPlayThrough = function handleCanPlayThrough() {
7046
7485
  setIsLoading(false);
7047
7486
  if (bufferingTimeoutRef.current) {
7048
7487
  clearTimeout(bufferingTimeoutRef.current);
@@ -7054,7 +7493,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7054
7493
  console.log("[StormcloudUI] Video event: canplaythrough, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- clearing loading state, isLoading=false");
7055
7494
  }
7056
7495
  };
7057
- var handleWaiting = function() {
7496
+ var handleWaiting = function handleWaiting() {
7058
7497
  if (bufferingTimeoutRef.current) {
7059
7498
  clearTimeout(bufferingTimeoutRef.current);
7060
7499
  }
@@ -7070,7 +7509,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7070
7509
  console.log("[StormcloudUI] Video event: waiting, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- buffering delay started (300ms)");
7071
7510
  }
7072
7511
  };
7073
- var handlePlaying = function() {
7512
+ var handlePlaying = function handlePlaying() {
7074
7513
  setIsLoading(false);
7075
7514
  if (bufferingTimeoutRef.current) {
7076
7515
  clearTimeout(bufferingTimeoutRef.current);
@@ -7083,7 +7522,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7083
7522
  console.log("[StormcloudUI] Video event: playing, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- playback started, isLoading=false, isBuffering=false");
7084
7523
  }
7085
7524
  };
7086
- var handlePause = function() {
7525
+ var handlePause = function handlePause() {
7087
7526
  var _playerRef_current, _videoRef_current_dataset, _videoRef_current;
7088
7527
  var isAdActive = ((_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.isShowingAds()) || ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : (_videoRef_current_dataset = _videoRef_current.dataset) === null || _videoRef_current_dataset === void 0 ? void 0 : _videoRef_current_dataset.stormcloudAdPlaying) === "true";
7089
7528
  if (playerRef.current && !isAdActive) {
@@ -7092,7 +7531,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7092
7531
  setShowCenterPlay(false);
7093
7532
  }
7094
7533
  };
7095
- var handleEnded = function() {
7534
+ var handleEnded = function handleEnded() {
7096
7535
  setShowCenterPlay(true);
7097
7536
  };
7098
7537
  var video = videoRef.current;
@@ -7126,13 +7565,25 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7126
7565
  }, [
7127
7566
  debugAdTiming
7128
7567
  ]);
7568
+ useEffect(function() {
7569
+ return function() {
7570
+ if (controlsTimerRef.current) {
7571
+ clearTimeout(controlsTimerRef.current);
7572
+ }
7573
+ };
7574
+ }, []);
7575
+ var progressPercent = duration > 0 ? currentTime / duration * 100 : 0;
7576
+ var VolumeIcon = isMuted || volume === 0 ? FaVolumeMute : volume < 0.5 ? FaVolumeDown : FaVolumeUp;
7129
7577
  return /* @__PURE__ */ jsxs(Fragment, {
7130
7578
  children: [
7131
7579
  /* @__PURE__ */ jsx("style", {
7132
- children: "\n @keyframes spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n }\n \n .stormcloud-loading-hidden .stormcloud-loading-indicator {\n display: none !important;\n }\n \n .stormcloud-video-wrapper:fullscreen {\n border-radius: 0 !important;\n box-shadow: none !important;\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw !important;\n max-height: 100vh !important;\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n z-index: 999999 !important;\n background: #000 !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n }\n \n .stormcloud-video-wrapper:has(*:fullscreen) {\n border-radius: 0 !important;\n box-shadow: none !important;\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw !important;\n max-height: 100vh !important;\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n z-index: 999999 !important;\n background: #000 !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n }\n \n *:fullscreen {\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw !important;\n max-height: 100vh !important;\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n z-index: 999999 !important;\n background: #000 !important;\n }\n "
7580
+ children: "\n @keyframes sc-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n @keyframes sc-pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.6; }\n }\n @keyframes sc-fade-in {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n }\n .sc-wrapper:fullscreen,\n .sc-wrapper:has(*:fullscreen) {\n border-radius: 0 !important;\n box-shadow: none !important;\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw !important;\n max-height: 100vh !important;\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n z-index: 999999 !important;\n background: #000 !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n }\n .sc-ctrl-btn {\n background: none;\n border: none;\n color: #fff;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n padding: 8px;\n transition: background 0.15s ease, opacity 0.15s ease;\n opacity: 0.9;\n }\n .sc-ctrl-btn:hover {\n opacity: 1;\n background: rgba(255, 255, 255, 0.1);\n }\n .sc-ctrl-btn:active {\n opacity: 0.7;\n }\n .sc-controls-bar {\n transition: opacity 0.35s ease, transform 0.35s ease;\n }\n .sc-progress-track:hover .sc-progress-thumb {\n transform: translate(-50%, -50%) scale(1) !important;\n }\n .sc-loading-hidden .sc-loading-indicator {\n display: none !important;\n }\n "
7133
7581
  }),
7134
7582
  /* @__PURE__ */ jsxs("div", {
7135
- className: "stormcloud-video-wrapper ".concat(wrapperClassName || ""),
7583
+ ref: wrapperRef,
7584
+ className: "sc-wrapper ".concat(wrapperClassName || ""),
7585
+ onMouseMove: handleWrapperMouseMove,
7586
+ onMouseLeave: handleWrapperMouseLeave,
7136
7587
  style: _object_spread({
7137
7588
  display: "flex",
7138
7589
  alignItems: "center",
@@ -7147,7 +7598,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7147
7598
  maxWidth: isFullscreen ? "100vw" : "100%",
7148
7599
  maxHeight: isFullscreen ? "100vh" : "none",
7149
7600
  zIndex: isFullscreen ? 999999 : void 0,
7150
- backgroundColor: isFullscreen ? "#000" : void 0,
7601
+ backgroundColor: "#000",
7151
7602
  borderRadius: isFullscreen ? 0 : void 0,
7152
7603
  boxShadow: isFullscreen ? "none" : void 0
7153
7604
  }, wrapperStyle),
@@ -7173,16 +7624,16 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7173
7624
  children: children
7174
7625
  })),
7175
7626
  (isLoading || isBuffering) && !hideLoadingIndicator && /* @__PURE__ */ jsx(FaSpinner, {
7176
- className: "stormcloud-loading-indicator",
7177
- size: 42,
7178
- color: "white",
7627
+ className: "sc-loading-indicator",
7628
+ size: 40,
7629
+ color: "rgba(255, 255, 255, 0.85)",
7179
7630
  style: {
7180
7631
  position: "absolute",
7181
- top: "calc(50% - 21px)",
7182
- left: "calc(50% - 21px)",
7632
+ top: "calc(50% - 20px)",
7633
+ left: "calc(50% - 20px)",
7183
7634
  zIndex: 20,
7184
- animation: "spin 1s linear infinite",
7185
- filter: "drop-shadow(0 3px 6px rgba(0, 0, 0, 0.8))"
7635
+ animation: "sc-spin 0.9s linear infinite",
7636
+ filter: "drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6))"
7186
7637
  }
7187
7638
  }),
7188
7639
  showLicenseWarning && /* @__PURE__ */ jsxs("div", {
@@ -7192,13 +7643,13 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7192
7643
  left: "50%",
7193
7644
  transform: "translate(-50%, -50%)",
7194
7645
  zIndex: 25,
7195
- background: "linear-gradient(135deg, rgba(220, 38, 38, 0.95) 0%, rgba(185, 28, 28, 0.9) 100%)",
7646
+ background: "rgba(220, 38, 38, 0.92)",
7647
+ backdropFilter: "blur(24px)",
7196
7648
  color: "white",
7197
- padding: "24px 32px",
7198
- borderRadius: "16px",
7199
- backdropFilter: "blur(20px)",
7200
- border: "2px solid rgba(255, 255, 255, 0.2)",
7201
- boxShadow: "0 20px 60px rgba(0, 0, 0, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.2)",
7649
+ padding: "28px 36px",
7650
+ borderRadius: "14px",
7651
+ border: "1px solid rgba(255, 255, 255, 0.15)",
7652
+ boxShadow: "0 24px 64px rgba(0, 0, 0, 0.5)",
7202
7653
  textAlign: "center",
7203
7654
  maxWidth: "400px",
7204
7655
  margin: "0 16px"
@@ -7206,20 +7657,18 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7206
7657
  children: [
7207
7658
  /* @__PURE__ */ jsx("div", {
7208
7659
  style: {
7209
- fontSize: "20px",
7210
- fontWeight: "bold",
7211
- marginBottom: "12px",
7212
- color: "#ffffff",
7213
- textShadow: "0 2px 4px rgba(0, 0, 0, 0.5)"
7660
+ fontSize: "18px",
7661
+ fontWeight: "700",
7662
+ marginBottom: "10px",
7663
+ letterSpacing: "-0.02em"
7214
7664
  },
7215
7665
  children: "License Key Required"
7216
7666
  }),
7217
7667
  /* @__PURE__ */ jsxs("div", {
7218
7668
  style: {
7219
- fontSize: "14px",
7220
- lineHeight: "1.5",
7221
- color: "rgba(255, 255, 255, 0.9)",
7222
- textShadow: "0 1px 2px rgba(0, 0, 0, 0.3)"
7669
+ fontSize: "13px",
7670
+ lineHeight: "1.6",
7671
+ color: "rgba(255, 255, 255, 0.85)"
7223
7672
  },
7224
7673
  children: [
7225
7674
  "Please provide a valid license key to use the Stormcloud Video Player.",
@@ -7238,836 +7687,550 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7238
7687
  transform: "translate(-50%, -50%)",
7239
7688
  zIndex: 15,
7240
7689
  cursor: "pointer",
7241
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.8) 100%)",
7690
+ background: "rgba(0, 0, 0, 0.55)",
7691
+ backdropFilter: "blur(8px)",
7242
7692
  borderRadius: "50%",
7243
- width: "100px",
7244
- height: "100px",
7693
+ width: "".concat(92 * responsiveScale, "px"),
7694
+ height: "".concat(92 * responsiveScale, "px"),
7245
7695
  display: "flex",
7246
7696
  alignItems: "center",
7247
7697
  justifyContent: "center",
7248
- backdropFilter: "blur(20px)",
7249
- border: "3px solid rgba(255, 255, 255, 0.8)",
7250
- boxShadow: "0 12px 40px rgba(0, 0, 0, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.3)",
7251
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
7698
+ transition: "background 0.2s ease, transform 0.2s ease",
7699
+ animation: "sc-fade-in 0.2s ease"
7252
7700
  },
7253
- onMouseEnter: function(e) {
7254
- var target = e.currentTarget;
7255
- target.style.transform = "translate(-50%, -50%)";
7256
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(40, 40, 40, 0.9) 100%)";
7257
- target.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.9), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
7258
- target.style.borderColor = "rgba(255, 255, 255, 0.9)";
7701
+ onMouseEnter: function onMouseEnter(e) {
7702
+ e.currentTarget.style.background = "rgba(0, 0, 0, 0.72)";
7703
+ e.currentTarget.style.transform = "translate(-50%, -50%) scale(1.06)";
7259
7704
  },
7260
- onMouseLeave: function(e) {
7261
- var target = e.currentTarget;
7262
- target.style.transform = "translate(-50%, -50%)";
7263
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.8) 100%)";
7264
- target.style.boxShadow = "0 12px 40px rgba(0, 0, 0, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.3)";
7265
- target.style.borderColor = "rgba(255, 255, 255, 0.8)";
7705
+ onMouseLeave: function onMouseLeave(e) {
7706
+ e.currentTarget.style.background = "rgba(0, 0, 0, 0.55)";
7707
+ e.currentTarget.style.transform = "translate(-50%, -50%) scale(1)";
7266
7708
  },
7267
7709
  title: "Play",
7268
7710
  children: /* @__PURE__ */ jsx(FaPlay, {
7269
- size: 36,
7711
+ size: Math.max(24, 32 * responsiveScale),
7270
7712
  color: "white",
7271
7713
  style: {
7272
- marginLeft: "6px",
7273
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))"
7714
+ marginLeft: "4px"
7274
7715
  }
7275
7716
  })
7276
7717
  }),
7277
- shouldShowEnhancedControls && !showLicenseWarning ? /* @__PURE__ */ jsx(Fragment, {
7278
- children: /* @__PURE__ */ jsxs("div", {
7279
- style: {
7280
- position: "absolute",
7281
- bottom: 0,
7282
- left: 0,
7283
- right: 0,
7284
- background: "linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%)",
7285
- padding: "20px 16px 16px",
7286
- zIndex: 10
7287
- },
7288
- children: [
7289
- /* @__PURE__ */ jsxs("div", {
7290
- style: {
7291
- width: "100%",
7292
- height: "8px",
7293
- background: "linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%)",
7294
- borderRadius: "8px",
7295
- marginBottom: "16px",
7296
- cursor: "pointer",
7297
- position: "relative",
7298
- backdropFilter: "blur(5px)",
7299
- border: "1px solid rgba(255, 255, 255, 0.1)",
7300
- boxShadow: "inset 0 2px 4px rgba(0, 0, 0, 0.2)"
7301
- },
7302
- onClick: handleTimelineSeek,
7303
- children: [
7304
- /* @__PURE__ */ jsx("div", {
7305
- style: {
7306
- height: "100%",
7307
- background: "linear-gradient(90deg, rgba(139, 92, 246, 0.9) 0%, rgba(59, 130, 246, 0.8) 50%, rgba(34, 197, 94, 0.9) 100%)",
7308
- borderRadius: "8px",
7309
- width: "".concat(duration > 0 ? currentTime / duration * 100 : 0, "%"),
7310
- transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
7311
- boxShadow: "0 2px 8px rgba(139, 92, 246, 0.4)"
7312
- }
7313
- }),
7314
- /* @__PURE__ */ jsx("div", {
7315
- style: {
7316
- position: "absolute",
7317
- top: "-6px",
7318
- right: "".concat(duration > 0 ? 100 - currentTime / duration * 100 : 100, "%"),
7319
- width: "20px",
7320
- height: "20px",
7321
- background: "linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 240, 240, 0.9) 100%)",
7322
- borderRadius: "50%",
7323
- border: "3px solid rgba(139, 92, 246, 0.8)",
7324
- boxShadow: "0 4px 16px rgba(139, 92, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.8)",
7325
- transform: "translateX(50%)",
7326
- transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)"
7327
- }
7328
- })
7329
- ]
7330
- }),
7331
- /* @__PURE__ */ jsxs("div", {
7332
- style: {
7333
- display: "flex",
7334
- alignItems: "center",
7335
- justifyContent: "space-between",
7336
- color: "white",
7337
- flexWrap: viewportWidth < 768 ? "wrap" : "nowrap",
7338
- gap: "".concat(8 * responsiveScale, "px")
7339
- },
7340
- children: [
7341
- /* @__PURE__ */ jsxs("div", {
7342
- style: {
7343
- display: "flex",
7344
- alignItems: "center",
7345
- gap: "".concat(12 * responsiveScale, "px"),
7346
- flexWrap: viewportWidth < 480 ? "wrap" : "nowrap"
7347
- },
7348
- children: [
7349
- /* @__PURE__ */ jsx("button", {
7350
- onClick: handlePlayPause,
7718
+ shouldShowEnhancedControls && !showLicenseWarning ? /* @__PURE__ */ jsxs("div", {
7719
+ className: "sc-controls-bar",
7720
+ style: {
7721
+ position: "absolute",
7722
+ bottom: 0,
7723
+ left: 0,
7724
+ right: 0,
7725
+ background: "linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.35) 60%, transparent 100%)",
7726
+ padding: "".concat(20 * responsiveScale, "px ").concat(12 * responsiveScale, "px ").concat(8 * responsiveScale, "px"),
7727
+ zIndex: 10,
7728
+ opacity: controlsVisible || adStatus.showAds ? 1 : 0,
7729
+ transform: controlsVisible || adStatus.showAds ? "translateY(0)" : "translateY(6px)",
7730
+ pointerEvents: controlsVisible || adStatus.showAds ? "auto" : "none"
7731
+ },
7732
+ children: [
7733
+ /* @__PURE__ */ jsxs("div", {
7734
+ className: "sc-progress-track",
7735
+ style: {
7736
+ width: "100%",
7737
+ height: "3px",
7738
+ background: "rgba(255, 255, 255, 0.2)",
7739
+ borderRadius: "1.5px",
7740
+ marginBottom: "".concat(8 * responsiveScale, "px"),
7741
+ cursor: "pointer",
7742
+ position: "relative",
7743
+ transition: "height 0.1s ease"
7744
+ },
7745
+ onClick: handleTimelineSeek,
7746
+ onMouseEnter: function onMouseEnter(e) {
7747
+ e.currentTarget.style.height = "5px";
7748
+ },
7749
+ onMouseLeave: function onMouseLeave(e) {
7750
+ e.currentTarget.style.height = "3px";
7751
+ },
7752
+ children: [
7753
+ /* @__PURE__ */ jsx("div", {
7754
+ style: {
7755
+ position: "absolute",
7756
+ top: 0,
7757
+ left: 0,
7758
+ bottom: 0,
7759
+ background: adStatus.showAds ? "#f5c518" : "#ff0000",
7760
+ borderRadius: "1.5px",
7761
+ width: "".concat(progressPercent, "%"),
7762
+ transition: "width 0.15s linear"
7763
+ }
7764
+ }),
7765
+ /* @__PURE__ */ jsx("div", {
7766
+ className: "sc-progress-thumb",
7767
+ style: {
7768
+ position: "absolute",
7769
+ top: "50%",
7770
+ left: "".concat(progressPercent, "%"),
7771
+ transform: "translate(-50%, -50%) scale(0)",
7772
+ width: "13px",
7773
+ height: "13px",
7774
+ background: adStatus.showAds ? "#f5c518" : "#ff0000",
7775
+ borderRadius: "50%",
7776
+ boxShadow: "0 0 4px rgba(0, 0, 0, 0.3)",
7777
+ transition: "transform 0.1s ease, left 0.15s linear"
7778
+ }
7779
+ })
7780
+ ]
7781
+ }),
7782
+ /* @__PURE__ */ jsxs("div", {
7783
+ style: {
7784
+ display: "flex",
7785
+ alignItems: "center",
7786
+ justifyContent: "space-between",
7787
+ color: "white",
7788
+ gap: "".concat(8 * responsiveScale, "px")
7789
+ },
7790
+ children: [
7791
+ /* @__PURE__ */ jsxs("div", {
7792
+ style: {
7793
+ display: "flex",
7794
+ alignItems: "center",
7795
+ gap: "".concat(8 * responsiveScale, "px")
7796
+ },
7797
+ children: [
7798
+ /* @__PURE__ */ jsx("button", {
7799
+ className: "sc-ctrl-btn",
7800
+ onClick: handlePlayPause,
7801
+ style: {
7802
+ padding: "".concat(8 * responsiveScale, "px"),
7803
+ borderRadius: "50%",
7804
+ minWidth: "".concat(36 * responsiveScale, "px"),
7805
+ minHeight: "".concat(36 * responsiveScale, "px")
7806
+ },
7807
+ title: isPlaying ? "Pause" : "Play",
7808
+ children: isPlaying ? /* @__PURE__ */ jsx(FaPause, {
7809
+ size: Math.max(14, 18 * responsiveScale)
7810
+ }) : /* @__PURE__ */ jsx(FaPlay, {
7811
+ size: Math.max(14, 18 * responsiveScale),
7351
7812
  style: {
7352
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)",
7353
- backdropFilter: "blur(12px)",
7354
- border: "".concat(2 * responsiveScale, "px solid rgba(255, 255, 255, 0.3)"),
7355
- color: "#ffffff",
7356
- cursor: "pointer",
7357
- padding: "".concat(10 * responsiveScale, "px"),
7358
- borderRadius: "".concat(16 * responsiveScale, "px"),
7359
- display: "flex",
7360
- alignItems: "center",
7361
- justifyContent: "center",
7362
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
7363
- boxShadow: "0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3)",
7364
- minWidth: "".concat(48 * responsiveScale, "px"),
7365
- minHeight: "".concat(48 * responsiveScale, "px")
7366
- },
7367
- onMouseEnter: function(e) {
7368
- var target = e.target;
7369
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
7370
- target.style.boxShadow = "0 12px 48px rgba(0, 0, 0, 0.6), 0 6px 24px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
7371
- },
7372
- onMouseLeave: function(e) {
7373
- var target = e.target;
7374
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
7375
- target.style.boxShadow = "0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
7376
- },
7377
- title: isPlaying ? "Pause" : "Play",
7378
- children: isPlaying ? /* @__PURE__ */ jsx(FaPause, {
7379
- size: Math.max(16, 20 * responsiveScale),
7813
+ marginLeft: "2px"
7814
+ }
7815
+ })
7816
+ }),
7817
+ /* @__PURE__ */ jsxs("div", {
7818
+ style: {
7819
+ display: "flex",
7820
+ alignItems: "center"
7821
+ },
7822
+ onMouseEnter: function onMouseEnter() {
7823
+ return setShowVolumeSlider(true);
7824
+ },
7825
+ onMouseLeave: function onMouseLeave() {
7826
+ return setShowVolumeSlider(false);
7827
+ },
7828
+ children: [
7829
+ /* @__PURE__ */ jsx("button", {
7830
+ className: "sc-ctrl-btn",
7831
+ onClick: function onClick() {
7832
+ if (playerRef.current) playerRef.current.toggleMute();
7833
+ onVolumeToggle === null || onVolumeToggle === void 0 ? void 0 : onVolumeToggle();
7834
+ resetControlsTimer();
7835
+ },
7380
7836
  style: {
7381
- filter: "drop-shadow(0 0 0 transparent)"
7382
- }
7383
- }) : /* @__PURE__ */ jsx(FaPlay, {
7384
- size: Math.max(16, 20 * responsiveScale),
7837
+ padding: "".concat(8 * responsiveScale, "px"),
7838
+ borderRadius: "50%",
7839
+ minWidth: "".concat(36 * responsiveScale, "px"),
7840
+ minHeight: "".concat(36 * responsiveScale, "px")
7841
+ },
7842
+ title: isMuted ? "Unmute" : "Mute",
7843
+ children: /* @__PURE__ */ jsx(VolumeIcon, {
7844
+ size: Math.max(14, 18 * responsiveScale)
7845
+ })
7846
+ }),
7847
+ /* @__PURE__ */ jsx("div", {
7385
7848
  style: {
7386
- filter: "drop-shadow(0 0 0 transparent)"
7387
- }
7388
- })
7389
- }),
7390
- /* @__PURE__ */ jsxs("div", {
7391
- style: {
7392
- position: "relative",
7393
- display: "flex",
7394
- alignItems: "center",
7395
- padding: "8px",
7396
- margin: "-8px"
7397
- },
7398
- onMouseEnter: function() {
7399
- return setShowVolumeSlider(true);
7400
- },
7401
- onMouseLeave: function() {
7402
- return setShowVolumeSlider(false);
7403
- },
7404
- children: [
7405
- /* @__PURE__ */ jsx("button", {
7406
- onClick: function() {
7407
- if (playerRef.current) {
7408
- playerRef.current.toggleMute();
7409
- }
7410
- if (onVolumeToggle) {
7411
- onVolumeToggle();
7412
- }
7413
- },
7849
+ width: showVolumeSlider ? "".concat(62 * responsiveScale, "px") : "0px",
7850
+ overflow: "hidden",
7851
+ transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
7852
+ display: "flex",
7853
+ alignItems: "center",
7854
+ paddingLeft: showVolumeSlider ? "2px" : "0",
7855
+ paddingRight: showVolumeSlider ? "4px" : "0"
7856
+ },
7857
+ children: /* @__PURE__ */ jsxs("div", {
7414
7858
  style: {
7415
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)",
7416
- backdropFilter: "blur(10px)",
7417
- border: "".concat(2 * responsiveScale, "px solid rgba(255, 255, 255, 0.3)"),
7418
- color: "#ffffff",
7859
+ position: "relative",
7860
+ width: "".concat(56 * responsiveScale, "px"),
7861
+ height: "3px",
7419
7862
  cursor: "pointer",
7420
- padding: "".concat(8 * responsiveScale, "px"),
7421
- borderRadius: "".concat(16 * responsiveScale, "px"),
7422
- display: "flex",
7423
- alignItems: "center",
7424
- justifyContent: "center",
7425
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
7426
- boxShadow: "0 6px 28px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)",
7427
- minWidth: "".concat(44 * responsiveScale, "px"),
7428
- minHeight: "".concat(44 * responsiveScale, "px")
7863
+ borderRadius: "1.5px"
7429
7864
  },
7430
- onMouseEnter: function(e) {
7431
- var target = e.target;
7432
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7433
- target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
7865
+ onMouseDown: function onMouseDown(e) {
7866
+ e.preventDefault();
7867
+ var el = e.currentTarget;
7868
+ var move = function move(ev) {
7869
+ var r2 = el.getBoundingClientRect();
7870
+ handleVolumeChange(Math.max(0, Math.min(1, (ev.clientX - r2.left) / r2.width)));
7871
+ };
7872
+ var up = function up1() {
7873
+ document.removeEventListener("mousemove", move);
7874
+ document.removeEventListener("mouseup", up);
7875
+ };
7876
+ document.addEventListener("mousemove", move);
7877
+ document.addEventListener("mouseup", up);
7878
+ var r = el.getBoundingClientRect();
7879
+ handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
7434
7880
  },
7435
- onMouseLeave: function(e) {
7436
- var target = e.target;
7437
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7438
- target.style.boxShadow = "0 6px 28px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
7881
+ onClick: function onClick(e) {
7882
+ e.stopPropagation();
7883
+ var r = e.currentTarget.getBoundingClientRect();
7884
+ handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
7439
7885
  },
7440
- title: isMuted ? "Unmute" : "Mute",
7441
- children: isMuted || volume === 0 ? /* @__PURE__ */ jsx(FaVolumeMute, {
7442
- size: Math.max(14, 16 * responsiveScale),
7443
- style: {
7444
- filter: "drop-shadow(0 0 0 transparent)"
7445
- }
7446
- }) : volume < 0.5 ? /* @__PURE__ */ jsx(FaVolumeDown, {
7447
- size: Math.max(14, 16 * responsiveScale),
7448
- style: {
7449
- filter: "drop-shadow(0 0 0 transparent)"
7450
- }
7451
- }) : /* @__PURE__ */ jsx(FaVolumeUp, {
7452
- size: Math.max(14, 16 * responsiveScale),
7453
- style: {
7454
- filter: "drop-shadow(0 0 0 transparent)"
7455
- }
7456
- })
7457
- }),
7458
- showVolumeSlider && /* @__PURE__ */ jsxs(Fragment, {
7459
7886
  children: [
7460
7887
  /* @__PURE__ */ jsx("div", {
7461
7888
  style: {
7462
7889
  position: "absolute",
7463
- bottom: "100%",
7464
- left: "50%",
7465
- transform: "translateX(-50%)",
7466
- width: "60px",
7467
- height: "20px",
7468
- marginBottom: "-16px",
7469
- zIndex: 9
7470
- },
7471
- onMouseEnter: function() {
7472
- return setShowVolumeSlider(true);
7473
- },
7474
- onMouseLeave: function() {
7475
- return setShowVolumeSlider(false);
7890
+ inset: 0,
7891
+ background: "rgba(255, 255, 255, 0.2)",
7892
+ borderRadius: "1.5px"
7476
7893
  }
7477
7894
  }),
7478
7895
  /* @__PURE__ */ jsx("div", {
7479
7896
  style: {
7480
7897
  position: "absolute",
7481
- bottom: "100%",
7482
- left: "50%",
7483
- transform: "translateX(-50%)",
7484
- marginBottom: "4px",
7485
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.88) 0%, rgba(20, 20, 20, 0.92) 100%)",
7486
- backdropFilter: "blur(15px)",
7487
- padding: "10px 14px",
7488
- borderRadius: "14px",
7489
- border: "1px solid rgba(255, 255, 255, 0.15)",
7490
- display: "flex",
7491
- flexDirection: "column",
7492
- alignItems: "center",
7493
- justifyContent: "center",
7494
- height: "128px",
7495
- boxShadow: "0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15)",
7496
- zIndex: 10,
7497
- transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
7498
- },
7499
- onMouseEnter: function(e) {
7500
- setShowVolumeSlider(true);
7501
- e.currentTarget.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.6), 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 24px rgba(59, 130, 246, 0.3)";
7502
- e.currentTarget.style.borderColor = "rgba(59, 130, 246, 0.4)";
7503
- },
7504
- onMouseLeave: function(e) {
7505
- setShowVolumeSlider(false);
7506
- e.currentTarget.style.boxShadow = "0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15)";
7507
- e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.15)";
7508
- },
7509
- children: /* @__PURE__ */ jsxs("div", {
7510
- style: {
7511
- position: "relative",
7512
- width: "8px",
7513
- height: "104px",
7514
- cursor: "pointer",
7515
- transition: "transform 0.2s ease-in-out"
7516
- },
7517
- onMouseEnter: function(e) {},
7518
- onMouseLeave: function(e) {},
7519
- onMouseDown: function(e) {
7520
- e.preventDefault();
7521
- var sliderElement = e.currentTarget;
7522
- var handleMouseMove = function(moveEvent) {
7523
- if (!sliderElement) return;
7524
- var rect2 = sliderElement.getBoundingClientRect();
7525
- var y2 = moveEvent.clientY - rect2.top;
7526
- var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
7527
- handleVolumeChange(percentage2);
7528
- };
7529
- var handleMouseUp = function() {
7530
- document.removeEventListener("mousemove", handleMouseMove);
7531
- document.removeEventListener("mouseup", handleMouseUp);
7532
- };
7533
- document.addEventListener("mousemove", handleMouseMove);
7534
- document.addEventListener("mouseup", handleMouseUp);
7535
- var rect = sliderElement.getBoundingClientRect();
7536
- var y = e.clientY - rect.top;
7537
- var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
7538
- handleVolumeChange(percentage);
7539
- },
7540
- onClick: function(e) {
7541
- e.stopPropagation();
7542
- var rect = e.currentTarget.getBoundingClientRect();
7543
- var y = e.clientY - rect.top;
7544
- var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
7545
- handleVolumeChange(percentage);
7546
- },
7547
- children: [
7548
- /* @__PURE__ */ jsx("div", {
7549
- style: {
7550
- position: "absolute",
7551
- bottom: "0",
7552
- left: "0",
7553
- width: "100%",
7554
- height: "100%",
7555
- background: "linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.15) 100%)",
7556
- borderRadius: "4px",
7557
- boxShadow: "inset 0 1px 3px rgba(0, 0, 0, 0.2)"
7558
- }
7559
- }),
7560
- /* @__PURE__ */ jsx("div", {
7561
- style: {
7562
- position: "absolute",
7563
- bottom: "0",
7564
- left: "0",
7565
- width: "100%",
7566
- height: "".concat((isMuted ? 0 : volume) * 100, "%"),
7567
- background: "linear-gradient(180deg, rgba(96, 165, 250, 1) 0%, rgba(59, 130, 246, 0.95) 50%, rgba(37, 99, 235, 0.9) 100%)",
7568
- borderRadius: "4px",
7569
- transition: "height 0.15s ease-out, box-shadow 0.2s ease-in-out",
7570
- boxShadow: "0 0 8px rgba(59, 130, 246, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3)"
7571
- }
7572
- }),
7573
- /* @__PURE__ */ jsx("div", {
7574
- style: {
7575
- position: "absolute",
7576
- bottom: "calc(".concat((isMuted ? 0 : volume) * 100, "% - 7px)"),
7577
- left: "50%",
7578
- transform: "translateX(-50%)",
7579
- width: "14px",
7580
- height: "14px",
7581
- background: "linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%)",
7582
- borderRadius: "50%",
7583
- boxShadow: "0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(59, 130, 246, 0.3), 0 0 12px rgba(59, 130, 246, 0.4)",
7584
- transition: "bottom 0.15s ease-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, width 0.2s ease-in-out, height 0.2s ease-in-out",
7585
- cursor: "grab"
7586
- },
7587
- onMouseEnter: function(e) {
7588
- e.currentTarget.style.boxShadow = "0 3px 10px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(59, 130, 246, 0.5), 0 0 20px rgba(59, 130, 246, 0.6)";
7589
- e.currentTarget.style.cursor = "grab";
7590
- },
7591
- onMouseLeave: function(e) {
7592
- e.currentTarget.style.boxShadow = "0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(59, 130, 246, 0.3), 0 0 12px rgba(59, 130, 246, 0.4)";
7593
- },
7594
- onMouseDown: function(e) {
7595
- e.currentTarget.style.cursor = "grabbing";
7596
- },
7597
- onMouseUp: function(e) {
7598
- e.currentTarget.style.cursor = "grab";
7599
- }
7600
- })
7601
- ]
7602
- })
7898
+ top: 0,
7899
+ left: 0,
7900
+ bottom: 0,
7901
+ width: "".concat((isMuted ? 0 : volume) * 100, "%"),
7902
+ background: "#fff",
7903
+ borderRadius: "1.5px",
7904
+ transition: "width 0.1s ease-out"
7905
+ }
7906
+ }),
7907
+ /* @__PURE__ */ jsx("div", {
7908
+ style: {
7909
+ position: "absolute",
7910
+ top: "50%",
7911
+ left: "".concat((isMuted ? 0 : volume) * 100, "%"),
7912
+ transform: "translate(-50%, -50%)",
7913
+ width: "12px",
7914
+ height: "12px",
7915
+ background: "#fff",
7916
+ borderRadius: "50%",
7917
+ boxShadow: "0 0 3px rgba(0, 0, 0, 0.3)",
7918
+ transition: "left 0.1s ease-out"
7919
+ }
7603
7920
  })
7604
7921
  ]
7605
7922
  })
7606
- ]
7607
- }),
7608
- /* @__PURE__ */ jsxs("div", {
7609
- style: {
7610
- fontSize: "".concat(14 * responsiveScale, "px"),
7611
- fontFamily: "monospace",
7612
- color: "rgba(255, 255, 255, 0.9)",
7613
- display: viewportWidth < 480 ? "none" : "block"
7614
- },
7615
- children: [
7616
- formatTime(currentTime),
7617
- " / ",
7618
- formatTime(duration)
7619
- ]
7620
- })
7621
- ]
7622
- }),
7623
- /* @__PURE__ */ jsxs("div", {
7624
- style: {
7625
- display: "flex",
7626
- alignItems: "center",
7627
- gap: "".concat(12 * responsiveScale, "px")
7628
- },
7629
- children: [
7630
- /* @__PURE__ */ jsxs("div", {
7631
- style: {
7632
- position: "relative",
7633
- display: viewportWidth < 600 ? "none" : "block"
7634
- },
7635
- children: [
7636
- /* @__PURE__ */ jsxs("button", {
7637
- onClick: function() {
7638
- return setShowSpeedMenu(!showSpeedMenu);
7639
- },
7640
- style: {
7641
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)",
7642
- backdropFilter: "blur(10px)",
7643
- border: "".concat(2 * responsiveScale, "px solid rgba(255, 255, 255, 0.3)"),
7644
- color: "#ffffff",
7645
- cursor: "pointer",
7646
- padding: "".concat(8 * responsiveScale, "px ").concat(14 * responsiveScale, "px"),
7647
- borderRadius: "".concat(14 * responsiveScale, "px"),
7648
- fontSize: "".concat(14 * responsiveScale, "px"),
7649
- fontFamily: "monospace",
7650
- fontWeight: "700",
7651
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
7652
- boxShadow: "0 6px 24px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)",
7653
- minWidth: "".concat(56 * responsiveScale, "px"),
7654
- minHeight: "".concat(40 * responsiveScale, "px")
7655
- },
7656
- onMouseEnter: function(e) {
7657
- var target = e.target;
7658
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7659
- target.style.boxShadow = "0 10px 32px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
7660
- },
7661
- onMouseLeave: function(e) {
7662
- var target = e.target;
7663
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7664
- target.style.boxShadow = "0 6px 24px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
7665
- },
7666
- title: "Playback Speed",
7667
- children: [
7668
- playbackRate,
7669
- "x"
7670
- ]
7671
- }),
7672
- showSpeedMenu && /* @__PURE__ */ jsx("div", {
7673
- style: {
7674
- position: "absolute",
7675
- bottom: "100%",
7676
- right: 0,
7677
- marginBottom: "12px",
7678
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.95) 100%)",
7679
- backdropFilter: "blur(20px)",
7680
- borderRadius: "12px",
7681
- border: "1px solid rgba(255, 255, 255, 0.1)",
7682
- overflow: "hidden",
7683
- minWidth: "90px",
7684
- boxShadow: "0 16px 48px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1)"
7685
- },
7686
- children: [
7687
- 0.25,
7688
- 0.5,
7689
- 0.75,
7690
- 1,
7691
- 1.25,
7692
- 1.5,
7693
- 1.75,
7694
- 2
7695
- ].map(function(speed) {
7696
- return /* @__PURE__ */ jsxs("button", {
7697
- onClick: function() {
7698
- return handlePlaybackRateChange(speed);
7699
- },
7700
- style: {
7701
- display: "block",
7702
- width: "100%",
7703
- padding: "10px 16px",
7704
- background: playbackRate === speed ? "linear-gradient(135deg, rgba(99, 102, 241, 0.8) 0%, rgba(139, 92, 246, 0.6) 100%)" : "transparent",
7705
- border: "none",
7706
- color: "white",
7707
- cursor: "pointer",
7708
- fontSize: "13px",
7709
- fontFamily: "monospace",
7710
- fontWeight: "600",
7711
- textAlign: "center",
7712
- transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
7713
- borderBottom: speed !== 2 ? "1px solid rgba(255, 255, 255, 0.05)" : "none"
7714
- },
7715
- onMouseEnter: function(e) {
7716
- if (playbackRate !== speed) {
7717
- e.target.style.background = "linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%)";
7718
- }
7719
- },
7720
- onMouseLeave: function(e) {
7721
- if (playbackRate !== speed) {
7722
- e.target.style.background = "transparent";
7723
- }
7724
- },
7725
- children: [
7726
- speed,
7727
- "x"
7728
- ]
7729
- }, speed);
7730
- })
7731
- })
7732
- ]
7733
- }),
7734
- /* @__PURE__ */ jsx("button", {
7735
- onClick: function() {
7736
- if (onFullscreenToggle) {
7737
- onFullscreenToggle();
7738
- } else if (playerRef.current) {
7739
- playerRef.current.toggleFullscreen().catch(function(err) {
7740
- console.error("Fullscreen error:", err);
7741
- });
7742
- }
7743
- },
7744
- style: {
7745
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)",
7746
- backdropFilter: "blur(10px)",
7747
- border: "".concat(2 * responsiveScale, "px solid rgba(255, 255, 255, 0.3)"),
7748
- color: "#ffffff",
7749
- cursor: "pointer",
7750
- padding: "".concat(8 * responsiveScale, "px"),
7751
- borderRadius: "".concat(16 * responsiveScale, "px"),
7752
- display: "flex",
7753
- alignItems: "center",
7754
- justifyContent: "center",
7755
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
7756
- boxShadow: "0 6px 28px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)",
7757
- minWidth: "".concat(44 * responsiveScale, "px"),
7758
- minHeight: "".concat(44 * responsiveScale, "px")
7759
- },
7760
- onMouseEnter: function(e) {
7761
- var target = e.target;
7762
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7763
- target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
7764
- },
7765
- onMouseLeave: function(e) {
7766
- var target = e.target;
7767
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7768
- target.style.boxShadow = "0 6px 28px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
7769
- },
7770
- title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
7771
- children: isFullscreen ? /* @__PURE__ */ jsx(FaCompress, {
7772
- size: Math.max(14, 16 * responsiveScale),
7923
+ })
7924
+ ]
7925
+ }),
7926
+ /* @__PURE__ */ jsxs("div", {
7927
+ style: {
7928
+ fontSize: "".concat(13 * responsiveScale, "px"),
7929
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
7930
+ color: "rgba(255, 255, 255, 0.9)",
7931
+ display: viewportWidth < 480 ? "none" : "block",
7932
+ fontVariantNumeric: "tabular-nums",
7933
+ userSelect: "none",
7934
+ marginLeft: "".concat(4 * responsiveScale, "px")
7935
+ },
7936
+ children: [
7937
+ formatTime(currentTime),
7938
+ " ",
7939
+ /* @__PURE__ */ jsx("span", {
7773
7940
  style: {
7774
- filter: "drop-shadow(0 0 0 transparent)"
7775
- }
7776
- }) : /* @__PURE__ */ jsx(FaExpand, {
7777
- size: Math.max(14, 16 * responsiveScale),
7941
+ color: "rgba(255,255,255,0.5)"
7942
+ },
7943
+ children: "/"
7944
+ }),
7945
+ " ",
7946
+ formatTime(duration)
7947
+ ]
7948
+ })
7949
+ ]
7950
+ }),
7951
+ /* @__PURE__ */ jsxs("div", {
7952
+ style: {
7953
+ display: "flex",
7954
+ alignItems: "center",
7955
+ gap: "".concat(8 * responsiveScale, "px")
7956
+ },
7957
+ children: [
7958
+ /* @__PURE__ */ jsxs("div", {
7959
+ style: {
7960
+ position: "relative",
7961
+ display: viewportWidth < 600 ? "none" : "block"
7962
+ },
7963
+ children: [
7964
+ /* @__PURE__ */ jsxs("button", {
7965
+ className: "sc-ctrl-btn",
7966
+ onClick: function onClick() {
7967
+ setShowSpeedMenu(!showSpeedMenu);
7968
+ resetControlsTimer();
7969
+ },
7778
7970
  style: {
7779
- filter: "drop-shadow(0 0 0 transparent)"
7780
- }
7971
+ padding: "".concat(6 * responsiveScale, "px ").concat(10 * responsiveScale, "px"),
7972
+ borderRadius: "".concat(6 * responsiveScale, "px"),
7973
+ fontSize: "".concat(13 * responsiveScale, "px"),
7974
+ fontFamily: "'SF Mono', 'Cascadia Code', monospace",
7975
+ fontWeight: "600",
7976
+ minHeight: "".concat(32 * responsiveScale, "px")
7977
+ },
7978
+ title: "Playback Speed",
7979
+ children: [
7980
+ playbackRate,
7981
+ "x"
7982
+ ]
7983
+ }),
7984
+ showSpeedMenu && /* @__PURE__ */ jsx("div", {
7985
+ style: {
7986
+ position: "absolute",
7987
+ bottom: "100%",
7988
+ right: 0,
7989
+ marginBottom: "8px",
7990
+ background: "rgba(0, 0, 0, 0.8)",
7991
+ backdropFilter: "blur(24px)",
7992
+ WebkitBackdropFilter: "blur(24px)",
7993
+ borderRadius: "10px",
7994
+ border: "1px solid rgba(255, 255, 255, 0.1)",
7995
+ overflow: "hidden",
7996
+ minWidth: "80px",
7997
+ boxShadow: "0 12px 40px rgba(0, 0, 0, 0.5)",
7998
+ animation: "sc-fade-in 0.15s ease"
7999
+ },
8000
+ children: [
8001
+ 0.25,
8002
+ 0.5,
8003
+ 0.75,
8004
+ 1,
8005
+ 1.25,
8006
+ 1.5,
8007
+ 1.75,
8008
+ 2
8009
+ ].map(function(speed) {
8010
+ return /* @__PURE__ */ jsxs("button", {
8011
+ onClick: function onClick() {
8012
+ return handlePlaybackRateChange(speed);
8013
+ },
8014
+ style: {
8015
+ display: "block",
8016
+ width: "100%",
8017
+ padding: "".concat(8 * responsiveScale, "px ").concat(14 * responsiveScale, "px"),
8018
+ background: playbackRate === speed ? "rgba(255, 255, 255, 0.12)" : "transparent",
8019
+ border: "none",
8020
+ color: playbackRate === speed ? "#fff" : "rgba(255, 255, 255, 0.7)",
8021
+ cursor: "pointer",
8022
+ fontSize: "".concat(12 * responsiveScale, "px"),
8023
+ fontFamily: "'SF Mono', monospace",
8024
+ fontWeight: playbackRate === speed ? "700" : "500",
8025
+ textAlign: "center",
8026
+ transition: "background 0.15s ease, color 0.15s ease"
8027
+ },
8028
+ onMouseEnter: function onMouseEnter(e) {
8029
+ if (playbackRate !== speed) {
8030
+ e.target.style.background = "rgba(255, 255, 255, 0.08)";
8031
+ e.target.style.color = "#fff";
8032
+ }
8033
+ },
8034
+ onMouseLeave: function onMouseLeave(e) {
8035
+ if (playbackRate !== speed) {
8036
+ e.target.style.background = "transparent";
8037
+ e.target.style.color = "rgba(255, 255, 255, 0.7)";
8038
+ }
8039
+ },
8040
+ children: [
8041
+ speed,
8042
+ "x"
8043
+ ]
8044
+ }, speed);
8045
+ })
7781
8046
  })
8047
+ ]
8048
+ }),
8049
+ /* @__PURE__ */ jsx("button", {
8050
+ className: "sc-ctrl-btn",
8051
+ onClick: function onClick() {
8052
+ if (onFullscreenToggle) {
8053
+ onFullscreenToggle();
8054
+ } else if (wrapperRef.current) {
8055
+ if (!document.fullscreenElement) {
8056
+ wrapperRef.current.requestFullscreen().catch(function() {});
8057
+ } else {
8058
+ document.exitFullscreen().catch(function() {});
8059
+ }
8060
+ }
8061
+ resetControlsTimer();
8062
+ },
8063
+ style: {
8064
+ padding: "".concat(8 * responsiveScale, "px"),
8065
+ borderRadius: "50%",
8066
+ minWidth: "".concat(36 * responsiveScale, "px"),
8067
+ minHeight: "".concat(36 * responsiveScale, "px")
8068
+ },
8069
+ title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
8070
+ children: isFullscreen ? /* @__PURE__ */ jsx(FaCompress, {
8071
+ size: Math.max(14, 18 * responsiveScale)
8072
+ }) : /* @__PURE__ */ jsx(FaExpand, {
8073
+ size: Math.max(14, 18 * responsiveScale)
7782
8074
  })
7783
- ]
7784
- })
7785
- ]
7786
- })
7787
- ]
7788
- })
8075
+ })
8076
+ ]
8077
+ })
8078
+ ]
8079
+ })
8080
+ ]
7789
8081
  }) : showCustomControls && !showLicenseWarning && /* @__PURE__ */ jsxs("div", {
8082
+ className: "sc-controls-bar",
7790
8083
  style: {
7791
8084
  position: "absolute",
7792
8085
  bottom: "".concat(10 * responsiveScale, "px"),
7793
8086
  right: "".concat(10 * responsiveScale, "px"),
7794
- transform: "none",
7795
8087
  display: "flex",
7796
8088
  flexDirection: isPortrait ? "column" : "row",
7797
- gap: "".concat(10 * responsiveScale, "px"),
7798
- zIndex: 10
8089
+ gap: "".concat(8 * responsiveScale, "px"),
8090
+ zIndex: 10,
8091
+ opacity: controlsVisible ? 1 : 0,
8092
+ transform: controlsVisible ? "translateY(0)" : "translateY(4px)",
8093
+ pointerEvents: controlsVisible ? "auto" : "none"
7799
8094
  },
7800
8095
  children: [
7801
8096
  /* @__PURE__ */ jsxs("div", {
7802
8097
  style: {
7803
- position: "relative",
7804
8098
  display: "flex",
7805
8099
  alignItems: "center",
7806
- padding: "8px",
7807
- margin: "-8px"
8100
+ background: "rgba(0, 0, 0, 0.6)",
8101
+ borderRadius: "".concat(18 * responsiveScale, "px"),
8102
+ padding: "2px"
7808
8103
  },
7809
- onMouseEnter: function() {
8104
+ onMouseEnter: function onMouseEnter() {
7810
8105
  return setShowVolumeSlider(true);
7811
8106
  },
7812
- onMouseLeave: function() {
8107
+ onMouseLeave: function onMouseLeave() {
7813
8108
  return setShowVolumeSlider(false);
7814
8109
  },
7815
8110
  children: [
7816
8111
  /* @__PURE__ */ jsx("button", {
7817
- onClick: function() {
7818
- if (playerRef.current) {
7819
- playerRef.current.toggleMute();
7820
- }
7821
- if (onVolumeToggle) {
7822
- onVolumeToggle();
7823
- }
7824
- },
7825
- onMouseEnter: function(e) {
7826
- var target = e.currentTarget;
7827
- target.style.boxShadow = "0 14px 48px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(255, 255, 255, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
7828
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
7829
- },
7830
- onMouseLeave: function(e) {
7831
- var target = e.currentTarget;
7832
- target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
7833
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
8112
+ className: "sc-ctrl-btn",
8113
+ onClick: function onClick() {
8114
+ if (playerRef.current) playerRef.current.toggleMute();
8115
+ onVolumeToggle === null || onVolumeToggle === void 0 ? void 0 : onVolumeToggle();
8116
+ resetControlsTimer();
7834
8117
  },
7835
8118
  style: {
7836
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)",
7837
- color: "#ffffff",
7838
- border: "none",
7839
- borderRadius: "".concat(18 * responsiveScale, "px"),
7840
8119
  padding: "".concat(8 * responsiveScale, "px"),
7841
- cursor: "pointer",
7842
- display: "flex",
7843
- alignItems: "center",
7844
- justifyContent: "center",
7845
- backdropFilter: "blur(20px)",
7846
- boxShadow: "0 10px 36px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3)",
7847
- transition: "all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",
7848
- minWidth: "".concat(46 * responsiveScale, "px"),
7849
- minHeight: "".concat(46 * responsiveScale, "px")
8120
+ borderRadius: "50%",
8121
+ minWidth: "".concat(36 * responsiveScale, "px"),
8122
+ minHeight: "".concat(36 * responsiveScale, "px")
7850
8123
  },
7851
8124
  title: isMuted ? "Unmute" : "Mute",
7852
- children: isMuted || volume === 0 ? /* @__PURE__ */ jsx(FaVolumeMute, {
7853
- size: Math.max(14, 16 * responsiveScale),
7854
- style: {
7855
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))",
7856
- color: "#ffffff"
7857
- }
7858
- }) : volume < 0.5 ? /* @__PURE__ */ jsx(FaVolumeDown, {
7859
- size: Math.max(14, 16 * responsiveScale),
7860
- style: {
7861
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))",
7862
- color: "#ffffff"
7863
- }
7864
- }) : /* @__PURE__ */ jsx(FaVolumeUp, {
7865
- size: Math.max(14, 16 * responsiveScale),
7866
- style: {
7867
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))",
7868
- color: "#ffffff"
7869
- }
8125
+ children: /* @__PURE__ */ jsx(VolumeIcon, {
8126
+ size: Math.max(14, 18 * responsiveScale)
7870
8127
  })
7871
8128
  }),
7872
- showVolumeSlider && /* @__PURE__ */ jsxs(Fragment, {
7873
- children: [
7874
- /* @__PURE__ */ jsx("div", {
7875
- style: {
7876
- position: "absolute",
7877
- bottom: "100%",
7878
- left: "50%",
7879
- transform: "translateX(-50%)",
7880
- width: "60px",
7881
- height: "20px",
7882
- marginBottom: "-16px",
7883
- zIndex: 9
7884
- },
7885
- onMouseEnter: function() {
7886
- return setShowVolumeSlider(true);
7887
- },
7888
- onMouseLeave: function() {
7889
- return setShowVolumeSlider(false);
7890
- }
7891
- }),
7892
- /* @__PURE__ */ jsx("div", {
7893
- style: {
7894
- position: "absolute",
7895
- bottom: "100%",
7896
- left: "50%",
7897
- transform: "translateX(-50%)",
7898
- marginBottom: "4px",
7899
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.96) 0%, rgba(20, 20, 20, 0.92) 100%)",
7900
- backdropFilter: "blur(20px)",
7901
- padding: "10px 14px",
7902
- borderRadius: "14px",
7903
- border: "2px solid rgba(255, 255, 255, 0.7)",
7904
- display: "flex",
7905
- flexDirection: "column",
7906
- alignItems: "center",
7907
- justifyContent: "center",
7908
- height: "128px",
7909
- boxShadow: "0 12px 40px rgba(0, 0, 0, 0.85), 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35)",
7910
- zIndex: 10,
7911
- transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
7912
- },
7913
- onMouseEnter: function(e) {
7914
- setShowVolumeSlider(true);
7915
- e.currentTarget.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.9), 0 6px 16px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 24px rgba(96, 165, 250, 0.4)";
7916
- e.currentTarget.style.borderColor = "rgba(96, 165, 250, 0.8)";
7917
- },
7918
- onMouseLeave: function(e) {
7919
- setShowVolumeSlider(false);
7920
- e.currentTarget.style.boxShadow = "0 12px 40px rgba(0, 0, 0, 0.85), 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35)";
7921
- e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.7)";
7922
- },
7923
- children: /* @__PURE__ */ jsxs("div", {
8129
+ /* @__PURE__ */ jsx("div", {
8130
+ style: {
8131
+ width: showVolumeSlider ? "".concat(62 * responsiveScale, "px") : "0px",
8132
+ overflow: "hidden",
8133
+ transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
8134
+ display: "flex",
8135
+ alignItems: "center",
8136
+ paddingLeft: showVolumeSlider ? "2px" : "0",
8137
+ paddingRight: showVolumeSlider ? "6px" : "0"
8138
+ },
8139
+ children: /* @__PURE__ */ jsxs("div", {
8140
+ style: {
8141
+ position: "relative",
8142
+ width: "".concat(56 * responsiveScale, "px"),
8143
+ height: "3px",
8144
+ cursor: "pointer",
8145
+ borderRadius: "1.5px"
8146
+ },
8147
+ onMouseDown: function onMouseDown(e) {
8148
+ e.preventDefault();
8149
+ var el = e.currentTarget;
8150
+ var move = function move(ev) {
8151
+ var r2 = el.getBoundingClientRect();
8152
+ handleVolumeChange(Math.max(0, Math.min(1, (ev.clientX - r2.left) / r2.width)));
8153
+ };
8154
+ var up = function up1() {
8155
+ document.removeEventListener("mousemove", move);
8156
+ document.removeEventListener("mouseup", up);
8157
+ };
8158
+ document.addEventListener("mousemove", move);
8159
+ document.addEventListener("mouseup", up);
8160
+ var r = el.getBoundingClientRect();
8161
+ handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
8162
+ },
8163
+ onClick: function onClick(e) {
8164
+ e.stopPropagation();
8165
+ var r = e.currentTarget.getBoundingClientRect();
8166
+ handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
8167
+ },
8168
+ children: [
8169
+ /* @__PURE__ */ jsx("div", {
7924
8170
  style: {
7925
- position: "relative",
7926
- width: "8px",
7927
- height: "104px",
7928
- cursor: "pointer",
7929
- transition: "transform 0.2s ease-in-out"
7930
- },
7931
- onMouseDown: function(e) {
7932
- e.preventDefault();
7933
- var sliderElement = e.currentTarget;
7934
- var handleMouseMove = function(moveEvent) {
7935
- if (!sliderElement) return;
7936
- var rect2 = sliderElement.getBoundingClientRect();
7937
- var y2 = moveEvent.clientY - rect2.top;
7938
- var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
7939
- handleVolumeChange(percentage2);
7940
- };
7941
- var handleMouseUp = function() {
7942
- document.removeEventListener("mousemove", handleMouseMove);
7943
- document.removeEventListener("mouseup", handleMouseUp);
7944
- };
7945
- document.addEventListener("mousemove", handleMouseMove);
7946
- document.addEventListener("mouseup", handleMouseUp);
7947
- var rect = sliderElement.getBoundingClientRect();
7948
- var y = e.clientY - rect.top;
7949
- var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
7950
- handleVolumeChange(percentage);
7951
- },
7952
- onClick: function(e) {
7953
- e.stopPropagation();
7954
- var rect = e.currentTarget.getBoundingClientRect();
7955
- var y = e.clientY - rect.top;
7956
- var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
7957
- handleVolumeChange(percentage);
7958
- },
7959
- children: [
7960
- /* @__PURE__ */ jsx("div", {
7961
- style: {
7962
- position: "absolute",
7963
- bottom: "0",
7964
- left: "0",
7965
- width: "100%",
7966
- height: "100%",
7967
- background: "linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.5) 100%)",
7968
- borderRadius: "4px",
7969
- border: "1px solid rgba(255, 255, 255, 0.4)",
7970
- boxShadow: "inset 0 1px 3px rgba(0, 0, 0, 0.3)"
7971
- }
7972
- }),
7973
- /* @__PURE__ */ jsx("div", {
7974
- style: {
7975
- position: "absolute",
7976
- bottom: "0",
7977
- left: "0",
7978
- width: "100%",
7979
- height: "".concat((isMuted ? 0 : volume) * 100, "%"),
7980
- background: "linear-gradient(180deg, rgba(125, 211, 252, 1) 0%, rgba(96, 165, 250, 0.98) 50%, rgba(59, 130, 246, 0.95) 100%)",
7981
- borderRadius: "4px",
7982
- transition: "height 0.15s ease-out, box-shadow 0.2s ease-in-out",
7983
- boxShadow: "0 0 12px rgba(96, 165, 250, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4)"
7984
- }
7985
- }),
7986
- /* @__PURE__ */ jsx("div", {
7987
- style: {
7988
- position: "absolute",
7989
- bottom: "calc(".concat((isMuted ? 0 : volume) * 100, "% - 8px)"),
7990
- left: "50%",
7991
- transform: "translateX(-50%)",
7992
- width: "16px",
7993
- height: "16px",
7994
- background: "linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%)",
7995
- borderRadius: "50%",
7996
- border: "2px solid rgba(96, 165, 250, 0.9)",
7997
- boxShadow: "0 3px 8px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(96, 165, 250, 0.4), 0 0 16px rgba(96, 165, 250, 0.5)",
7998
- transition: "bottom 0.15s ease-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, width 0.2s ease-in-out, height 0.2s ease-in-out",
7999
- cursor: "grab"
8000
- },
8001
- onMouseEnter: function(e) {
8002
- e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(96, 165, 250, 0.6), 0 0 24px rgba(96, 165, 250, 0.7)";
8003
- e.currentTarget.style.cursor = "grab";
8004
- },
8005
- onMouseLeave: function(e) {
8006
- e.currentTarget.style.boxShadow = "0 3px 8px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(96, 165, 250, 0.4), 0 0 16px rgba(96, 165, 250, 0.5)";
8007
- },
8008
- onMouseDown: function(e) {
8009
- e.currentTarget.style.cursor = "grabbing";
8010
- },
8011
- onMouseUp: function(e) {
8012
- e.currentTarget.style.cursor = "grab";
8013
- }
8014
- })
8015
- ]
8171
+ position: "absolute",
8172
+ inset: 0,
8173
+ background: "rgba(255, 255, 255, 0.2)",
8174
+ borderRadius: "1.5px"
8175
+ }
8176
+ }),
8177
+ /* @__PURE__ */ jsx("div", {
8178
+ style: {
8179
+ position: "absolute",
8180
+ top: 0,
8181
+ left: 0,
8182
+ bottom: 0,
8183
+ width: "".concat((isMuted ? 0 : volume) * 100, "%"),
8184
+ background: "#fff",
8185
+ borderRadius: "1.5px",
8186
+ transition: "width 0.1s ease-out"
8187
+ }
8188
+ }),
8189
+ /* @__PURE__ */ jsx("div", {
8190
+ style: {
8191
+ position: "absolute",
8192
+ top: "50%",
8193
+ left: "".concat((isMuted ? 0 : volume) * 100, "%"),
8194
+ transform: "translate(-50%, -50%)",
8195
+ width: "12px",
8196
+ height: "12px",
8197
+ background: "#fff",
8198
+ borderRadius: "50%",
8199
+ boxShadow: "0 0 3px rgba(0, 0, 0, 0.3)",
8200
+ transition: "left 0.1s ease-out"
8201
+ }
8016
8202
  })
8017
- })
8018
- ]
8203
+ ]
8204
+ })
8019
8205
  })
8020
8206
  ]
8021
8207
  }),
8022
8208
  /* @__PURE__ */ jsx("button", {
8023
- onClick: function() {
8209
+ className: "sc-ctrl-btn",
8210
+ onClick: function onClick() {
8024
8211
  if (onFullscreenToggle) {
8025
8212
  onFullscreenToggle();
8026
- } else if (playerRef.current) {
8027
- playerRef.current.toggleFullscreen().catch(function(err) {
8028
- console.error("Fullscreen error:", err);
8029
- });
8213
+ } else if (wrapperRef.current) {
8214
+ if (!document.fullscreenElement) {
8215
+ wrapperRef.current.requestFullscreen().catch(function() {});
8216
+ } else {
8217
+ document.exitFullscreen().catch(function() {});
8218
+ }
8030
8219
  }
8031
- },
8032
- onMouseEnter: function(e) {
8033
- var target = e.currentTarget;
8034
- target.style.boxShadow = "0 14px 48px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(255, 255, 255, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
8035
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
8036
- },
8037
- onMouseLeave: function(e) {
8038
- var target = e.currentTarget;
8039
- target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
8040
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
8220
+ resetControlsTimer();
8041
8221
  },
8042
8222
  style: {
8043
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)",
8044
- color: "#ffffff",
8045
- border: "none",
8046
- borderRadius: "".concat(18 * responsiveScale, "px"),
8047
8223
  padding: "".concat(8 * responsiveScale, "px"),
8048
- cursor: "pointer",
8049
- display: "flex",
8050
- alignItems: "center",
8051
- justifyContent: "center",
8052
- backdropFilter: "blur(20px)",
8053
- boxShadow: "0 10px 36px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3)",
8054
- transition: "all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",
8055
- minWidth: "".concat(46 * responsiveScale, "px"),
8056
- minHeight: "".concat(46 * responsiveScale, "px")
8224
+ borderRadius: "50%",
8225
+ minWidth: "".concat(36 * responsiveScale, "px"),
8226
+ minHeight: "".concat(36 * responsiveScale, "px"),
8227
+ background: "rgba(0, 0, 0, 0.6)"
8057
8228
  },
8058
8229
  title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
8059
8230
  children: isFullscreen ? /* @__PURE__ */ jsx(FaCompress, {
8060
- size: Math.max(14, 16 * responsiveScale),
8061
- style: {
8062
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))",
8063
- color: "#ffffff"
8064
- }
8231
+ size: Math.max(14, 18 * responsiveScale)
8065
8232
  }) : /* @__PURE__ */ jsx(FaExpand, {
8066
- size: Math.max(14, 16 * responsiveScale),
8067
- style: {
8068
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))",
8069
- color: "#ffffff"
8070
- }
8233
+ size: Math.max(14, 18 * responsiveScale)
8071
8234
  })
8072
8235
  })
8073
8236
  ]
@@ -8180,7 +8343,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8180
8343
  // src/StormcloudPlayer.tsx
8181
8344
  import React3, { Component as Component4, Suspense } from "react";
8182
8345
  // src/props.ts
8183
- var noop = function() {};
8346
+ var noop = function noop() {};
8184
8347
  var defaultProps = {
8185
8348
  playing: false,
8186
8349
  loop: false,
@@ -8226,29 +8389,29 @@ var defaultProps = {
8226
8389
  // src/utils.ts
8227
8390
  import { lazy as reactLazy } from "react";
8228
8391
  var lazy = reactLazy;
8229
- var omit = function(object, keys) {
8392
+ var omit = function omit(object, keys) {
8230
8393
  var result = _object_spread({}, object);
8231
8394
  keys.forEach(function(key) {
8232
8395
  delete result[key];
8233
8396
  });
8234
8397
  return result;
8235
8398
  };
8236
- var isMediaStream = function(url) {
8399
+ var isMediaStream = function isMediaStream(url) {
8237
8400
  return typeof window !== "undefined" && window.MediaStream && _instanceof(url, window.MediaStream);
8238
8401
  };
8239
- var supportsWebKitPresentationMode = function() {
8402
+ var supportsWebKitPresentationMode = function supportsWebKitPresentationMode() {
8240
8403
  if (typeof window === "undefined") return false;
8241
8404
  var video = document.createElement("video");
8242
8405
  return "webkitSupportsPresentationMode" in video;
8243
8406
  };
8244
- var randomString = function() {
8407
+ var randomString = function randomString() {
8245
8408
  return Math.random().toString(36).substr(2, 9);
8246
8409
  };
8247
- var parseQuery = function(url) {
8410
+ var parseQuery = function parseQuery(url) {
8248
8411
  var query = {};
8249
8412
  var queryString = url.split("?")[1] || "";
8250
8413
  if (!queryString) return query;
8251
- var manualParse = function(qs) {
8414
+ var manualParse = function manualParse(qs) {
8252
8415
  qs.split("&").forEach(function(param) {
8253
8416
  var _param_split = _sliced_to_array(param.split("="), 2), key = _param_split[0], value = _param_split[1];
8254
8417
  if (key) {
@@ -8275,7 +8438,7 @@ var parseQuery = function(url) {
8275
8438
  }
8276
8439
  return query;
8277
8440
  };
8278
- var merge = function(target) {
8441
+ var merge = function merge1(target) {
8279
8442
  for(var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
8280
8443
  sources[_key - 1] = arguments[_key];
8281
8444
  }
@@ -8295,19 +8458,19 @@ var merge = function(target) {
8295
8458
  target
8296
8459
  ].concat(_to_consumable_array(sources)));
8297
8460
  };
8298
- var isObject = function(item) {
8461
+ var isObject = function isObject(item) {
8299
8462
  return item && (typeof item === "undefined" ? "undefined" : _type_of(item)) === "object" && !Array.isArray(item);
8300
8463
  };
8301
8464
  var IS_BROWSER = typeof window !== "undefined" && window.document;
8302
8465
  var IS_GLOBAL = typeof globalThis !== "undefined" && globalThis.window && globalThis.window.document;
8303
8466
  var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(navigator.userAgent);
8304
8467
  var IS_SAFARI = IS_BROWSER && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
8305
- var SUPPORTS_HLS = function() {
8468
+ var SUPPORTS_HLS = function SUPPORTS_HLS() {
8306
8469
  if (!IS_BROWSER) return false;
8307
8470
  var video = document.createElement("video");
8308
8471
  return Boolean(video.canPlayType("application/vnd.apple.mpegurl"));
8309
8472
  };
8310
- var SUPPORTS_DASH = function() {
8473
+ var SUPPORTS_DASH = function SUPPORTS_DASH() {
8311
8474
  if (!IS_BROWSER) return false;
8312
8475
  var video = document.createElement("video");
8313
8476
  return Boolean(video.canPlayType("application/dash+xml"));
@@ -8319,23 +8482,23 @@ var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
8319
8482
  var VIDEO_EXTENSIONS = /\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\?)/i;
8320
8483
  var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\?)/i;
8321
8484
  var canPlay = {
8322
- hls: function(url) {
8485
+ hls: function hls(url) {
8323
8486
  if (!url || typeof url !== "string") return false;
8324
8487
  return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);
8325
8488
  },
8326
- dash: function(url) {
8489
+ dash: function dash(url) {
8327
8490
  if (!url || typeof url !== "string") return false;
8328
8491
  return DASH_EXTENSIONS.test(url);
8329
8492
  },
8330
- video: function(url) {
8493
+ video: function video(url) {
8331
8494
  if (!url || typeof url !== "string") return false;
8332
8495
  return VIDEO_EXTENSIONS.test(url);
8333
8496
  },
8334
- audio: function(url) {
8497
+ audio: function audio(url) {
8335
8498
  if (!url || typeof url !== "string") return false;
8336
8499
  return AUDIO_EXTENSIONS.test(url);
8337
8500
  },
8338
- file: function(url) {
8501
+ file: function file(url) {
8339
8502
  if (!url || typeof url !== "string") return false;
8340
8503
  return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);
8341
8504
  }
@@ -8348,11 +8511,11 @@ var HlsPlayer = /*#__PURE__*/ function(Component) {
8348
8511
  function HlsPlayer() {
8349
8512
  _class_call_check(this, HlsPlayer);
8350
8513
  var _this;
8351
- var _this1, _arguments = arguments;
8352
- _this = _call_super(this, HlsPlayer, _to_consumable_array(_arguments)), _this1 = _this;
8353
- _this1.player = null;
8354
- _this1.mounted = false;
8355
- _this1.load = function() {
8514
+ var _this1;
8515
+ _this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
8516
+ _this.player = null;
8517
+ _this.mounted = false;
8518
+ _this.load = function() {
8356
8519
  return _async_to_generator(function() {
8357
8520
  var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
8358
8521
  return _ts_generator(this, function(_state) {
@@ -8425,87 +8588,87 @@ var HlsPlayer = /*#__PURE__*/ function(Component) {
8425
8588
  });
8426
8589
  })();
8427
8590
  };
8428
- _this1.play = function() {
8429
- if (_this1.props.videoElement) {
8430
- var video = _this1.props.videoElement;
8591
+ _this.play = function() {
8592
+ if (_this.props.videoElement) {
8593
+ var video = _this.props.videoElement;
8431
8594
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
8432
8595
  if (hasValidSource) {
8433
8596
  var _video_play, _this_props_onPlay, _this_props;
8434
8597
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
8435
8598
  var _this_props_onError, _this_props;
8436
8599
  console.error("[HlsPlayer] Failed to play:", error);
8437
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8600
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8438
8601
  });
8439
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8602
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8440
8603
  } else {
8441
8604
  console.warn("[HlsPlayer] Cannot play: video has no valid source");
8442
8605
  }
8443
8606
  }
8444
8607
  };
8445
- _this1.pause = function() {
8446
- if (_this1.props.videoElement) {
8608
+ _this.pause = function() {
8609
+ if (_this.props.videoElement) {
8447
8610
  var _this_props_onPause, _this_props;
8448
- _this1.props.videoElement.pause();
8449
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8611
+ _this.props.videoElement.pause();
8612
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8450
8613
  }
8451
8614
  };
8452
- _this1.stop = function() {
8453
- _this1.pause();
8454
- if (_this1.props.videoElement) {
8455
- _this1.props.videoElement.currentTime = 0;
8615
+ _this.stop = function() {
8616
+ _this.pause();
8617
+ if (_this.props.videoElement) {
8618
+ _this.props.videoElement.currentTime = 0;
8456
8619
  }
8457
8620
  };
8458
- _this1.seekTo = function(seconds, keepPlaying) {
8459
- if (_this1.props.videoElement) {
8460
- _this1.props.videoElement.currentTime = seconds;
8621
+ _this.seekTo = function(seconds, keepPlaying) {
8622
+ if (_this.props.videoElement) {
8623
+ _this.props.videoElement.currentTime = seconds;
8461
8624
  if (!keepPlaying) {
8462
- _this1.pause();
8625
+ _this.pause();
8463
8626
  }
8464
8627
  }
8465
8628
  };
8466
- _this1.setVolume = function(volume) {
8467
- if (_this1.props.videoElement) {
8468
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8629
+ _this.setVolume = function(volume) {
8630
+ if (_this.props.videoElement) {
8631
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8469
8632
  }
8470
8633
  };
8471
- _this1.mute = function() {
8472
- if (_this1.props.videoElement) {
8473
- _this1.props.videoElement.muted = true;
8634
+ _this.mute = function() {
8635
+ if (_this.props.videoElement) {
8636
+ _this.props.videoElement.muted = true;
8474
8637
  }
8475
8638
  };
8476
- _this1.unmute = function() {
8477
- if (_this1.props.videoElement) {
8478
- _this1.props.videoElement.muted = false;
8639
+ _this.unmute = function() {
8640
+ if (_this.props.videoElement) {
8641
+ _this.props.videoElement.muted = false;
8479
8642
  }
8480
8643
  };
8481
- _this1.setPlaybackRate = function(rate) {
8482
- if (_this1.props.videoElement && rate > 0) {
8483
- _this1.props.videoElement.playbackRate = rate;
8644
+ _this.setPlaybackRate = function(rate) {
8645
+ if (_this.props.videoElement && rate > 0) {
8646
+ _this.props.videoElement.playbackRate = rate;
8484
8647
  }
8485
8648
  };
8486
- _this1.getDuration = function() {
8487
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
8488
- return _this1.props.videoElement.duration;
8649
+ _this.getDuration = function() {
8650
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
8651
+ return _this.props.videoElement.duration;
8489
8652
  }
8490
8653
  return null;
8491
8654
  };
8492
- _this1.getCurrentTime = function() {
8493
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
8494
- return _this1.props.videoElement.currentTime;
8655
+ _this.getCurrentTime = function() {
8656
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
8657
+ return _this.props.videoElement.currentTime;
8495
8658
  }
8496
8659
  return null;
8497
8660
  };
8498
- _this1.getSecondsLoaded = function() {
8499
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
8500
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
8661
+ _this.getSecondsLoaded = function() {
8662
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
8663
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
8501
8664
  }
8502
8665
  return null;
8503
8666
  };
8504
- _this1.getInternalPlayer = function() {
8667
+ _this.getInternalPlayer = function() {
8505
8668
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
8506
- if (key === "player") return _this1.player;
8507
- if (key === "video") return _this1.props.videoElement;
8508
- if (key === "hls" && _this1.player) return _this1.player.hls;
8669
+ if (key === "player") return _this.player;
8670
+ if (key === "video") return _this.props.videoElement;
8671
+ if (key === "hls" && _this.player) return _this.player.hls;
8509
8672
  return null;
8510
8673
  };
8511
8674
  return _this;
@@ -8555,49 +8718,49 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
8555
8718
  function FilePlayer() {
8556
8719
  _class_call_check(this, FilePlayer);
8557
8720
  var _this;
8558
- var _this1, _arguments = arguments;
8559
- _this = _call_super(this, FilePlayer, _to_consumable_array(_arguments)), _this1 = _this;
8560
- _this1.mounted = false;
8561
- _this1.ready = false;
8562
- _this1.load = function() {
8721
+ var _this1;
8722
+ _this = _call_super(this, FilePlayer, arguments), _this1 = _this;
8723
+ _this.mounted = false;
8724
+ _this.ready = false;
8725
+ _this.load = function() {
8563
8726
  var _this_props_onMount, _this_props;
8564
- if (!_this1.props.videoElement || !_this1.props.src) return;
8565
- var video = _this1.props.videoElement;
8566
- var handleLoadedMetadata = function() {
8567
- if (_this1.mounted && !_this1.ready) {
8727
+ if (!_this.props.videoElement || !_this.props.src) return;
8728
+ var video = _this.props.videoElement;
8729
+ var handleLoadedMetadata = function handleLoadedMetadata() {
8730
+ if (_this.mounted && !_this.ready) {
8568
8731
  var _this_props_onReady, _this_props;
8569
- _this1.ready = true;
8570
- (_this_props_onReady = (_this_props = _this1.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
8732
+ _this.ready = true;
8733
+ (_this_props_onReady = (_this_props = _this.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
8571
8734
  }
8572
8735
  };
8573
- var handlePlay = function() {
8574
- if (_this1.mounted) {
8736
+ var handlePlay = function handlePlay() {
8737
+ if (_this.mounted) {
8575
8738
  var _this_props_onPlay, _this_props;
8576
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8739
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8577
8740
  }
8578
8741
  };
8579
- var handlePause = function() {
8580
- if (_this1.mounted) {
8742
+ var handlePause = function handlePause() {
8743
+ if (_this.mounted) {
8581
8744
  var _this_props_onPause, _this_props;
8582
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8745
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8583
8746
  }
8584
8747
  };
8585
- var handleEnded = function() {
8586
- if (_this1.mounted) {
8748
+ var handleEnded = function handleEnded() {
8749
+ if (_this.mounted) {
8587
8750
  var _this_props_onEnded, _this_props;
8588
- (_this_props_onEnded = (_this_props = _this1.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
8751
+ (_this_props_onEnded = (_this_props = _this.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
8589
8752
  }
8590
8753
  };
8591
- var handleError = function(error) {
8592
- if (_this1.mounted) {
8754
+ var handleError = function handleError(error) {
8755
+ if (_this.mounted) {
8593
8756
  var _this_props_onError, _this_props;
8594
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8757
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8595
8758
  }
8596
8759
  };
8597
- var handleLoadedData = function() {
8598
- if (_this1.mounted) {
8760
+ var handleLoadedData = function handleLoadedData() {
8761
+ if (_this.mounted) {
8599
8762
  var _this_props_onLoaded, _this_props;
8600
- (_this_props_onLoaded = (_this_props = _this1.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
8763
+ (_this_props_onLoaded = (_this_props = _this.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
8601
8764
  }
8602
8765
  };
8603
8766
  video.addEventListener("loadedmetadata", handleLoadedMetadata);
@@ -8606,15 +8769,15 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
8606
8769
  video.addEventListener("ended", handleEnded);
8607
8770
  video.addEventListener("error", handleError);
8608
8771
  video.addEventListener("loadeddata", handleLoadedData);
8609
- video.src = _this1.props.src;
8610
- if (_this1.props.autoplay !== void 0) video.autoplay = _this1.props.autoplay;
8611
- if (_this1.props.muted !== void 0) video.muted = _this1.props.muted;
8612
- if (_this1.props.loop !== void 0) video.loop = _this1.props.loop;
8613
- if (_this1.props.controls !== void 0) video.controls = _this1.props.controls;
8614
- if (_this1.props.playsInline !== void 0) video.playsInline = _this1.props.playsInline;
8615
- if (_this1.props.preload !== void 0) video.preload = _this1.props.preload;
8616
- if (_this1.props.poster !== void 0) video.poster = _this1.props.poster;
8617
- (_this_props_onMount = (_this_props = _this1.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this1);
8772
+ video.src = _this.props.src;
8773
+ if (_this.props.autoplay !== void 0) video.autoplay = _this.props.autoplay;
8774
+ if (_this.props.muted !== void 0) video.muted = _this.props.muted;
8775
+ if (_this.props.loop !== void 0) video.loop = _this.props.loop;
8776
+ if (_this.props.controls !== void 0) video.controls = _this.props.controls;
8777
+ if (_this.props.playsInline !== void 0) video.playsInline = _this.props.playsInline;
8778
+ if (_this.props.preload !== void 0) video.preload = _this.props.preload;
8779
+ if (_this.props.poster !== void 0) video.poster = _this.props.poster;
8780
+ (_this_props_onMount = (_this_props = _this.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this);
8618
8781
  return function() {
8619
8782
  video.removeEventListener("loadedmetadata", handleLoadedMetadata);
8620
8783
  video.removeEventListener("play", handlePlay);
@@ -8624,90 +8787,90 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
8624
8787
  video.removeEventListener("loadeddata", handleLoadedData);
8625
8788
  };
8626
8789
  };
8627
- _this1.play = function() {
8628
- if (_this1.props.videoElement) {
8629
- var video = _this1.props.videoElement;
8790
+ _this.play = function() {
8791
+ if (_this.props.videoElement) {
8792
+ var video = _this.props.videoElement;
8630
8793
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
8631
8794
  if (hasValidSource) {
8632
8795
  var _video_play;
8633
8796
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
8634
8797
  var _this_props_onError, _this_props;
8635
8798
  console.error("[FilePlayer] Failed to play:", error);
8636
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8799
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8637
8800
  });
8638
8801
  } else {
8639
8802
  console.warn("[FilePlayer] Cannot play: video has no valid source");
8640
8803
  }
8641
8804
  }
8642
8805
  };
8643
- _this1.pause = function() {
8644
- if (_this1.props.videoElement) {
8645
- _this1.props.videoElement.pause();
8806
+ _this.pause = function() {
8807
+ if (_this.props.videoElement) {
8808
+ _this.props.videoElement.pause();
8646
8809
  }
8647
8810
  };
8648
- _this1.stop = function() {
8649
- _this1.pause();
8650
- if (_this1.props.videoElement) {
8651
- _this1.props.videoElement.currentTime = 0;
8811
+ _this.stop = function() {
8812
+ _this.pause();
8813
+ if (_this.props.videoElement) {
8814
+ _this.props.videoElement.currentTime = 0;
8652
8815
  }
8653
8816
  };
8654
- _this1.seekTo = function(seconds, keepPlaying) {
8655
- if (_this1.props.videoElement) {
8656
- _this1.props.videoElement.currentTime = seconds;
8817
+ _this.seekTo = function(seconds, keepPlaying) {
8818
+ if (_this.props.videoElement) {
8819
+ _this.props.videoElement.currentTime = seconds;
8657
8820
  if (!keepPlaying) {
8658
- _this1.pause();
8821
+ _this.pause();
8659
8822
  }
8660
8823
  }
8661
8824
  };
8662
- _this1.setVolume = function(volume) {
8663
- if (_this1.props.videoElement) {
8664
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8825
+ _this.setVolume = function(volume) {
8826
+ if (_this.props.videoElement) {
8827
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8665
8828
  }
8666
8829
  };
8667
- _this1.mute = function() {
8668
- if (_this1.props.videoElement) {
8669
- _this1.props.videoElement.muted = true;
8830
+ _this.mute = function() {
8831
+ if (_this.props.videoElement) {
8832
+ _this.props.videoElement.muted = true;
8670
8833
  }
8671
8834
  };
8672
- _this1.unmute = function() {
8673
- if (_this1.props.videoElement) {
8674
- _this1.props.videoElement.muted = false;
8835
+ _this.unmute = function() {
8836
+ if (_this.props.videoElement) {
8837
+ _this.props.videoElement.muted = false;
8675
8838
  }
8676
8839
  };
8677
- _this1.setPlaybackRate = function(rate) {
8678
- if (_this1.props.videoElement && rate > 0) {
8679
- _this1.props.videoElement.playbackRate = rate;
8840
+ _this.setPlaybackRate = function(rate) {
8841
+ if (_this.props.videoElement && rate > 0) {
8842
+ _this.props.videoElement.playbackRate = rate;
8680
8843
  }
8681
8844
  };
8682
- _this1.setLoop = function(loop) {
8683
- if (_this1.props.videoElement) {
8684
- _this1.props.videoElement.loop = loop;
8845
+ _this.setLoop = function(loop) {
8846
+ if (_this.props.videoElement) {
8847
+ _this.props.videoElement.loop = loop;
8685
8848
  }
8686
8849
  };
8687
- _this1.getDuration = function() {
8688
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
8689
- return _this1.props.videoElement.duration;
8850
+ _this.getDuration = function() {
8851
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
8852
+ return _this.props.videoElement.duration;
8690
8853
  }
8691
8854
  return null;
8692
8855
  };
8693
- _this1.getCurrentTime = function() {
8694
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
8695
- return _this1.props.videoElement.currentTime;
8856
+ _this.getCurrentTime = function() {
8857
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
8858
+ return _this.props.videoElement.currentTime;
8696
8859
  }
8697
8860
  return null;
8698
8861
  };
8699
- _this1.getSecondsLoaded = function() {
8700
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
8701
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
8862
+ _this.getSecondsLoaded = function() {
8863
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
8864
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
8702
8865
  }
8703
8866
  return null;
8704
8867
  };
8705
- _this1.getInternalPlayer = function() {
8868
+ _this.getInternalPlayer = function() {
8706
8869
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
8707
- if (key === "video") return _this1.props.videoElement;
8870
+ if (key === "video") return _this.props.videoElement;
8708
8871
  return null;
8709
8872
  };
8710
- _this1.enablePIP = function() {
8873
+ _this.enablePIP = function() {
8711
8874
  return _async_to_generator(function() {
8712
8875
  var error;
8713
8876
  return _ts_generator(this, function(_state) {
@@ -8750,7 +8913,7 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
8750
8913
  });
8751
8914
  })();
8752
8915
  };
8753
- _this1.disablePIP = function() {
8916
+ _this.disablePIP = function() {
8754
8917
  return _async_to_generator(function() {
8755
8918
  var error;
8756
8919
  return _ts_generator(this, function(_state) {
@@ -8844,7 +9007,7 @@ var players = [
8844
9007
  key: "file",
8845
9008
  name: "File Player",
8846
9009
  canPlay: canPlay.file,
8847
- canEnablePIP: function(url) {
9010
+ canEnablePIP: function canEnablePIP(url) {
8848
9011
  return canPlay.file(url) && (document.pictureInPictureEnabled || typeof document.webkitSupportsPresentationMode === "function");
8849
9012
  },
8850
9013
  lazyPlayer: lazy(function() {
@@ -9171,7 +9334,7 @@ var SUPPORTED_PROPS = [
9171
9334
  "onControlClick"
9172
9335
  ];
9173
9336
  var customPlayers = [];
9174
- var createStormcloudPlayer = function(playerList, fallback) {
9337
+ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallback) {
9175
9338
  var _a;
9176
9339
  return _a = /*#__PURE__*/ function(Component4) {
9177
9340
  "use strict";
@@ -9184,10 +9347,10 @@ var createStormcloudPlayer = function(playerList, fallback) {
9184
9347
  showPreview: false
9185
9348
  };
9186
9349
  _this.references = {
9187
- wrapper: function(wrapper) {
9350
+ wrapper: function wrapper(wrapper) {
9188
9351
  _this.wrapper = wrapper;
9189
9352
  },
9190
- player: function(player) {
9353
+ player: function player(player) {
9191
9354
  _this.player = player;
9192
9355
  }
9193
9356
  };
@@ -9340,5 +9503,5 @@ var createStormcloudPlayer = function(playerList, fallback) {
9340
9503
  };
9341
9504
  var StormcloudPlayer = createStormcloudPlayer(players_default, players_default[players_default.length - 1]);
9342
9505
  var StormcloudPlayer_default = StormcloudPlayer;
9343
- export { IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer_default as StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, canPlay, createHlsAdPlayer, createImaController, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, getBrowserConfigOverrides, getBrowserID, getClientInfo, getRecommendedAdPlayer, initializePolyfills, isMediaStream, lazy, logBrowserInfo, merge, omit, parseQuery, players_default as players, randomString, sendHeartbeat, sendInitialTracking, supportsFeature, supportsGoogleIMA, supportsModernJS, supportsWebKitPresentationMode };
9506
+ export { IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer_default as StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, canPlay, createHlsAdPlayer, createImaController, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, getBrowserConfigOverrides, getBrowserID, getClientInfo, getRecommendedAdPlayer, initializePolyfills, isMediaStream, lazy, logBrowserInfo, merge, omit, parseQuery, players_default as players, randomString, sendAdDetectTracking, sendAdImpressionTracking, sendAdLoadedTracking, sendHeartbeat, sendInitialTracking, supportsFeature, supportsGoogleIMA, supportsModernJS, supportsWebKitPresentationMode };
9344
9507
  //# sourceMappingURL=index.js.map