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.cjs CHANGED
@@ -181,12 +181,22 @@ function _object_spread_props(target, source) {
181
181
  }
182
182
  function _object_without_properties(source, excluded) {
183
183
  if (source == null) return {};
184
- var target = _object_without_properties_loose(source, excluded);
185
- var key, i;
184
+ var target = {}, sourceKeys, key, i;
185
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
186
+ sourceKeys = Reflect.ownKeys(Object(source));
187
+ for(i = 0; i < sourceKeys.length; i++){
188
+ key = sourceKeys[i];
189
+ if (excluded.indexOf(key) >= 0) continue;
190
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
191
+ target[key] = source[key];
192
+ }
193
+ return target;
194
+ }
195
+ target = _object_without_properties_loose(source, excluded);
186
196
  if (Object.getOwnPropertySymbols) {
187
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
188
- for(i = 0; i < sourceSymbolKeys.length; i++){
189
- key = sourceSymbolKeys[i];
197
+ sourceKeys = Object.getOwnPropertySymbols(source);
198
+ for(i = 0; i < sourceKeys.length; i++){
199
+ key = sourceKeys[i];
190
200
  if (excluded.indexOf(key) >= 0) continue;
191
201
  if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
192
202
  target[key] = source[key];
@@ -196,12 +206,11 @@ function _object_without_properties(source, excluded) {
196
206
  }
197
207
  function _object_without_properties_loose(source, excluded) {
198
208
  if (source == null) return {};
199
- var target = {};
200
- var sourceKeys = Object.keys(source);
201
- var key, i;
209
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
202
210
  for(i = 0; i < sourceKeys.length; i++){
203
211
  key = sourceKeys[i];
204
212
  if (excluded.indexOf(key) >= 0) continue;
213
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
205
214
  target[key] = source[key];
206
215
  }
207
216
  return target;
@@ -254,9 +263,17 @@ function _ts_generator(thisArg, body) {
254
263
  },
255
264
  trys: [],
256
265
  ops: []
257
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
258
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
259
- return this;
266
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
267
+ return d(g, "next", {
268
+ value: verb(0)
269
+ }), d(g, "throw", {
270
+ value: verb(1)
271
+ }), d(g, "return", {
272
+ value: verb(2)
273
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
274
+ value: function() {
275
+ return this;
276
+ }
260
277
  }), g;
261
278
  function verb(n) {
262
279
  return function(v) {
@@ -356,20 +373,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
356
373
  var __getOwnPropNames = Object.getOwnPropertyNames;
357
374
  var __getProtoOf = Object.getPrototypeOf;
358
375
  var __hasOwnProp = Object.prototype.hasOwnProperty;
359
- var __export = function(target, all) {
376
+ var __export = function __export(target, all) {
360
377
  for(var name in all)__defProp(target, name, {
361
378
  get: all[name],
362
379
  enumerable: true
363
380
  });
364
381
  };
365
- var __copyProps = function(to, from, except, desc) {
382
+ var __copyProps = function __copyProps(to, from, except, desc) {
366
383
  if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
367
384
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
368
385
  try {
369
386
  var _loop = function() {
370
387
  var key = _step.value;
371
388
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
372
- get: function() {
389
+ get: function get() {
373
390
  return from[key];
374
391
  },
375
392
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -393,7 +410,7 @@ var __copyProps = function(to, from, except, desc) {
393
410
  }
394
411
  return to;
395
412
  };
396
- var __toESM = function(mod, isNodeMode, target) {
413
+ var __toESM = function __toESM(mod, isNodeMode, target) {
397
414
  return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
398
415
  // file that has been converted to a CommonJS file using a Babel-
399
416
  // compatible transform (i.e. "__esModule" has not been set), then set
@@ -403,7 +420,7 @@ var __toESM = function(mod, isNodeMode, target) {
403
420
  enumerable: true
404
421
  }) : target, mod);
405
422
  };
406
- var __toCommonJS = function(mod) {
423
+ var __toCommonJS = function __toCommonJS(mod) {
407
424
  return __copyProps(__defProp({}, "__esModule", {
408
425
  value: true
409
426
  }), mod);
@@ -411,106 +428,115 @@ var __toCommonJS = function(mod) {
411
428
  // src/index.ts
412
429
  var index_exports = {};
413
430
  __export(index_exports, {
414
- IS_BROWSER: function() {
431
+ IS_BROWSER: function IS_BROWSER1() {
415
432
  return IS_BROWSER;
416
433
  },
417
- IS_GLOBAL: function() {
434
+ IS_GLOBAL: function IS_GLOBAL1() {
418
435
  return IS_GLOBAL;
419
436
  },
420
- IS_IOS: function() {
437
+ IS_IOS: function IS_IOS1() {
421
438
  return IS_IOS;
422
439
  },
423
- IS_SAFARI: function() {
440
+ IS_SAFARI: function IS_SAFARI1() {
424
441
  return IS_SAFARI;
425
442
  },
426
- SUPPORTS_DASH: function() {
443
+ SUPPORTS_DASH: function SUPPORTS_DASH1() {
427
444
  return SUPPORTS_DASH;
428
445
  },
429
- SUPPORTS_HLS: function() {
446
+ SUPPORTS_HLS: function SUPPORTS_HLS1() {
430
447
  return SUPPORTS_HLS;
431
448
  },
432
- StormcloudPlayer: function() {
449
+ StormcloudPlayer: function StormcloudPlayer() {
433
450
  return StormcloudPlayer_default;
434
451
  },
435
- StormcloudVideoPlayer: function() {
452
+ StormcloudVideoPlayer: function StormcloudVideoPlayer1() {
436
453
  return StormcloudVideoPlayer;
437
454
  },
438
- StormcloudVideoPlayerComponent: function() {
455
+ StormcloudVideoPlayerComponent: function StormcloudVideoPlayerComponent1() {
439
456
  return StormcloudVideoPlayerComponent;
440
457
  },
441
- canPlay: function() {
458
+ canPlay: function canPlay1() {
442
459
  return canPlay;
443
460
  },
444
- createHlsAdPlayer: function() {
461
+ createHlsAdPlayer: function createHlsAdPlayer1() {
445
462
  return createHlsAdPlayer;
446
463
  },
447
- createImaController: function() {
464
+ createImaController: function createImaController1() {
448
465
  return createImaController;
449
466
  },
450
- createStormcloudPlayer: function() {
467
+ createStormcloudPlayer: function createStormcloudPlayer1() {
451
468
  return createStormcloudPlayer;
452
469
  },
453
- default: function() {
470
+ default: function _default() {
454
471
  return StormcloudVideoPlayerComponent;
455
472
  },
456
- detectBrowser: function() {
473
+ detectBrowser: function detectBrowser1() {
457
474
  return detectBrowser;
458
475
  },
459
- getBrowserConfigOverrides: function() {
476
+ getBrowserConfigOverrides: function getBrowserConfigOverrides1() {
460
477
  return getBrowserConfigOverrides;
461
478
  },
462
- getBrowserID: function() {
479
+ getBrowserID: function getBrowserID1() {
463
480
  return getBrowserID;
464
481
  },
465
- getClientInfo: function() {
482
+ getClientInfo: function getClientInfo1() {
466
483
  return getClientInfo;
467
484
  },
468
- getRecommendedAdPlayer: function() {
485
+ getRecommendedAdPlayer: function getRecommendedAdPlayer1() {
469
486
  return getRecommendedAdPlayer;
470
487
  },
471
- initializePolyfills: function() {
488
+ initializePolyfills: function initializePolyfills1() {
472
489
  return initializePolyfills;
473
490
  },
474
- isMediaStream: function() {
491
+ isMediaStream: function isMediaStream1() {
475
492
  return isMediaStream;
476
493
  },
477
- lazy: function() {
494
+ lazy: function lazy1() {
478
495
  return lazy;
479
496
  },
480
- logBrowserInfo: function() {
497
+ logBrowserInfo: function logBrowserInfo1() {
481
498
  return logBrowserInfo;
482
499
  },
483
- merge: function() {
500
+ merge: function merge1() {
484
501
  return merge;
485
502
  },
486
- omit: function() {
503
+ omit: function omit1() {
487
504
  return omit;
488
505
  },
489
- parseQuery: function() {
506
+ parseQuery: function parseQuery1() {
490
507
  return parseQuery;
491
508
  },
492
- players: function() {
509
+ players: function players() {
493
510
  return players_default;
494
511
  },
495
- randomString: function() {
512
+ randomString: function randomString1() {
496
513
  return randomString;
497
514
  },
498
- sendHeartbeat: function() {
515
+ sendAdDetectTracking: function sendAdDetectTracking1() {
516
+ return sendAdDetectTracking;
517
+ },
518
+ sendAdImpressionTracking: function sendAdImpressionTracking1() {
519
+ return sendAdImpressionTracking;
520
+ },
521
+ sendAdLoadedTracking: function sendAdLoadedTracking1() {
522
+ return sendAdLoadedTracking;
523
+ },
524
+ sendHeartbeat: function sendHeartbeat1() {
499
525
  return sendHeartbeat;
500
526
  },
501
- sendInitialTracking: function() {
527
+ sendInitialTracking: function sendInitialTracking1() {
502
528
  return sendInitialTracking;
503
529
  },
504
- supportsFeature: function() {
530
+ supportsFeature: function supportsFeature1() {
505
531
  return supportsFeature;
506
532
  },
507
- supportsGoogleIMA: function() {
533
+ supportsGoogleIMA: function supportsGoogleIMA1() {
508
534
  return supportsGoogleIMA;
509
535
  },
510
- supportsModernJS: function() {
536
+ supportsModernJS: function supportsModernJS1() {
511
537
  return supportsModernJS;
512
538
  },
513
- supportsWebKitPresentationMode: function() {
539
+ supportsWebKitPresentationMode: function supportsWebKitPresentationMode1() {
514
540
  return supportsWebKitPresentationMode;
515
541
  }
516
542
  });
@@ -875,7 +901,7 @@ function createImaController(video, options) {
875
901
  var fn = _step.value;
876
902
  try {
877
903
  fn(payload);
878
- } catch (e) {}
904
+ } catch (unused) {}
879
905
  }
880
906
  } catch (err) {
881
907
  _didIteratorError = true;
@@ -913,7 +939,7 @@ function createImaController(video, options) {
913
939
  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'.");
914
940
  }
915
941
  }
916
- } catch (e) {}
942
+ } catch (unused) {}
917
943
  if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
918
944
  var existing = document.querySelector('script[data-ima="true"]');
919
945
  if (existing) {
@@ -955,9 +981,6 @@ function createImaController(video, options) {
955
981
  var adDisplayContainer;
956
982
  var adContainerEl;
957
983
  var lastAdTagUrl;
958
- var retryAttempts = 0;
959
- var maxRetries = 2;
960
- var backoffBaseMs = 500;
961
984
  var adsLoadedPromise;
962
985
  var adsLoadedResolve;
963
986
  var adsLoadedReject;
@@ -1161,7 +1184,7 @@ function createImaController(video, options) {
1161
1184
  if (adsManager) {
1162
1185
  try {
1163
1186
  adsManager.destroy();
1164
- } catch (e) {}
1187
+ } catch (unused) {}
1165
1188
  adsManager = void 0;
1166
1189
  }
1167
1190
  if (adVideoElement) {
@@ -1172,7 +1195,7 @@ function createImaController(video, options) {
1172
1195
  if (adsLoader) {
1173
1196
  try {
1174
1197
  adsLoader.destroy();
1175
- } catch (e) {}
1198
+ } catch (unused) {}
1176
1199
  adsLoader = void 0;
1177
1200
  }
1178
1201
  }
@@ -1190,7 +1213,7 @@ function createImaController(video, options) {
1190
1213
  try {
1191
1214
  var _adDisplayContainer_initialize;
1192
1215
  (_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
1193
- } catch (e) {}
1216
+ } catch (unused) {}
1194
1217
  }
1195
1218
  }).catch(function() {});
1196
1219
  },
@@ -1254,7 +1277,6 @@ function createImaController(video, options) {
1254
1277
  _state.sent();
1255
1278
  google = window.google;
1256
1279
  lastAdTagUrl = vastTagUrl;
1257
- retryAttempts = 0;
1258
1280
  if (!adDisplayContainer) {
1259
1281
  container = document.createElement("div");
1260
1282
  container.style.position = "absolute";
@@ -1338,32 +1360,23 @@ function createImaController(video, options) {
1338
1360
  }
1339
1361
  }, 300);
1340
1362
  }
1341
- hideContentVideo();
1363
+ showContentVideo();
1342
1364
  if (adsLoadedReject) {
1343
1365
  adsLoadedReject(new Error("Ad playback error"));
1344
1366
  adsLoadedReject = void 0;
1345
1367
  adsLoadedResolve = void 0;
1346
1368
  }
1347
- if (lastAdTagUrl && retryAttempts < maxRetries && !isNoFill) {
1348
- var delay = backoffBaseMs * Math.pow(2, retryAttempts++);
1349
- window.setTimeout(function() {
1350
- try {
1351
- makeAdsRequest(google, lastAdTagUrl);
1352
- } catch (e) {}
1353
- }, delay);
1354
- } else {
1355
- emit("ad_error", {
1356
- code: errorCode,
1357
- vastErrorCode: vastErrorCode,
1358
- message: errorMessage,
1359
- cause: innerError,
1360
- isNoFill: isNoFill
1361
- });
1362
- if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
1363
- if (video.paused) {
1364
- var _video_play;
1365
- (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
1366
- }
1369
+ emit("ad_error", {
1370
+ code: errorCode,
1371
+ vastErrorCode: vastErrorCode,
1372
+ message: errorMessage,
1373
+ cause: innerError,
1374
+ isNoFill: isNoFill
1375
+ });
1376
+ if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
1377
+ if (video.paused) {
1378
+ var _video_play;
1379
+ (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
1367
1380
  }
1368
1381
  }
1369
1382
  });
@@ -1381,7 +1394,7 @@ function createImaController(video, options) {
1381
1394
  if (adsManager) {
1382
1395
  try {
1383
1396
  adsManager.setVolume(adVolume);
1384
- } catch (e) {}
1397
+ } catch (unused) {}
1385
1398
  }
1386
1399
  emit("content_pause");
1387
1400
  });
@@ -1395,7 +1408,7 @@ function createImaController(video, options) {
1395
1408
  if (adsManager) {
1396
1409
  try {
1397
1410
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1398
- } catch (e) {}
1411
+ } catch (unused) {}
1399
1412
  }
1400
1413
  }
1401
1414
  if (adContainerEl) {
@@ -1409,7 +1422,7 @@ function createImaController(video, options) {
1409
1422
  adsManager.addEventListener(AdEvent.CONTENT_RESUME_REQUESTED, function() {
1410
1423
  adPlaying = false;
1411
1424
  setAdPlayingFlag(false);
1412
- hideContentVideo();
1425
+ showContentVideo();
1413
1426
  emit("content_resume");
1414
1427
  });
1415
1428
  adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, function() {
@@ -1425,7 +1438,7 @@ function createImaController(video, options) {
1425
1438
  }
1426
1439
  }, 300);
1427
1440
  }
1428
- hideContentVideo();
1441
+ showContentVideo();
1429
1442
  emit("all_ads_completed");
1430
1443
  });
1431
1444
  if (adsLoadedResolve) {
@@ -1447,7 +1460,7 @@ function createImaController(video, options) {
1447
1460
  }
1448
1461
  }, 300);
1449
1462
  }
1450
- hideContentVideo();
1463
+ showContentVideo();
1451
1464
  if (adsLoadedReject) {
1452
1465
  adsLoadedReject(new Error("Failed to setup ads manager"));
1453
1466
  adsLoadedReject = void 0;
@@ -1490,7 +1503,7 @@ function createImaController(video, options) {
1490
1503
  }
1491
1504
  }, 300);
1492
1505
  }
1493
- hideContentVideo();
1506
+ showContentVideo();
1494
1507
  if (adsLoadedReject) {
1495
1508
  adsLoadedReject(new Error(isNoFill ? "No ads available" : "Ads loader error"));
1496
1509
  adsLoadedReject = void 0;
@@ -1556,7 +1569,7 @@ function createImaController(video, options) {
1556
1569
  }
1557
1570
  try {
1558
1571
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1559
- } catch (e) {}
1572
+ } catch (unused) {}
1560
1573
  adsManager.start();
1561
1574
  return [
1562
1575
  2,
@@ -1638,7 +1651,7 @@ function createImaController(video, options) {
1638
1651
  try {
1639
1652
  ;
1640
1653
  adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
1641
- } catch (e) {}
1654
+ } catch (unused) {}
1642
1655
  destroyAdsManager();
1643
1656
  return [
1644
1657
  2
@@ -1669,7 +1682,7 @@ function createImaController(video, options) {
1669
1682
  try {
1670
1683
  var _adsLoader_destroy;
1671
1684
  adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
1672
- } catch (e) {}
1685
+ } catch (unused) {}
1673
1686
  adDisplayContainer = void 0;
1674
1687
  adsLoader = void 0;
1675
1688
  contentVideoHidden = false;
@@ -1718,7 +1731,7 @@ function createImaController(video, options) {
1718
1731
  if (adsManager && adPlaying) {
1719
1732
  try {
1720
1733
  adsManager.setVolume(clampedVolume);
1721
- } catch (e) {}
1734
+ } catch (unused) {}
1722
1735
  }
1723
1736
  },
1724
1737
  getAdVolume: function getAdVolume() {
@@ -2822,9 +2835,6 @@ function sendInitialTracking(licenseKey) {
2822
2835
  headers = {
2823
2836
  "Content-Type": "application/json"
2824
2837
  };
2825
- if (licenseKey) {
2826
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2827
- }
2828
2838
  return [
2829
2839
  4,
2830
2840
  fetch("https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/track", {
@@ -2930,6 +2940,234 @@ function sendHeartbeat(licenseKey) {
2930
2940
  });
2931
2941
  })();
2932
2942
  }
2943
+ var TRACK_API_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/track";
2944
+ function mapToAdTrackingSource(source, adPlayerType) {
2945
+ if (source === "prebid" || source === "ima" || source === "hls") {
2946
+ return source;
2947
+ }
2948
+ if (source === "preload" || source === "ssp") {
2949
+ return source === "ssp" ? "prebid" : "ima";
2950
+ }
2951
+ return adPlayerType === "hls" ? "hls" : "ima";
2952
+ }
2953
+ function postAdTracking(licenseKey, body) {
2954
+ return _async_to_generator(function() {
2955
+ var headers, response;
2956
+ return _ts_generator(this, function(_state) {
2957
+ switch(_state.label){
2958
+ case 0:
2959
+ headers = {
2960
+ "Content-Type": "application/json"
2961
+ };
2962
+ if (licenseKey) {
2963
+ headers["Authorization"] = "Bearer ".concat(licenseKey);
2964
+ }
2965
+ return [
2966
+ 4,
2967
+ fetch(TRACK_API_URL, {
2968
+ method: "POST",
2969
+ headers: headers,
2970
+ body: JSON.stringify(body)
2971
+ })
2972
+ ];
2973
+ case 1:
2974
+ response = _state.sent();
2975
+ if (!response.ok) {
2976
+ throw new Error("HTTP error! status: ".concat(response.status));
2977
+ }
2978
+ return [
2979
+ 4,
2980
+ response.json()
2981
+ ];
2982
+ case 2:
2983
+ _state.sent();
2984
+ return [
2985
+ 2
2986
+ ];
2987
+ }
2988
+ });
2989
+ })();
2990
+ }
2991
+ function sendAdDetectTracking(licenseKey, payload) {
2992
+ return _async_to_generator(function() {
2993
+ var _payload_source, _payload_timestamp, clientInfo, browserId, adDetectInfo, body, error;
2994
+ return _ts_generator(this, function(_state) {
2995
+ switch(_state.label){
2996
+ case 0:
2997
+ _state.trys.push([
2998
+ 0,
2999
+ 3,
3000
+ ,
3001
+ 4
3002
+ ]);
3003
+ clientInfo = getClientInfo();
3004
+ return [
3005
+ 4,
3006
+ getBrowserID(clientInfo)
3007
+ ];
3008
+ case 1:
3009
+ browserId = _state.sent();
3010
+ adDetectInfo = _object_spread({
3011
+ source: (_payload_source = payload.source) !== null && _payload_source !== void 0 ? _payload_source : "scte35",
3012
+ timestamp: (_payload_timestamp = payload.timestamp) !== null && _payload_timestamp !== void 0 ? _payload_timestamp : /* @__PURE__ */ new Date().toISOString()
3013
+ }, payload.durationSeconds != null && {
3014
+ durationSeconds: payload.durationSeconds
3015
+ }, payload.ptsSeconds != null && {
3016
+ ptsSeconds: payload.ptsSeconds
3017
+ }, payload.detectedAtFragmentSn != null && {
3018
+ detectedAtFragmentSn: payload.detectedAtFragmentSn
3019
+ });
3020
+ body = _object_spread_props(_object_spread({
3021
+ browserId: browserId
3022
+ }, clientInfo, licenseKey && {
3023
+ licenseKey: licenseKey
3024
+ }), {
3025
+ adDetectInfo: adDetectInfo
3026
+ });
3027
+ return [
3028
+ 4,
3029
+ postAdTracking(licenseKey, body)
3030
+ ];
3031
+ case 2:
3032
+ _state.sent();
3033
+ return [
3034
+ 3,
3035
+ 4
3036
+ ];
3037
+ case 3:
3038
+ error = _state.sent();
3039
+ console.error("[StormcloudVideoPlayer] Error sending ad-detect tracking:", error);
3040
+ return [
3041
+ 3,
3042
+ 4
3043
+ ];
3044
+ case 4:
3045
+ return [
3046
+ 2
3047
+ ];
3048
+ }
3049
+ });
3050
+ })();
3051
+ }
3052
+ function sendAdLoadedTracking(licenseKey, payload, adPlayerType) {
3053
+ return _async_to_generator(function() {
3054
+ var clientInfo, browserId, source, adLoadedInfo, body, error;
3055
+ return _ts_generator(this, function(_state) {
3056
+ switch(_state.label){
3057
+ case 0:
3058
+ _state.trys.push([
3059
+ 0,
3060
+ 3,
3061
+ ,
3062
+ 4
3063
+ ]);
3064
+ clientInfo = getClientInfo();
3065
+ return [
3066
+ 4,
3067
+ getBrowserID(clientInfo)
3068
+ ];
3069
+ case 1:
3070
+ browserId = _state.sent();
3071
+ source = mapToAdTrackingSource(payload.source, adPlayerType);
3072
+ adLoadedInfo = _object_spread({
3073
+ source: source,
3074
+ timestamp: /* @__PURE__ */ new Date().toISOString()
3075
+ }, payload.vastUrl != null && {
3076
+ vastUrl: payload.vastUrl
3077
+ }, payload.durationSeconds != null && {
3078
+ durationSeconds: payload.durationSeconds
3079
+ });
3080
+ body = _object_spread_props(_object_spread({
3081
+ browserId: browserId
3082
+ }, clientInfo, licenseKey && {
3083
+ licenseKey: licenseKey
3084
+ }), {
3085
+ adLoadedInfo: adLoadedInfo
3086
+ });
3087
+ return [
3088
+ 4,
3089
+ postAdTracking(licenseKey, body)
3090
+ ];
3091
+ case 2:
3092
+ _state.sent();
3093
+ return [
3094
+ 3,
3095
+ 4
3096
+ ];
3097
+ case 3:
3098
+ error = _state.sent();
3099
+ console.error("[StormcloudVideoPlayer] Error sending ad-loaded tracking:", error);
3100
+ return [
3101
+ 3,
3102
+ 4
3103
+ ];
3104
+ case 4:
3105
+ return [
3106
+ 2
3107
+ ];
3108
+ }
3109
+ });
3110
+ })();
3111
+ }
3112
+ function sendAdImpressionTracking(licenseKey, payload, adPlayerType) {
3113
+ return _async_to_generator(function() {
3114
+ var clientInfo, browserId, source, adImpressionInfo, body, error;
3115
+ return _ts_generator(this, function(_state) {
3116
+ switch(_state.label){
3117
+ case 0:
3118
+ _state.trys.push([
3119
+ 0,
3120
+ 3,
3121
+ ,
3122
+ 4
3123
+ ]);
3124
+ clientInfo = getClientInfo();
3125
+ return [
3126
+ 4,
3127
+ getBrowserID(clientInfo)
3128
+ ];
3129
+ case 1:
3130
+ browserId = _state.sent();
3131
+ source = mapToAdTrackingSource(payload.source, adPlayerType);
3132
+ adImpressionInfo = _object_spread({
3133
+ source: source,
3134
+ adIndex: payload.adIndex,
3135
+ timestamp: /* @__PURE__ */ new Date().toISOString()
3136
+ }, payload.durationSeconds != null && {
3137
+ durationSeconds: payload.durationSeconds
3138
+ });
3139
+ body = _object_spread_props(_object_spread({
3140
+ browserId: browserId
3141
+ }, clientInfo, licenseKey && {
3142
+ licenseKey: licenseKey
3143
+ }), {
3144
+ adImpressionInfo: adImpressionInfo
3145
+ });
3146
+ return [
3147
+ 4,
3148
+ postAdTracking(licenseKey, body)
3149
+ ];
3150
+ case 2:
3151
+ _state.sent();
3152
+ return [
3153
+ 3,
3154
+ 4
3155
+ ];
3156
+ case 3:
3157
+ error = _state.sent();
3158
+ console.error("[StormcloudVideoPlayer] Error sending ad-impression tracking:", error);
3159
+ return [
3160
+ 3,
3161
+ 4
3162
+ ];
3163
+ case 4:
3164
+ return [
3165
+ 2
3166
+ ];
3167
+ }
3168
+ });
3169
+ })();
3170
+ }
2933
3171
  // src/utils/polyfills.ts
2934
3172
  function polyfillURLSearchParams() {
2935
3173
  if (typeof URLSearchParams !== "undefined") {
@@ -3211,18 +3449,26 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3211
3449
  this.maxPlaceholderDurationMs = 5e3;
3212
3450
  this.isShowingPlaceholder = false;
3213
3451
  this.totalAdRequestsInBreak = 0;
3214
- this.maxTotalAdRequestsPerBreak = 20;
3452
+ this.maxTotalAdRequestsPerBreak = 10;
3215
3453
  this.pendingAdBreak = null;
3216
3454
  this.consecutiveFailures = 0;
3217
3455
  this.maxConsecutiveFailures = 5;
3218
3456
  this.lastAdRequestTime = 0;
3219
- this.minAdRequestIntervalMs = 2500;
3457
+ this.minAdRequestIntervalMs = 3e3;
3220
3458
  this.backoffBaseMs = 1e3;
3221
3459
  this.maxBackoffMs = 15e3;
3460
+ this.globalConsecutiveNoFills = 0;
3461
+ this.globalNoFillThreshold = 3;
3462
+ this.globalNoFillCooldownUntil = 0;
3463
+ this.globalNoFillBackoffBaseMs = 5e3;
3464
+ this.globalNoFillBackoffMaxMs = 6e4;
3465
+ this.globalLastGamRequestTime = 0;
3466
+ this.globalMinGamIntervalMs = 3e3;
3222
3467
  this.preloadPool = [];
3223
- this.maxPreloadPoolSize = 3;
3468
+ this.maxPreloadPoolSize = 2;
3224
3469
  this.preloadPoolActive = false;
3225
3470
  this.preloadPoolLoopRunning = false;
3471
+ this.adDetectSentForCurrentBreak = false;
3226
3472
  this.continuousFetchLoopRunning = false;
3227
3473
  initializePolyfills();
3228
3474
  var browserOverrides = getBrowserConfigOverrides();
@@ -3363,7 +3609,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3363
3609
  });
3364
3610
  this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
3365
3611
  return _async_to_generator(function() {
3366
- var _this_hls_levels, _this_hls, _this_hls_levels_some, adBehavior, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
3612
+ var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
3367
3613
  return _ts_generator(this, function(_state) {
3368
3614
  switch(_state.label){
3369
3615
  case 0:
@@ -3372,10 +3618,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3372
3618
  } else {
3373
3619
  ;
3374
3620
  ;
3375
- 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) {
3621
+ 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) {
3376
3622
  var _level_details, _level_details1;
3377
3623
  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";
3378
- })) !== null && _this_hls_levels_some !== void 0 ? _this_hls_levels_some : false;
3624
+ })) !== null && _ref !== void 0 ? _ref : false;
3379
3625
  }
3380
3626
  if (this.config.debugAdTiming) {
3381
3627
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -3439,9 +3685,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3439
3685
  var tag = "";
3440
3686
  var value = "";
3441
3687
  if (Array.isArray(entry)) {
3442
- var _entry_;
3688
+ var _entry_, _entry_1;
3443
3689
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
3444
- var _entry_1;
3445
3690
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
3446
3691
  } else if (typeof entry === "string") {
3447
3692
  var idx = entry.indexOf(":");
@@ -3564,9 +3809,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3564
3809
  var tag = "";
3565
3810
  var value = "";
3566
3811
  if (Array.isArray(entry)) {
3567
- var _entry_;
3812
+ var _entry_, _entry_1;
3568
3813
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
3569
- var _entry_1;
3570
3814
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
3571
3815
  } else if (typeof entry === "string") {
3572
3816
  var idx = entry.indexOf(":");
@@ -3616,10 +3860,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3616
3860
  }
3617
3861
  });
3618
3862
  } else if (tag.includes("EXT-X-DATERANGE")) {
3863
+ var _attrs_CLASS;
3619
3864
  var attrs = _this.parseAttributeList(value);
3620
3865
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
3621
3866
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
3622
- var _attrs_CLASS;
3623
3867
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
3624
3868
  var duration = _this.toNumber(attrs["DURATION"]);
3625
3869
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -3694,6 +3938,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3694
3938
  value: function attachImaEventListeners() {
3695
3939
  var _this = this;
3696
3940
  this.ima.on("all_ads_completed", function() {
3941
+ sendAdImpressionTracking(_this.config.licenseKey, {
3942
+ adIndex: _this.currentAdIndex
3943
+ }, _this.config.adPlayerType).catch(function() {});
3697
3944
  var remaining = _this.getRemainingAdMs();
3698
3945
  _this.consecutiveFailures = 0;
3699
3946
  if (_this.config.debugAdTiming) {
@@ -3733,6 +3980,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3733
3980
  _this.clearAdRequestWatchdog();
3734
3981
  _this.activeAdRequestToken = null;
3735
3982
  _this.showAds = true;
3983
+ _this.resetGamNoFillCounter();
3736
3984
  if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null) {
3737
3985
  if (_this.adStopTimerId == null) {
3738
3986
  _this.currentAdBreakStartWallClockMs = Date.now();
@@ -3755,6 +4003,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3755
4003
  }
3756
4004
  });
3757
4005
  this.ima.on("content_resume", function() {
4006
+ sendAdImpressionTracking(_this.config.licenseKey, {
4007
+ adIndex: _this.currentAdIndex
4008
+ }, _this.config.adPlayerType).catch(function() {});
3758
4009
  if (!_this.video.muted) {
3759
4010
  _this.video.muted = true;
3760
4011
  _this.video.volume = 0;
@@ -4021,11 +4272,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4021
4272
  }
4022
4273
  var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
4023
4274
  if (daterangeMatch) {
4024
- var _daterangeMatch_;
4275
+ var _daterangeMatch_, _attrs_CLASS;
4025
4276
  var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
4026
4277
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4027
4278
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4028
- var _attrs_CLASS;
4029
4279
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4030
4280
  var duration = this.toNumber(attrs["DURATION"]);
4031
4281
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -4101,7 +4351,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4101
4351
  var out = "";
4102
4352
  for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
4103
4353
  return out;
4104
- } catch (e) {
4354
+ } catch (unused) {
4105
4355
  return void 0;
4106
4356
  }
4107
4357
  }
@@ -4120,6 +4370,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4120
4370
  });
4121
4371
  }
4122
4372
  if (marker.type === "start") {
4373
+ var _this_config_immediateManifestAds;
4123
4374
  var _this_pendingAdBreak;
4124
4375
  if (!this.video.muted) {
4125
4376
  this.video.muted = true;
@@ -4138,13 +4389,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4138
4389
  }
4139
4390
  return;
4140
4391
  }
4392
+ if (!this.adDetectSentForCurrentBreak) {
4393
+ this.adDetectSentForCurrentBreak = true;
4394
+ var detectPayload = {};
4395
+ if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
4396
+ if (marker.ptsSeconds != null) detectPayload.ptsSeconds = marker.ptsSeconds;
4397
+ sendAdDetectTracking(this.config.licenseKey, detectPayload).catch(function() {});
4398
+ }
4141
4399
  var hasPrefetchedAds = this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0;
4142
4400
  this.inAdBreak = true;
4143
4401
  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;
4144
4402
  this.expectedAdBreakDurationMs = durationMs;
4145
4403
  this.currentAdBreakStartWallClockMs = Date.now();
4146
4404
  var isManifestMarker = this.isManifestBasedMarker(marker);
4147
- var _this_config_immediateManifestAds;
4148
4405
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
4149
4406
  if (this.config.debugAdTiming) {
4150
4407
  console.log("[StormcloudVideoPlayer] Ad start decision:", {
@@ -4299,9 +4556,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4299
4556
  var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
4300
4557
  var match;
4301
4558
  while((match = regex.exec(value)) !== null){
4302
- var _match_;
4559
+ var _match_, _ref, _match_1;
4303
4560
  var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
4304
- var _match_1, _ref;
4305
4561
  var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
4306
4562
  if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
4307
4563
  rawVal = rawVal.slice(1, -1);
@@ -4646,13 +4902,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4646
4902
  {
4647
4903
  key: "shouldShowNativeControls",
4648
4904
  value: function shouldShowNativeControls() {
4905
+ var _this_config_showCustomControls;
4649
4906
  var streamType = this.getStreamType();
4650
4907
  if (streamType === "other") {
4651
- var _this_config_showCustomControls;
4652
- return !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false);
4908
+ var _this_config_showCustomControls1;
4909
+ return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
4653
4910
  }
4654
- var _this_config_showCustomControls1;
4655
- return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
4911
+ return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
4656
4912
  }
4657
4913
  },
4658
4914
  {
@@ -4697,6 +4953,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4697
4953
  isFetching: false,
4698
4954
  fetchStartTime: Date.now()
4699
4955
  });
4956
+ this.adDetectSentForCurrentBreak = true;
4957
+ var detectPayload = {};
4958
+ if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
4959
+ if (marker.ptsSeconds != null) detectPayload.ptsSeconds = marker.ptsSeconds;
4960
+ if (fragmentSn !== void 0) detectPayload.detectedAtFragmentSn = fragmentSn;
4961
+ sendAdDetectTracking(this.config.licenseKey, detectPayload).catch(function() {});
4700
4962
  if (this.config.debugAdTiming) {
4701
4963
  console.log("[PREFETCH] \uD83D\uDD04 Starting ad prefetch for upcoming ad break");
4702
4964
  console.log("[PREFETCH] \uD83D\uDCCB Pre-generated ".concat(generatedUrls.length, " VAST URLs"));
@@ -4760,6 +5022,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4760
5022
  var _this, loadPromise;
4761
5023
  return _ts_generator(this, function(_state) {
4762
5024
  _this = this;
5025
+ if (this.isGamInCooldown()) {
5026
+ if (this.config.debugAdTiming) {
5027
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping preload");
5028
+ }
5029
+ return [
5030
+ 2
5031
+ ];
5032
+ }
4763
5033
  if (this.preloadPool.some(function(entry) {
4764
5034
  return entry.vastUrl === vastUrl;
4765
5035
  }) || this.failedVastUrls.has(vastUrl) || this.isUrlInCooldown(vastUrl)) {
@@ -4789,26 +5059,32 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4789
5059
  case 1:
4790
5060
  _state.trys.push([
4791
5061
  1,
4792
- 4,
5062
+ 5,
4793
5063
  ,
4794
- 5
5064
+ 6
4795
5065
  ]);
4796
5066
  continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
4797
5067
  preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
4798
5068
  preloadIma.initialize();
4799
- errorListener = function(payload) {
5069
+ errorListener = function errorListener(payload) {
4800
5070
  hasAdError = true;
4801
5071
  adErrorPayload = payload;
4802
5072
  };
4803
5073
  preloadIma.on("ad_error", errorListener);
4804
- errorListenerCleanup = function() {
5074
+ errorListenerCleanup = function errorListenerCleanup() {
4805
5075
  return preloadIma.off("ad_error", errorListener);
4806
5076
  };
4807
5077
  return [
4808
5078
  4,
4809
- preloadIma.requestAds(vastUrl)
5079
+ this.enforceGlobalRateLimit()
4810
5080
  ];
4811
5081
  case 2:
5082
+ _state.sent();
5083
+ return [
5084
+ 4,
5085
+ preloadIma.requestAds(vastUrl)
5086
+ ];
5087
+ case 3:
4812
5088
  _state.sent();
4813
5089
  preloadIma.pause();
4814
5090
  return [
@@ -4817,7 +5093,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4817
5093
  return setTimeout(resolve, 1500);
4818
5094
  })
4819
5095
  ];
4820
- case 3:
5096
+ case 4:
4821
5097
  _state.sent();
4822
5098
  preloadIma.pause();
4823
5099
  if (hasAdError) {
@@ -4826,6 +5102,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4826
5102
  errorListenerCleanup();
4827
5103
  }
4828
5104
  preloadIma.destroy();
5105
+ this.recordGamNoFill();
4829
5106
  if (isNoFill) {
4830
5107
  if (this.config.debugAdTiming) {
4831
5108
  console.log("[PRELOAD-POOL] ⚠️ Ad preload returned no-fill: ".concat(vastUrl));
@@ -4852,7 +5129,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4852
5129
  isReady: true,
4853
5130
  loadPromise: Promise.resolve()
4854
5131
  };
4855
- lateErrorListener = function(payload) {
5132
+ lateErrorListener = function lateErrorListener(payload) {
4856
5133
  var index = _this.preloadPool.findIndex(function(entry) {
4857
5134
  return entry.vastUrl === vastUrl;
4858
5135
  });
@@ -4863,7 +5140,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4863
5140
  }
4864
5141
  try {
4865
5142
  preloadIma.destroy();
4866
- } catch (e) {}
5143
+ } catch (unused) {}
4867
5144
  }
4868
5145
  };
4869
5146
  preloadIma.on("ad_error", lateErrorListener);
@@ -4876,13 +5153,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4876
5153
  }
4877
5154
  return [
4878
5155
  3,
4879
- 5
5156
+ 6
4880
5157
  ];
4881
- case 4:
5158
+ case 5:
4882
5159
  error = _state.sent();
4883
5160
  if (errorListenerCleanup) {
4884
5161
  errorListenerCleanup();
4885
5162
  }
5163
+ this.recordGamNoFill();
4886
5164
  if (this.config.debugAdTiming) {
4887
5165
  console.warn("[PRELOAD-POOL] ⚠️ Failed to preload ad: ".concat(vastUrl), error);
4888
5166
  }
@@ -4893,9 +5171,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4893
5171
  }
4894
5172
  return [
4895
5173
  3,
4896
- 5
5174
+ 6
4897
5175
  ];
4898
- case 5:
5176
+ case 6:
4899
5177
  return [
4900
5178
  2
4901
5179
  ];
@@ -4934,6 +5212,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4934
5212
  3,
4935
5213
  10
4936
5214
  ];
5215
+ if (this.isGamInCooldown()) {
5216
+ if (this.config.debugAdTiming) {
5217
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping preload pool loop");
5218
+ }
5219
+ return [
5220
+ 3,
5221
+ 10
5222
+ ];
5223
+ }
4937
5224
  if (!(!this.inAdBreak && this.preloadPool.length >= this.maxPreloadPoolSize)) return [
4938
5225
  3,
4939
5226
  3
@@ -4966,7 +5253,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4966
5253
  3,
4967
5254
  8
4968
5255
  ];
4969
- if (!this.preloadPoolActive) {
5256
+ if (!this.preloadPoolActive || this.isGamInCooldown()) {
4970
5257
  return [
4971
5258
  3,
4972
5259
  8
@@ -5147,6 +5434,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5147
5434
  firstAdUrl = preloaded.vastUrl;
5148
5435
  preloadedController = preloaded.imaController;
5149
5436
  usePreloadedAd = true;
5437
+ sendAdLoadedTracking(this.config.licenseKey, {
5438
+ source: "preload",
5439
+ vastUrl: firstAdUrl
5440
+ }, this.config.adPlayerType).catch(function() {});
5150
5441
  if (this.config.debugAdTiming) {
5151
5442
  console.log("[CONTINUOUS-FETCH] \uD83D\uDE80 Using preloaded ad from pool (preloaded in advance, ready immediately!)");
5152
5443
  console.log("[CONTINUOUS-FETCH] Pool still has ".concat(this.preloadPool.length, " preloaded ads ready"));
@@ -5182,9 +5473,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5182
5473
  case 1:
5183
5474
  _state.trys.push([
5184
5475
  1,
5185
- 7,
5476
+ 8,
5186
5477
  ,
5187
- 13
5478
+ 14
5188
5479
  ]);
5189
5480
  if (!(usePreloadedAd && preloadedController)) return [
5190
5481
  3,
@@ -5220,16 +5511,26 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5220
5511
  this.ima.setAdVolume(adVolume);
5221
5512
  return [
5222
5513
  3,
5223
- 6
5514
+ 7
5224
5515
  ];
5225
5516
  case 3:
5517
+ return [
5518
+ 4,
5519
+ this.enforceGlobalRateLimit()
5520
+ ];
5521
+ case 4:
5522
+ _state.sent();
5226
5523
  this.lastAdRequestTime = Date.now();
5227
5524
  return [
5228
5525
  4,
5229
5526
  this.ima.requestAds(firstAdUrl)
5230
5527
  ];
5231
- case 4:
5528
+ case 5:
5232
5529
  _state.sent();
5530
+ sendAdLoadedTracking(this.config.licenseKey, {
5531
+ source: "ssp",
5532
+ vastUrl: firstAdUrl
5533
+ }, this.config.adPlayerType).catch(function() {});
5233
5534
  if (this.config.debugAdTiming) {
5234
5535
  console.log("[CONTINUOUS-FETCH] \u2705 First ad request successful, starting playback");
5235
5536
  }
@@ -5243,7 +5544,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5243
5544
  4,
5244
5545
  this.ima.play()
5245
5546
  ];
5246
- case 5:
5547
+ case 6:
5247
5548
  _state.sent();
5248
5549
  if (this.expectedAdBreakDurationMs != null) {
5249
5550
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -5251,36 +5552,36 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5251
5552
  }
5252
5553
  adVolume1 = currentMuted ? 0 : currentVolume;
5253
5554
  this.ima.setAdVolume(adVolume1);
5254
- _state.label = 6;
5255
- case 6:
5555
+ _state.label = 7;
5556
+ case 7:
5256
5557
  return [
5257
5558
  3,
5258
- 13
5559
+ 14
5259
5560
  ];
5260
- case 7:
5561
+ case 8:
5261
5562
  error = _state.sent();
5262
5563
  if (this.config.debugAdTiming) {
5263
5564
  console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
5264
5565
  }
5265
5566
  if (!!usePreloadedAd) return [
5266
5567
  3,
5267
- 11
5568
+ 12
5268
5569
  ];
5269
5570
  fallbackPreloaded = this.getPreloadedAd();
5270
5571
  if (!fallbackPreloaded) return [
5271
5572
  3,
5272
- 11
5573
+ 12
5273
5574
  ];
5274
5575
  if (this.config.debugAdTiming) {
5275
5576
  console.log("[CONTINUOUS-FETCH] \uD83D\uDD04 First ad failed, using preloaded fallback");
5276
5577
  }
5277
- _state.label = 8;
5278
- case 8:
5578
+ _state.label = 9;
5579
+ case 9:
5279
5580
  _state.trys.push([
5280
- 8,
5281
- 10,
5581
+ 9,
5582
+ 11,
5282
5583
  ,
5283
- 11
5584
+ 12
5284
5585
  ]);
5285
5586
  this.ima.destroy();
5286
5587
  this.video.muted = true;
@@ -5299,7 +5600,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5299
5600
  4,
5300
5601
  this.ima.play()
5301
5602
  ];
5302
- case 9:
5603
+ case 10:
5303
5604
  _state.sent();
5304
5605
  if (this.expectedAdBreakDurationMs != null) {
5305
5606
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -5310,16 +5611,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5310
5611
  return [
5311
5612
  2
5312
5613
  ];
5313
- case 10:
5614
+ case 11:
5314
5615
  fallbackError = _state.sent();
5315
5616
  if (this.config.debugAdTiming) {
5316
5617
  console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F Preloaded fallback also failed:", fallbackError);
5317
5618
  }
5318
5619
  return [
5319
5620
  3,
5320
- 11
5621
+ 12
5321
5622
  ];
5322
- case 11:
5623
+ case 12:
5323
5624
  if (this.isTemporaryAdError(error)) {
5324
5625
  this.temporaryFailureUrls.set(firstAdUrl, Date.now());
5325
5626
  if (this.config.debugAdTiming) {
@@ -5337,13 +5638,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5337
5638
  4,
5338
5639
  this.tryNextAvailableAdWithRateLimit()
5339
5640
  ];
5340
- case 12:
5641
+ case 13:
5341
5642
  _state.sent();
5342
5643
  return [
5343
5644
  3,
5344
- 13
5645
+ 14
5345
5646
  ];
5346
- case 13:
5647
+ case 14:
5347
5648
  return [
5348
5649
  2
5349
5650
  ];
@@ -5394,18 +5695,27 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5394
5695
  "break"
5395
5696
  ];
5396
5697
  }
5397
- if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
5698
+ if (_this.isGamInCooldown()) {
5398
5699
  if (_this.config.debugAdTiming) {
5399
- console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
5700
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping URL generation");
5400
5701
  }
5401
5702
  return [
5402
5703
  2,
5403
5704
  "break"
5404
5705
  ];
5405
5706
  }
5406
- if (_this.totalAdRequestsInBreak >= _this.maxTotalAdRequestsPerBreak) {
5707
+ if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
5407
5708
  if (_this.config.debugAdTiming) {
5408
- console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Maximum ad requests reached (".concat(_this.maxTotalAdRequestsPerBreak, "), stopping"));
5709
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
5710
+ }
5711
+ return [
5712
+ 2,
5713
+ "break"
5714
+ ];
5715
+ }
5716
+ if (_this.totalAdRequestsInBreak >= _this.maxTotalAdRequestsPerBreak) {
5717
+ if (_this.config.debugAdTiming) {
5718
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Maximum ad requests reached (".concat(_this.maxTotalAdRequestsPerBreak, "), stopping"));
5409
5719
  }
5410
5720
  return [
5411
5721
  2,
@@ -5590,6 +5900,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5590
5900
  2
5591
5901
  ];
5592
5902
  }
5903
+ if (this.isGamInCooldown()) {
5904
+ if (this.config.debugAdTiming) {
5905
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, ending ad break gracefully");
5906
+ }
5907
+ this.handleAdPodComplete();
5908
+ return [
5909
+ 2
5910
+ ];
5911
+ }
5593
5912
  if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
5594
5913
  if (this.config.debugAdTiming) {
5595
5914
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(this.consecutiveFailures, "), ending ad break"));
@@ -5608,6 +5927,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5608
5927
  if (this.config.debugAdTiming) {
5609
5928
  console.log("[CONTINUOUS-FETCH] \uD83C\uDFAF Using preloaded ad from pool (".concat(this.preloadPool.length, " remaining in pool)"));
5610
5929
  }
5930
+ sendAdLoadedTracking(this.config.licenseKey, {
5931
+ source: "preload",
5932
+ vastUrl: preloaded.vastUrl
5933
+ }, this.config.adPlayerType).catch(function() {});
5611
5934
  _state.label = 1;
5612
5935
  case 1:
5613
5936
  _state.trys.push([
@@ -5786,6 +6109,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5786
6109
  case 0:
5787
6110
  remaining = this.getRemainingAdMs();
5788
6111
  waitTime = Math.min(this.maxPlaceholderDurationMs, remaining);
6112
+ if (this.isGamInCooldown()) {
6113
+ if (this.config.debugAdTiming) {
6114
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping placeholder wait");
6115
+ }
6116
+ this.handleAdPodComplete();
6117
+ return [
6118
+ 2
6119
+ ];
6120
+ }
5789
6121
  if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
5790
6122
  if (this.config.debugAdTiming) {
5791
6123
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Skipping placeholder - too many consecutive failures");
@@ -6049,11 +6381,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6049
6381
  {
6050
6382
  key: "ensureAdStoppedByTimer",
6051
6383
  value: function ensureAdStoppedByTimer() {
6384
+ var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
6052
6385
  if (!this.inAdBreak) return;
6053
6386
  this.adStopTimerId = void 0;
6054
6387
  var adPlaying = this.ima.isAdPlaying();
6055
6388
  var pendingAds = this.adPodQueue.length > 0;
6056
- var _this_config_adBreakCheckIntervalMs;
6057
6389
  var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
6058
6390
  var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
6059
6391
  var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
@@ -6061,7 +6393,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6061
6393
  if (this.currentAdBreakStartWallClockMs != null) {
6062
6394
  elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
6063
6395
  }
6064
- var _this_expectedAdBreakDurationMs;
6065
6396
  var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
6066
6397
  var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
6067
6398
  var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
@@ -6175,6 +6506,73 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6175
6506
  }
6176
6507
  }
6177
6508
  },
6509
+ {
6510
+ key: "isGamInCooldown",
6511
+ value: function isGamInCooldown() {
6512
+ return Date.now() < this.globalNoFillCooldownUntil;
6513
+ }
6514
+ },
6515
+ {
6516
+ key: "recordGamNoFill",
6517
+ value: function recordGamNoFill() {
6518
+ this.globalConsecutiveNoFills++;
6519
+ if (this.globalConsecutiveNoFills >= this.globalNoFillThreshold) {
6520
+ var exponent = this.globalConsecutiveNoFills - this.globalNoFillThreshold;
6521
+ var backoff = Math.min(this.globalNoFillBackoffBaseMs * Math.pow(2, exponent), this.globalNoFillBackoffMaxMs);
6522
+ this.globalNoFillCooldownUntil = Date.now() + backoff;
6523
+ if (this.config.debugAdTiming) {
6524
+ console.log("[CIRCUIT-BREAKER] GAM cooldown activated: ".concat(backoff, "ms (").concat(this.globalConsecutiveNoFills, " consecutive no-fills)"));
6525
+ }
6526
+ }
6527
+ }
6528
+ },
6529
+ {
6530
+ key: "resetGamNoFillCounter",
6531
+ value: function resetGamNoFillCounter() {
6532
+ if (this.globalConsecutiveNoFills > 0 && this.config.debugAdTiming) {
6533
+ console.log("[CIRCUIT-BREAKER] Resetting no-fill counter (was ".concat(this.globalConsecutiveNoFills, ")"));
6534
+ }
6535
+ this.globalConsecutiveNoFills = 0;
6536
+ this.globalNoFillCooldownUntil = 0;
6537
+ }
6538
+ },
6539
+ {
6540
+ key: "enforceGlobalRateLimit",
6541
+ value: function enforceGlobalRateLimit() {
6542
+ return _async_to_generator(function() {
6543
+ var now, elapsed, waitMs;
6544
+ return _ts_generator(this, function(_state) {
6545
+ switch(_state.label){
6546
+ case 0:
6547
+ now = Date.now();
6548
+ elapsed = now - this.globalLastGamRequestTime;
6549
+ if (!(elapsed < this.globalMinGamIntervalMs)) return [
6550
+ 3,
6551
+ 2
6552
+ ];
6553
+ waitMs = this.globalMinGamIntervalMs - elapsed;
6554
+ if (this.config.debugAdTiming) {
6555
+ console.log("[RATE-LIMIT] Waiting ".concat(waitMs, "ms before next GAM request"));
6556
+ }
6557
+ return [
6558
+ 4,
6559
+ new Promise(function(resolve) {
6560
+ return setTimeout(resolve, waitMs);
6561
+ })
6562
+ ];
6563
+ case 1:
6564
+ _state.sent();
6565
+ _state.label = 2;
6566
+ case 2:
6567
+ this.globalLastGamRequestTime = Date.now();
6568
+ return [
6569
+ 2
6570
+ ];
6571
+ }
6572
+ });
6573
+ }).call(this);
6574
+ }
6575
+ },
6178
6576
  {
6179
6577
  key: "playSingleAd",
6180
6578
  value: function playSingleAd(vastTagUrl) {
@@ -6206,6 +6604,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6206
6604
  }
6207
6605
  throw new Error("Too many consecutive failures");
6208
6606
  }
6607
+ if (this.isGamInCooldown()) {
6608
+ if (this.config.debugAdTiming) {
6609
+ console.warn("[CIRCUIT-BREAKER] GAM in cooldown, skipping ad request");
6610
+ }
6611
+ throw new Error("GAM in cooldown");
6612
+ }
6209
6613
  this.recreateImaController();
6210
6614
  requestToken = ++this.adRequestTokenCounter;
6211
6615
  this.activeAdRequestToken = requestToken;
@@ -6214,37 +6618,47 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6214
6618
  case 1:
6215
6619
  _state.trys.push([
6216
6620
  1,
6217
- 11,
6621
+ 12,
6218
6622
  ,
6219
- 16
6623
+ 17
6220
6624
  ]);
6625
+ return [
6626
+ 4,
6627
+ this.enforceGlobalRateLimit()
6628
+ ];
6629
+ case 2:
6630
+ _state.sent();
6221
6631
  this.lastAdRequestTime = Date.now();
6222
6632
  return [
6223
6633
  4,
6224
6634
  this.ima.requestAds(vastTagUrl)
6225
6635
  ];
6226
- case 2:
6636
+ case 3:
6227
6637
  _state.sent();
6638
+ sendAdLoadedTracking(this.config.licenseKey, {
6639
+ source: "ssp",
6640
+ vastUrl: vastTagUrl
6641
+ }, this.config.adPlayerType).catch(function() {});
6228
6642
  this.clearAdRequestWatchdog();
6229
6643
  if (this.activeAdRequestToken !== requestToken) {
6230
6644
  return [
6231
6645
  2
6232
6646
  ];
6233
6647
  }
6234
- _state.label = 3;
6235
- case 3:
6648
+ _state.label = 4;
6649
+ case 4:
6236
6650
  _state.trys.push([
6237
- 3,
6238
- 5,
6651
+ 4,
6652
+ 6,
6239
6653
  ,
6240
- 10
6654
+ 11
6241
6655
  ]);
6242
6656
  this.startAdFailsafeTimer(requestToken);
6243
6657
  return [
6244
6658
  4,
6245
6659
  this.ima.play()
6246
6660
  ];
6247
- case 4:
6661
+ case 5:
6248
6662
  _state.sent();
6249
6663
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6250
6664
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -6258,9 +6672,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6258
6672
  this.temporaryFailureUrls.delete(vastTagUrl);
6259
6673
  return [
6260
6674
  3,
6261
- 10
6675
+ 11
6262
6676
  ];
6263
- case 5:
6677
+ case 6:
6264
6678
  playError = _state.sent();
6265
6679
  if (this.config.debugAdTiming) {
6266
6680
  console.error("[AD-ERROR] Failed to play ad:", playError);
@@ -6268,18 +6682,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6268
6682
  preloadedFallback = this.getPreloadedAd();
6269
6683
  if (!preloadedFallback) return [
6270
6684
  3,
6271
- 9
6685
+ 10
6272
6686
  ];
6273
6687
  if (this.config.debugAdTiming) {
6274
6688
  console.log("[AD-ERROR] Play failed, trying preloaded fallback ad");
6275
6689
  }
6276
- _state.label = 6;
6277
- case 6:
6690
+ _state.label = 7;
6691
+ case 7:
6278
6692
  _state.trys.push([
6279
- 6,
6280
- 8,
6693
+ 7,
6694
+ 9,
6281
6695
  ,
6282
- 9
6696
+ 10
6283
6697
  ]);
6284
6698
  this.clearAdFailsafeTimer();
6285
6699
  this.ima.destroy();
@@ -6295,7 +6709,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6295
6709
  4,
6296
6710
  this.ima.play()
6297
6711
  ];
6298
- case 7:
6712
+ case 8:
6299
6713
  _state.sent();
6300
6714
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6301
6715
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -6308,16 +6722,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6308
6722
  return [
6309
6723
  2
6310
6724
  ];
6311
- case 8:
6725
+ case 9:
6312
6726
  fallbackError = _state.sent();
6313
6727
  if (this.config.debugAdTiming) {
6314
6728
  console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError);
6315
6729
  }
6316
6730
  return [
6317
6731
  3,
6318
- 9
6732
+ 10
6319
6733
  ];
6320
- case 9:
6734
+ case 10:
6321
6735
  if (this.isTemporaryAdError(playError)) {
6322
6736
  this.temporaryFailureUrls.set(vastTagUrl, Date.now());
6323
6737
  if (this.config.debugAdTiming) {
@@ -6334,12 +6748,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6334
6748
  this.activeAdRequestToken = null;
6335
6749
  }
6336
6750
  throw playError;
6337
- case 10:
6751
+ case 11:
6338
6752
  return [
6339
6753
  3,
6340
- 16
6754
+ 17
6341
6755
  ];
6342
- case 11:
6756
+ case 12:
6343
6757
  error = _state.sent();
6344
6758
  errorMessage = (error === null || error === void 0 ? void 0 : error.message) || "";
6345
6759
  if (this.config.debugAdTiming) {
@@ -6348,18 +6762,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6348
6762
  preloadedFallback1 = this.getPreloadedAd();
6349
6763
  if (!preloadedFallback1) return [
6350
6764
  3,
6351
- 15
6765
+ 16
6352
6766
  ];
6353
6767
  if (this.config.debugAdTiming) {
6354
6768
  console.log("[AD-ERROR] Request failed, trying preloaded fallback ad");
6355
6769
  }
6356
- _state.label = 12;
6357
- case 12:
6770
+ _state.label = 13;
6771
+ case 13:
6358
6772
  _state.trys.push([
6359
- 12,
6360
- 14,
6773
+ 13,
6774
+ 15,
6361
6775
  ,
6362
- 15
6776
+ 16
6363
6777
  ]);
6364
6778
  this.clearAdRequestWatchdog();
6365
6779
  this.clearAdFailsafeTimer();
@@ -6376,7 +6790,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6376
6790
  4,
6377
6791
  this.ima.play()
6378
6792
  ];
6379
- case 13:
6793
+ case 14:
6380
6794
  _state.sent();
6381
6795
  currentMuted2 = this.video.muted;
6382
6796
  currentVolume2 = this.video.volume;
@@ -6385,16 +6799,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6385
6799
  return [
6386
6800
  2
6387
6801
  ];
6388
- case 14:
6802
+ case 15:
6389
6803
  fallbackError1 = _state.sent();
6390
6804
  if (this.config.debugAdTiming) {
6391
6805
  console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError1);
6392
6806
  }
6393
6807
  return [
6394
6808
  3,
6395
- 15
6809
+ 16
6396
6810
  ];
6397
- case 15:
6811
+ case 16:
6398
6812
  if (this.isTemporaryAdError(error)) {
6399
6813
  this.temporaryFailureUrls.set(vastTagUrl, Date.now());
6400
6814
  if (this.config.debugAdTiming) {
@@ -6412,7 +6826,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6412
6826
  this.activeAdRequestToken = null;
6413
6827
  }
6414
6828
  throw error;
6415
- case 16:
6829
+ case 17:
6416
6830
  return [
6417
6831
  2
6418
6832
  ];
@@ -6439,6 +6853,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6439
6853
  }
6440
6854
  this.adRequestQueue = [];
6441
6855
  this.inAdBreak = false;
6856
+ this.adDetectSentForCurrentBreak = false;
6442
6857
  this.expectedAdBreakDurationMs = void 0;
6443
6858
  this.currentAdBreakStartWallClockMs = void 0;
6444
6859
  this.clearAdStartTimer();
@@ -6448,6 +6863,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6448
6863
  this.currentAdIndex = 0;
6449
6864
  this.totalAdsInBreak = 0;
6450
6865
  this.consecutiveFailures = 0;
6866
+ this.globalConsecutiveNoFills = 0;
6451
6867
  this.ima.stop().catch(function() {});
6452
6868
  var restoredMuted = this.ima.getOriginalMutedState();
6453
6869
  var restoredVolume = this.ima.getOriginalVolume();
@@ -6479,6 +6895,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6479
6895
  key: "handleAdFailure",
6480
6896
  value: function handleAdFailure() {
6481
6897
  this.consecutiveFailures++;
6898
+ this.recordGamNoFill();
6482
6899
  var remaining = this.getRemainingAdMs();
6483
6900
  if (this.config.debugAdTiming) {
6484
6901
  console.log("[CONTINUOUS-FETCH] Ad failure: remaining=".concat(remaining, "ms, queued ads=").concat(this.adRequestQueue.length, ", consecutiveFailures=").concat(this.consecutiveFailures), this.adRequestQueue.length > 0 ? {
@@ -6506,8 +6923,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6506
6923
  key: "startAdRequestWatchdog",
6507
6924
  value: function startAdRequestWatchdog(token) {
6508
6925
  var _this = this;
6509
- this.clearAdRequestWatchdog();
6510
6926
  var _this_config_adFailsafeTimeoutMs;
6927
+ this.clearAdRequestWatchdog();
6511
6928
  var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
6512
6929
  this.adRequestWatchdogToken = token;
6513
6930
  this.adRequestWatchdogId = window.setTimeout(function() {
@@ -6550,8 +6967,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6550
6967
  key: "startAdFailsafeTimer",
6551
6968
  value: function startAdFailsafeTimer(token) {
6552
6969
  var _this = this;
6553
- this.clearAdFailsafeTimer();
6554
6970
  var _this_config_adFailsafeTimeoutMs;
6971
+ this.clearAdFailsafeTimer();
6555
6972
  var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
6556
6973
  this.adFailsafeToken = token;
6557
6974
  this.adFailsafeTimerId = window.setTimeout(function() {
@@ -6876,6 +7293,7 @@ var CRITICAL_PROPS = [
6876
7293
  "driftToleranceMs",
6877
7294
  "vastMode"
6878
7295
  ];
7296
+ var CONTROLS_HIDE_DELAY = 3e3;
6879
7297
  var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6880
7298
  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, [
6881
7299
  "src",
@@ -6910,6 +7328,8 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6910
7328
  var videoRef = (0, import_react.useRef)(null);
6911
7329
  var playerRef = (0, import_react.useRef)(null);
6912
7330
  var bufferingTimeoutRef = (0, import_react.useRef)(null);
7331
+ var controlsTimerRef = (0, import_react.useRef)(null);
7332
+ var wrapperRef = (0, import_react.useRef)(null);
6913
7333
  var _import_react_default_useState = _sliced_to_array(import_react.default.useState({
6914
7334
  showAds: false,
6915
7335
  currentIndex: 0,
@@ -6929,23 +7349,51 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6929
7349
  var _import_react_default_useState12 = _sliced_to_array(import_react.default.useState(false), 2), isBuffering = _import_react_default_useState12[0], setIsBuffering = _import_react_default_useState12[1];
6930
7350
  var _import_react_default_useState13 = _sliced_to_array(import_react.default.useState(false), 2), showCenterPlay = _import_react_default_useState13[0], setShowCenterPlay = _import_react_default_useState13[1];
6931
7351
  var _import_react_default_useState14 = _sliced_to_array(import_react.default.useState(false), 2), showLicenseWarning = _import_react_default_useState14[0], setShowLicenseWarning = _import_react_default_useState14[1];
6932
- var _import_react_default_useState15 = _sliced_to_array(import_react.default.useState(typeof window !== "undefined" ? window.innerWidth : 1920), 2), viewportWidth = _import_react_default_useState15[0], setViewportWidth = _import_react_default_useState15[1];
6933
- var _import_react_default_useState16 = _sliced_to_array(import_react.default.useState(typeof window !== "undefined" ? window.innerHeight > window.innerWidth : false), 2), isPortrait = _import_react_default_useState16[0], setIsPortrait = _import_react_default_useState16[1];
6934
- var getResponsiveScale = function() {
7352
+ var _import_react_default_useState15 = _sliced_to_array(import_react.default.useState(true), 2), controlsVisible = _import_react_default_useState15[0], setControlsVisible = _import_react_default_useState15[1];
7353
+ var _import_react_default_useState16 = _sliced_to_array(import_react.default.useState(typeof window !== "undefined" ? window.innerWidth : 1920), 2), viewportWidth = _import_react_default_useState16[0], setViewportWidth = _import_react_default_useState16[1];
7354
+ var _import_react_default_useState17 = _sliced_to_array(import_react.default.useState(typeof window !== "undefined" ? window.innerHeight > window.innerWidth : false), 2), isPortrait = _import_react_default_useState17[0], setIsPortrait = _import_react_default_useState17[1];
7355
+ var getResponsiveScale = function getResponsiveScale() {
6935
7356
  if (viewportWidth < 480) return 0.7;
6936
7357
  if (viewportWidth < 768) return 0.8;
6937
7358
  if (viewportWidth < 1024) return 0.9;
6938
7359
  return 1;
6939
7360
  };
6940
7361
  var responsiveScale = getResponsiveScale();
6941
- var formatTime = function(seconds) {
7362
+ var resetControlsTimer = (0, import_react.useCallback)(function() {
7363
+ if (controlsTimerRef.current) {
7364
+ clearTimeout(controlsTimerRef.current);
7365
+ }
7366
+ setControlsVisible(true);
7367
+ controlsTimerRef.current = window.setTimeout(function() {
7368
+ if (!showVolumeSlider && !showSpeedMenu) {
7369
+ setControlsVisible(false);
7370
+ }
7371
+ }, CONTROLS_HIDE_DELAY);
7372
+ }, [
7373
+ showVolumeSlider,
7374
+ showSpeedMenu
7375
+ ]);
7376
+ var handleWrapperMouseMove = (0, import_react.useCallback)(function() {
7377
+ resetControlsTimer();
7378
+ }, [
7379
+ resetControlsTimer
7380
+ ]);
7381
+ var handleWrapperMouseLeave = (0, import_react.useCallback)(function() {
7382
+ if (!showVolumeSlider && !showSpeedMenu) {
7383
+ setControlsVisible(false);
7384
+ }
7385
+ }, [
7386
+ showVolumeSlider,
7387
+ showSpeedMenu
7388
+ ]);
7389
+ var formatTime = function formatTime(seconds) {
6942
7390
  if (!isFinite(seconds)) return "0:00:00";
6943
7391
  var hours = Math.floor(seconds / 3600);
6944
7392
  var minutes = Math.floor(seconds % 3600 / 60);
6945
7393
  var remainingSeconds = Math.floor(seconds % 60);
6946
7394
  return "".concat(hours, ":").concat(minutes.toString().padStart(2, "0"), ":").concat(remainingSeconds.toString().padStart(2, "0"));
6947
7395
  };
6948
- var handlePlayPause = function() {
7396
+ var handlePlayPause = function handlePlayPause() {
6949
7397
  if (videoRef.current) {
6950
7398
  if (videoRef.current.paused) {
6951
7399
  var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
@@ -6963,8 +7411,9 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6963
7411
  setShowCenterPlay(true);
6964
7412
  }
6965
7413
  }
7414
+ resetControlsTimer();
6966
7415
  };
6967
- var handleCenterPlayClick = function() {
7416
+ var handleCenterPlayClick = function handleCenterPlayClick() {
6968
7417
  if (videoRef.current && videoRef.current.paused) {
6969
7418
  var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
6970
7419
  if (hasValidSource) {
@@ -6978,7 +7427,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6978
7427
  }
6979
7428
  }
6980
7429
  };
6981
- var handleTimelineSeek = function(e) {
7430
+ var handleTimelineSeek = function handleTimelineSeek(e) {
6982
7431
  if (videoRef.current && duration > 0 && isFinite(duration)) {
6983
7432
  var rect = e.currentTarget.getBoundingClientRect();
6984
7433
  var clickX = e.clientX - rect.left;
@@ -6988,14 +7437,15 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6988
7437
  videoRef.current.currentTime = newTime;
6989
7438
  }
6990
7439
  }
7440
+ resetControlsTimer();
6991
7441
  };
6992
- var handleVolumeChange = function(newVolume) {
7442
+ var handleVolumeChange = function handleVolumeChange(newVolume) {
6993
7443
  if (playerRef.current && isFinite(newVolume)) {
6994
7444
  var clampedVolume = Math.max(0, Math.min(1, newVolume));
6995
7445
  playerRef.current.setVolume(clampedVolume);
6996
7446
  }
6997
7447
  };
6998
- var handlePlaybackRateChange = function(rate) {
7448
+ var handlePlaybackRateChange = function handlePlaybackRateChange(rate) {
6999
7449
  if (videoRef.current && isFinite(rate) && rate > 0) {
7000
7450
  videoRef.current.playbackRate = rate;
7001
7451
  }
@@ -7032,7 +7482,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7032
7482
  if (playerRef.current) {
7033
7483
  try {
7034
7484
  playerRef.current.destroy();
7035
- } catch (e) {}
7485
+ } catch (unused) {}
7036
7486
  playerRef.current = null;
7037
7487
  }
7038
7488
  var cfg = {
@@ -7072,7 +7522,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7072
7522
  return function() {
7073
7523
  try {
7074
7524
  player.destroy();
7075
- } catch (e) {}
7525
+ } catch (unused) {}
7076
7526
  playerRef.current = null;
7077
7527
  };
7078
7528
  }, [
@@ -7096,7 +7546,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7096
7546
  ]);
7097
7547
  (0, import_react.useEffect)(function() {
7098
7548
  if (!playerRef.current) return;
7099
- var checkAdStatus = function() {
7549
+ var checkAdStatus = function checkAdStatus() {
7100
7550
  if (playerRef.current) {
7101
7551
  var _videoRef_current_dataset, _videoRef_current;
7102
7552
  var showAdsFromMethod = playerRef.current.isShowingAds();
@@ -7126,7 +7576,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7126
7576
  }, []);
7127
7577
  (0, import_react.useEffect)(function() {
7128
7578
  if (typeof window === "undefined" || !playerRef.current) return;
7129
- var handleResize = function() {
7579
+ var handleResize = function handleResize() {
7130
7580
  if (playerRef.current && videoRef.current) {
7131
7581
  if (typeof playerRef.current.resize === "function") {
7132
7582
  playerRef.current.resize();
@@ -7142,8 +7592,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7142
7592
  }, []);
7143
7593
  (0, import_react.useEffect)(function() {
7144
7594
  if (!playerRef.current || !videoRef.current) return;
7145
- var updateStates = function() {
7146
- var _videoRef_current;
7595
+ var updateStates = function updateStates() {
7147
7596
  if (playerRef.current && videoRef.current) {
7148
7597
  setIsMuted(playerRef.current.isMuted());
7149
7598
  setIsPlaying(!videoRef.current.paused);
@@ -7156,12 +7605,11 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7156
7605
  var rateValue = videoRef.current.playbackRate;
7157
7606
  setPlaybackRate(isFinite(rateValue) && rateValue > 0 ? rateValue : 1);
7158
7607
  }
7159
- setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
7608
+ setIsFullscreen(document.fullscreenElement === wrapperRef.current);
7160
7609
  };
7161
7610
  var interval = setInterval(updateStates, 200);
7162
- var handleFullscreenChange = function() {
7163
- var _videoRef_current;
7164
- setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
7611
+ var handleFullscreenChange = function handleFullscreenChange() {
7612
+ setIsFullscreen(document.fullscreenElement === wrapperRef.current);
7165
7613
  };
7166
7614
  document.addEventListener("fullscreenchange", handleFullscreenChange);
7167
7615
  return function() {
@@ -7171,7 +7619,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7171
7619
  }, []);
7172
7620
  (0, import_react.useEffect)(function() {
7173
7621
  if (!videoRef.current) return;
7174
- var handleLoadedMetadata = function() {
7622
+ var handleLoadedMetadata = function handleLoadedMetadata() {
7175
7623
  if (videoRef.current) {
7176
7624
  var video2 = videoRef.current;
7177
7625
  void video2.offsetHeight;
@@ -7181,19 +7629,19 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7181
7629
  console.log("[StormcloudUI] Video event: loadedmetadata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7182
7630
  }
7183
7631
  };
7184
- var handleLoadedData = function() {
7632
+ var handleLoadedData = function handleLoadedData() {
7185
7633
  if (debugAdTiming) {
7186
7634
  var _videoRef_current;
7187
7635
  console.log("[StormcloudUI] Video event: loadeddata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7188
7636
  }
7189
7637
  };
7190
- var handleLoadStart = function() {
7638
+ var handleLoadStart = function handleLoadStart() {
7191
7639
  if (debugAdTiming) {
7192
7640
  var _videoRef_current;
7193
7641
  console.log("[StormcloudUI] Video event: loadstart, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7194
7642
  }
7195
7643
  };
7196
- var handleCanPlay = function() {
7644
+ var handleCanPlay = function handleCanPlay() {
7197
7645
  setIsLoading(false);
7198
7646
  if (bufferingTimeoutRef.current) {
7199
7647
  clearTimeout(bufferingTimeoutRef.current);
@@ -7205,7 +7653,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7205
7653
  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");
7206
7654
  }
7207
7655
  };
7208
- var handleCanPlayThrough = function() {
7656
+ var handleCanPlayThrough = function handleCanPlayThrough() {
7209
7657
  setIsLoading(false);
7210
7658
  if (bufferingTimeoutRef.current) {
7211
7659
  clearTimeout(bufferingTimeoutRef.current);
@@ -7217,7 +7665,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7217
7665
  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");
7218
7666
  }
7219
7667
  };
7220
- var handleWaiting = function() {
7668
+ var handleWaiting = function handleWaiting() {
7221
7669
  if (bufferingTimeoutRef.current) {
7222
7670
  clearTimeout(bufferingTimeoutRef.current);
7223
7671
  }
@@ -7233,7 +7681,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7233
7681
  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)");
7234
7682
  }
7235
7683
  };
7236
- var handlePlaying = function() {
7684
+ var handlePlaying = function handlePlaying() {
7237
7685
  setIsLoading(false);
7238
7686
  if (bufferingTimeoutRef.current) {
7239
7687
  clearTimeout(bufferingTimeoutRef.current);
@@ -7246,7 +7694,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7246
7694
  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");
7247
7695
  }
7248
7696
  };
7249
- var handlePause = function() {
7697
+ var handlePause = function handlePause() {
7250
7698
  var _playerRef_current, _videoRef_current_dataset, _videoRef_current;
7251
7699
  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";
7252
7700
  if (playerRef.current && !isAdActive) {
@@ -7255,7 +7703,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7255
7703
  setShowCenterPlay(false);
7256
7704
  }
7257
7705
  };
7258
- var handleEnded = function() {
7706
+ var handleEnded = function handleEnded() {
7259
7707
  setShowCenterPlay(true);
7260
7708
  };
7261
7709
  var video = videoRef.current;
@@ -7289,13 +7737,25 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7289
7737
  }, [
7290
7738
  debugAdTiming
7291
7739
  ]);
7740
+ (0, import_react.useEffect)(function() {
7741
+ return function() {
7742
+ if (controlsTimerRef.current) {
7743
+ clearTimeout(controlsTimerRef.current);
7744
+ }
7745
+ };
7746
+ }, []);
7747
+ var progressPercent = duration > 0 ? currentTime / duration * 100 : 0;
7748
+ var VolumeIcon = isMuted || volume === 0 ? import_fa.FaVolumeMute : volume < 0.5 ? import_fa.FaVolumeDown : import_fa.FaVolumeUp;
7292
7749
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
7293
7750
  children: [
7294
7751
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", {
7295
- 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 "
7752
+ 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 "
7296
7753
  }),
7297
7754
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7298
- className: "stormcloud-video-wrapper ".concat(wrapperClassName || ""),
7755
+ ref: wrapperRef,
7756
+ className: "sc-wrapper ".concat(wrapperClassName || ""),
7757
+ onMouseMove: handleWrapperMouseMove,
7758
+ onMouseLeave: handleWrapperMouseLeave,
7299
7759
  style: _object_spread({
7300
7760
  display: "flex",
7301
7761
  alignItems: "center",
@@ -7310,7 +7770,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7310
7770
  maxWidth: isFullscreen ? "100vw" : "100%",
7311
7771
  maxHeight: isFullscreen ? "100vh" : "none",
7312
7772
  zIndex: isFullscreen ? 999999 : void 0,
7313
- backgroundColor: isFullscreen ? "#000" : void 0,
7773
+ backgroundColor: "#000",
7314
7774
  borderRadius: isFullscreen ? 0 : void 0,
7315
7775
  boxShadow: isFullscreen ? "none" : void 0
7316
7776
  }, wrapperStyle),
@@ -7336,16 +7796,16 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7336
7796
  children: children
7337
7797
  })),
7338
7798
  (isLoading || isBuffering) && !hideLoadingIndicator && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaSpinner, {
7339
- className: "stormcloud-loading-indicator",
7340
- size: 42,
7341
- color: "white",
7799
+ className: "sc-loading-indicator",
7800
+ size: 40,
7801
+ color: "rgba(255, 255, 255, 0.85)",
7342
7802
  style: {
7343
7803
  position: "absolute",
7344
- top: "calc(50% - 21px)",
7345
- left: "calc(50% - 21px)",
7804
+ top: "calc(50% - 20px)",
7805
+ left: "calc(50% - 20px)",
7346
7806
  zIndex: 20,
7347
- animation: "spin 1s linear infinite",
7348
- filter: "drop-shadow(0 3px 6px rgba(0, 0, 0, 0.8))"
7807
+ animation: "sc-spin 0.9s linear infinite",
7808
+ filter: "drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6))"
7349
7809
  }
7350
7810
  }),
7351
7811
  showLicenseWarning && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
@@ -7355,13 +7815,13 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7355
7815
  left: "50%",
7356
7816
  transform: "translate(-50%, -50%)",
7357
7817
  zIndex: 25,
7358
- background: "linear-gradient(135deg, rgba(220, 38, 38, 0.95) 0%, rgba(185, 28, 28, 0.9) 100%)",
7818
+ background: "rgba(220, 38, 38, 0.92)",
7819
+ backdropFilter: "blur(24px)",
7359
7820
  color: "white",
7360
- padding: "24px 32px",
7361
- borderRadius: "16px",
7362
- backdropFilter: "blur(20px)",
7363
- border: "2px solid rgba(255, 255, 255, 0.2)",
7364
- boxShadow: "0 20px 60px rgba(0, 0, 0, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.2)",
7821
+ padding: "28px 36px",
7822
+ borderRadius: "14px",
7823
+ border: "1px solid rgba(255, 255, 255, 0.15)",
7824
+ boxShadow: "0 24px 64px rgba(0, 0, 0, 0.5)",
7365
7825
  textAlign: "center",
7366
7826
  maxWidth: "400px",
7367
7827
  margin: "0 16px"
@@ -7369,20 +7829,18 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7369
7829
  children: [
7370
7830
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7371
7831
  style: {
7372
- fontSize: "20px",
7373
- fontWeight: "bold",
7374
- marginBottom: "12px",
7375
- color: "#ffffff",
7376
- textShadow: "0 2px 4px rgba(0, 0, 0, 0.5)"
7832
+ fontSize: "18px",
7833
+ fontWeight: "700",
7834
+ marginBottom: "10px",
7835
+ letterSpacing: "-0.02em"
7377
7836
  },
7378
7837
  children: "License Key Required"
7379
7838
  }),
7380
7839
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7381
7840
  style: {
7382
- fontSize: "14px",
7383
- lineHeight: "1.5",
7384
- color: "rgba(255, 255, 255, 0.9)",
7385
- textShadow: "0 1px 2px rgba(0, 0, 0, 0.3)"
7841
+ fontSize: "13px",
7842
+ lineHeight: "1.6",
7843
+ color: "rgba(255, 255, 255, 0.85)"
7386
7844
  },
7387
7845
  children: [
7388
7846
  "Please provide a valid license key to use the Stormcloud Video Player.",
@@ -7401,836 +7859,550 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7401
7859
  transform: "translate(-50%, -50%)",
7402
7860
  zIndex: 15,
7403
7861
  cursor: "pointer",
7404
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.8) 100%)",
7862
+ background: "rgba(0, 0, 0, 0.55)",
7863
+ backdropFilter: "blur(8px)",
7405
7864
  borderRadius: "50%",
7406
- width: "100px",
7407
- height: "100px",
7865
+ width: "".concat(92 * responsiveScale, "px"),
7866
+ height: "".concat(92 * responsiveScale, "px"),
7408
7867
  display: "flex",
7409
7868
  alignItems: "center",
7410
7869
  justifyContent: "center",
7411
- backdropFilter: "blur(20px)",
7412
- border: "3px solid rgba(255, 255, 255, 0.8)",
7413
- boxShadow: "0 12px 40px rgba(0, 0, 0, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.3)",
7414
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
7870
+ transition: "background 0.2s ease, transform 0.2s ease",
7871
+ animation: "sc-fade-in 0.2s ease"
7415
7872
  },
7416
- onMouseEnter: function(e) {
7417
- var target = e.currentTarget;
7418
- target.style.transform = "translate(-50%, -50%)";
7419
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(40, 40, 40, 0.9) 100%)";
7420
- target.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.9), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
7421
- target.style.borderColor = "rgba(255, 255, 255, 0.9)";
7873
+ onMouseEnter: function onMouseEnter(e) {
7874
+ e.currentTarget.style.background = "rgba(0, 0, 0, 0.72)";
7875
+ e.currentTarget.style.transform = "translate(-50%, -50%) scale(1.06)";
7422
7876
  },
7423
- onMouseLeave: function(e) {
7424
- var target = e.currentTarget;
7425
- target.style.transform = "translate(-50%, -50%)";
7426
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.8) 100%)";
7427
- target.style.boxShadow = "0 12px 40px rgba(0, 0, 0, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.3)";
7428
- target.style.borderColor = "rgba(255, 255, 255, 0.8)";
7877
+ onMouseLeave: function onMouseLeave(e) {
7878
+ e.currentTarget.style.background = "rgba(0, 0, 0, 0.55)";
7879
+ e.currentTarget.style.transform = "translate(-50%, -50%) scale(1)";
7429
7880
  },
7430
7881
  title: "Play",
7431
7882
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaPlay, {
7432
- size: 36,
7883
+ size: Math.max(24, 32 * responsiveScale),
7433
7884
  color: "white",
7434
7885
  style: {
7435
- marginLeft: "6px",
7436
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))"
7886
+ marginLeft: "4px"
7437
7887
  }
7438
7888
  })
7439
7889
  }),
7440
- shouldShowEnhancedControls && !showLicenseWarning ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
7441
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7442
- style: {
7443
- position: "absolute",
7444
- bottom: 0,
7445
- left: 0,
7446
- right: 0,
7447
- background: "linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%)",
7448
- padding: "20px 16px 16px",
7449
- zIndex: 10
7450
- },
7451
- children: [
7452
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7453
- style: {
7454
- width: "100%",
7455
- height: "8px",
7456
- background: "linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%)",
7457
- borderRadius: "8px",
7458
- marginBottom: "16px",
7459
- cursor: "pointer",
7460
- position: "relative",
7461
- backdropFilter: "blur(5px)",
7462
- border: "1px solid rgba(255, 255, 255, 0.1)",
7463
- boxShadow: "inset 0 2px 4px rgba(0, 0, 0, 0.2)"
7464
- },
7465
- onClick: handleTimelineSeek,
7466
- children: [
7467
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7468
- style: {
7469
- height: "100%",
7470
- 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%)",
7471
- borderRadius: "8px",
7472
- width: "".concat(duration > 0 ? currentTime / duration * 100 : 0, "%"),
7473
- transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
7474
- boxShadow: "0 2px 8px rgba(139, 92, 246, 0.4)"
7475
- }
7476
- }),
7477
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7478
- style: {
7479
- position: "absolute",
7480
- top: "-6px",
7481
- right: "".concat(duration > 0 ? 100 - currentTime / duration * 100 : 100, "%"),
7482
- width: "20px",
7483
- height: "20px",
7484
- background: "linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 240, 240, 0.9) 100%)",
7485
- borderRadius: "50%",
7486
- border: "3px solid rgba(139, 92, 246, 0.8)",
7487
- boxShadow: "0 4px 16px rgba(139, 92, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.8)",
7488
- transform: "translateX(50%)",
7489
- transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)"
7490
- }
7491
- })
7492
- ]
7493
- }),
7494
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7495
- style: {
7496
- display: "flex",
7497
- alignItems: "center",
7498
- justifyContent: "space-between",
7499
- color: "white",
7500
- flexWrap: viewportWidth < 768 ? "wrap" : "nowrap",
7501
- gap: "".concat(8 * responsiveScale, "px")
7502
- },
7503
- children: [
7504
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7505
- style: {
7506
- display: "flex",
7507
- alignItems: "center",
7508
- gap: "".concat(12 * responsiveScale, "px"),
7509
- flexWrap: viewportWidth < 480 ? "wrap" : "nowrap"
7510
- },
7511
- children: [
7512
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7513
- onClick: handlePlayPause,
7890
+ shouldShowEnhancedControls && !showLicenseWarning ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7891
+ className: "sc-controls-bar",
7892
+ style: {
7893
+ position: "absolute",
7894
+ bottom: 0,
7895
+ left: 0,
7896
+ right: 0,
7897
+ background: "linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.35) 60%, transparent 100%)",
7898
+ padding: "".concat(20 * responsiveScale, "px ").concat(12 * responsiveScale, "px ").concat(8 * responsiveScale, "px"),
7899
+ zIndex: 10,
7900
+ opacity: controlsVisible || adStatus.showAds ? 1 : 0,
7901
+ transform: controlsVisible || adStatus.showAds ? "translateY(0)" : "translateY(6px)",
7902
+ pointerEvents: controlsVisible || adStatus.showAds ? "auto" : "none"
7903
+ },
7904
+ children: [
7905
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7906
+ className: "sc-progress-track",
7907
+ style: {
7908
+ width: "100%",
7909
+ height: "3px",
7910
+ background: "rgba(255, 255, 255, 0.2)",
7911
+ borderRadius: "1.5px",
7912
+ marginBottom: "".concat(8 * responsiveScale, "px"),
7913
+ cursor: "pointer",
7914
+ position: "relative",
7915
+ transition: "height 0.1s ease"
7916
+ },
7917
+ onClick: handleTimelineSeek,
7918
+ onMouseEnter: function onMouseEnter(e) {
7919
+ e.currentTarget.style.height = "5px";
7920
+ },
7921
+ onMouseLeave: function onMouseLeave(e) {
7922
+ e.currentTarget.style.height = "3px";
7923
+ },
7924
+ children: [
7925
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7926
+ style: {
7927
+ position: "absolute",
7928
+ top: 0,
7929
+ left: 0,
7930
+ bottom: 0,
7931
+ background: adStatus.showAds ? "#f5c518" : "#ff0000",
7932
+ borderRadius: "1.5px",
7933
+ width: "".concat(progressPercent, "%"),
7934
+ transition: "width 0.15s linear"
7935
+ }
7936
+ }),
7937
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7938
+ className: "sc-progress-thumb",
7939
+ style: {
7940
+ position: "absolute",
7941
+ top: "50%",
7942
+ left: "".concat(progressPercent, "%"),
7943
+ transform: "translate(-50%, -50%) scale(0)",
7944
+ width: "13px",
7945
+ height: "13px",
7946
+ background: adStatus.showAds ? "#f5c518" : "#ff0000",
7947
+ borderRadius: "50%",
7948
+ boxShadow: "0 0 4px rgba(0, 0, 0, 0.3)",
7949
+ transition: "transform 0.1s ease, left 0.15s linear"
7950
+ }
7951
+ })
7952
+ ]
7953
+ }),
7954
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7955
+ style: {
7956
+ display: "flex",
7957
+ alignItems: "center",
7958
+ justifyContent: "space-between",
7959
+ color: "white",
7960
+ gap: "".concat(8 * responsiveScale, "px")
7961
+ },
7962
+ children: [
7963
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7964
+ style: {
7965
+ display: "flex",
7966
+ alignItems: "center",
7967
+ gap: "".concat(8 * responsiveScale, "px")
7968
+ },
7969
+ children: [
7970
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7971
+ className: "sc-ctrl-btn",
7972
+ onClick: handlePlayPause,
7973
+ style: {
7974
+ padding: "".concat(8 * responsiveScale, "px"),
7975
+ borderRadius: "50%",
7976
+ minWidth: "".concat(36 * responsiveScale, "px"),
7977
+ minHeight: "".concat(36 * responsiveScale, "px")
7978
+ },
7979
+ title: isPlaying ? "Pause" : "Play",
7980
+ children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaPause, {
7981
+ size: Math.max(14, 18 * responsiveScale)
7982
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaPlay, {
7983
+ size: Math.max(14, 18 * responsiveScale),
7514
7984
  style: {
7515
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)",
7516
- backdropFilter: "blur(12px)",
7517
- border: "".concat(2 * responsiveScale, "px solid rgba(255, 255, 255, 0.3)"),
7518
- color: "#ffffff",
7519
- cursor: "pointer",
7520
- padding: "".concat(10 * responsiveScale, "px"),
7521
- borderRadius: "".concat(16 * responsiveScale, "px"),
7522
- display: "flex",
7523
- alignItems: "center",
7524
- justifyContent: "center",
7525
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
7526
- 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)",
7527
- minWidth: "".concat(48 * responsiveScale, "px"),
7528
- minHeight: "".concat(48 * responsiveScale, "px")
7529
- },
7530
- onMouseEnter: function(e) {
7531
- var target = e.target;
7532
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
7533
- 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)";
7534
- },
7535
- onMouseLeave: function(e) {
7536
- var target = e.target;
7537
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
7538
- 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)";
7539
- },
7540
- title: isPlaying ? "Pause" : "Play",
7541
- children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaPause, {
7542
- size: Math.max(16, 20 * responsiveScale),
7985
+ marginLeft: "2px"
7986
+ }
7987
+ })
7988
+ }),
7989
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7990
+ style: {
7991
+ display: "flex",
7992
+ alignItems: "center"
7993
+ },
7994
+ onMouseEnter: function onMouseEnter() {
7995
+ return setShowVolumeSlider(true);
7996
+ },
7997
+ onMouseLeave: function onMouseLeave() {
7998
+ return setShowVolumeSlider(false);
7999
+ },
8000
+ children: [
8001
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
8002
+ className: "sc-ctrl-btn",
8003
+ onClick: function onClick() {
8004
+ if (playerRef.current) playerRef.current.toggleMute();
8005
+ onVolumeToggle === null || onVolumeToggle === void 0 ? void 0 : onVolumeToggle();
8006
+ resetControlsTimer();
8007
+ },
7543
8008
  style: {
7544
- filter: "drop-shadow(0 0 0 transparent)"
7545
- }
7546
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaPlay, {
7547
- size: Math.max(16, 20 * responsiveScale),
8009
+ padding: "".concat(8 * responsiveScale, "px"),
8010
+ borderRadius: "50%",
8011
+ minWidth: "".concat(36 * responsiveScale, "px"),
8012
+ minHeight: "".concat(36 * responsiveScale, "px")
8013
+ },
8014
+ title: isMuted ? "Unmute" : "Mute",
8015
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VolumeIcon, {
8016
+ size: Math.max(14, 18 * responsiveScale)
8017
+ })
8018
+ }),
8019
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7548
8020
  style: {
7549
- filter: "drop-shadow(0 0 0 transparent)"
7550
- }
7551
- })
7552
- }),
7553
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7554
- style: {
7555
- position: "relative",
7556
- display: "flex",
7557
- alignItems: "center",
7558
- padding: "8px",
7559
- margin: "-8px"
7560
- },
7561
- onMouseEnter: function() {
7562
- return setShowVolumeSlider(true);
7563
- },
7564
- onMouseLeave: function() {
7565
- return setShowVolumeSlider(false);
7566
- },
7567
- children: [
7568
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7569
- onClick: function() {
7570
- if (playerRef.current) {
7571
- playerRef.current.toggleMute();
7572
- }
7573
- if (onVolumeToggle) {
7574
- onVolumeToggle();
7575
- }
7576
- },
8021
+ width: showVolumeSlider ? "".concat(62 * responsiveScale, "px") : "0px",
8022
+ overflow: "hidden",
8023
+ transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
8024
+ display: "flex",
8025
+ alignItems: "center",
8026
+ paddingLeft: showVolumeSlider ? "2px" : "0",
8027
+ paddingRight: showVolumeSlider ? "4px" : "0"
8028
+ },
8029
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7577
8030
  style: {
7578
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)",
7579
- backdropFilter: "blur(10px)",
7580
- border: "".concat(2 * responsiveScale, "px solid rgba(255, 255, 255, 0.3)"),
7581
- color: "#ffffff",
8031
+ position: "relative",
8032
+ width: "".concat(56 * responsiveScale, "px"),
8033
+ height: "3px",
7582
8034
  cursor: "pointer",
7583
- padding: "".concat(8 * responsiveScale, "px"),
7584
- borderRadius: "".concat(16 * responsiveScale, "px"),
7585
- display: "flex",
7586
- alignItems: "center",
7587
- justifyContent: "center",
7588
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
7589
- 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)",
7590
- minWidth: "".concat(44 * responsiveScale, "px"),
7591
- minHeight: "".concat(44 * responsiveScale, "px")
8035
+ borderRadius: "1.5px"
7592
8036
  },
7593
- onMouseEnter: function(e) {
7594
- var target = e.target;
7595
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7596
- 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)";
8037
+ onMouseDown: function onMouseDown(e) {
8038
+ e.preventDefault();
8039
+ var el = e.currentTarget;
8040
+ var move = function move(ev) {
8041
+ var r2 = el.getBoundingClientRect();
8042
+ handleVolumeChange(Math.max(0, Math.min(1, (ev.clientX - r2.left) / r2.width)));
8043
+ };
8044
+ var up = function up1() {
8045
+ document.removeEventListener("mousemove", move);
8046
+ document.removeEventListener("mouseup", up);
8047
+ };
8048
+ document.addEventListener("mousemove", move);
8049
+ document.addEventListener("mouseup", up);
8050
+ var r = el.getBoundingClientRect();
8051
+ handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
7597
8052
  },
7598
- onMouseLeave: function(e) {
7599
- var target = e.target;
7600
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7601
- 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)";
8053
+ onClick: function onClick(e) {
8054
+ e.stopPropagation();
8055
+ var r = e.currentTarget.getBoundingClientRect();
8056
+ handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
7602
8057
  },
7603
- title: isMuted ? "Unmute" : "Mute",
7604
- children: isMuted || volume === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaVolumeMute, {
7605
- size: Math.max(14, 16 * responsiveScale),
7606
- style: {
7607
- filter: "drop-shadow(0 0 0 transparent)"
7608
- }
7609
- }) : volume < 0.5 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaVolumeDown, {
7610
- size: Math.max(14, 16 * responsiveScale),
7611
- style: {
7612
- filter: "drop-shadow(0 0 0 transparent)"
7613
- }
7614
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaVolumeUp, {
7615
- size: Math.max(14, 16 * responsiveScale),
7616
- style: {
7617
- filter: "drop-shadow(0 0 0 transparent)"
7618
- }
7619
- })
7620
- }),
7621
- showVolumeSlider && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
7622
8058
  children: [
7623
8059
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7624
8060
  style: {
7625
8061
  position: "absolute",
7626
- bottom: "100%",
7627
- left: "50%",
7628
- transform: "translateX(-50%)",
7629
- width: "60px",
7630
- height: "20px",
7631
- marginBottom: "-16px",
7632
- zIndex: 9
7633
- },
7634
- onMouseEnter: function() {
7635
- return setShowVolumeSlider(true);
7636
- },
7637
- onMouseLeave: function() {
7638
- return setShowVolumeSlider(false);
8062
+ inset: 0,
8063
+ background: "rgba(255, 255, 255, 0.2)",
8064
+ borderRadius: "1.5px"
7639
8065
  }
7640
8066
  }),
7641
8067
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7642
8068
  style: {
7643
8069
  position: "absolute",
7644
- bottom: "100%",
7645
- left: "50%",
7646
- transform: "translateX(-50%)",
7647
- marginBottom: "4px",
7648
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.88) 0%, rgba(20, 20, 20, 0.92) 100%)",
7649
- backdropFilter: "blur(15px)",
7650
- padding: "10px 14px",
7651
- borderRadius: "14px",
7652
- border: "1px solid rgba(255, 255, 255, 0.15)",
7653
- display: "flex",
7654
- flexDirection: "column",
7655
- alignItems: "center",
7656
- justifyContent: "center",
7657
- height: "128px",
7658
- 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)",
7659
- zIndex: 10,
7660
- transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
7661
- },
7662
- onMouseEnter: function(e) {
7663
- setShowVolumeSlider(true);
7664
- 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)";
7665
- e.currentTarget.style.borderColor = "rgba(59, 130, 246, 0.4)";
7666
- },
7667
- onMouseLeave: function(e) {
7668
- setShowVolumeSlider(false);
7669
- 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)";
7670
- e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.15)";
7671
- },
7672
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7673
- style: {
7674
- position: "relative",
7675
- width: "8px",
7676
- height: "104px",
7677
- cursor: "pointer",
7678
- transition: "transform 0.2s ease-in-out"
7679
- },
7680
- onMouseEnter: function(e) {},
7681
- onMouseLeave: function(e) {},
7682
- onMouseDown: function(e) {
7683
- e.preventDefault();
7684
- var sliderElement = e.currentTarget;
7685
- var handleMouseMove = function(moveEvent) {
7686
- if (!sliderElement) return;
7687
- var rect2 = sliderElement.getBoundingClientRect();
7688
- var y2 = moveEvent.clientY - rect2.top;
7689
- var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
7690
- handleVolumeChange(percentage2);
7691
- };
7692
- var handleMouseUp = function() {
7693
- document.removeEventListener("mousemove", handleMouseMove);
7694
- document.removeEventListener("mouseup", handleMouseUp);
7695
- };
7696
- document.addEventListener("mousemove", handleMouseMove);
7697
- document.addEventListener("mouseup", handleMouseUp);
7698
- var rect = sliderElement.getBoundingClientRect();
7699
- var y = e.clientY - rect.top;
7700
- var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
7701
- handleVolumeChange(percentage);
7702
- },
7703
- onClick: function(e) {
7704
- e.stopPropagation();
7705
- var rect = e.currentTarget.getBoundingClientRect();
7706
- var y = e.clientY - rect.top;
7707
- var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
7708
- handleVolumeChange(percentage);
7709
- },
7710
- children: [
7711
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7712
- style: {
7713
- position: "absolute",
7714
- bottom: "0",
7715
- left: "0",
7716
- width: "100%",
7717
- height: "100%",
7718
- background: "linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.15) 100%)",
7719
- borderRadius: "4px",
7720
- boxShadow: "inset 0 1px 3px rgba(0, 0, 0, 0.2)"
7721
- }
7722
- }),
7723
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7724
- style: {
7725
- position: "absolute",
7726
- bottom: "0",
7727
- left: "0",
7728
- width: "100%",
7729
- height: "".concat((isMuted ? 0 : volume) * 100, "%"),
7730
- background: "linear-gradient(180deg, rgba(96, 165, 250, 1) 0%, rgba(59, 130, 246, 0.95) 50%, rgba(37, 99, 235, 0.9) 100%)",
7731
- borderRadius: "4px",
7732
- transition: "height 0.15s ease-out, box-shadow 0.2s ease-in-out",
7733
- boxShadow: "0 0 8px rgba(59, 130, 246, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3)"
7734
- }
7735
- }),
7736
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7737
- style: {
7738
- position: "absolute",
7739
- bottom: "calc(".concat((isMuted ? 0 : volume) * 100, "% - 7px)"),
7740
- left: "50%",
7741
- transform: "translateX(-50%)",
7742
- width: "14px",
7743
- height: "14px",
7744
- background: "linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%)",
7745
- borderRadius: "50%",
7746
- 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)",
7747
- 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",
7748
- cursor: "grab"
7749
- },
7750
- onMouseEnter: function(e) {
7751
- 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)";
7752
- e.currentTarget.style.cursor = "grab";
7753
- },
7754
- onMouseLeave: function(e) {
7755
- 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)";
7756
- },
7757
- onMouseDown: function(e) {
7758
- e.currentTarget.style.cursor = "grabbing";
7759
- },
7760
- onMouseUp: function(e) {
7761
- e.currentTarget.style.cursor = "grab";
7762
- }
7763
- })
7764
- ]
7765
- })
8070
+ top: 0,
8071
+ left: 0,
8072
+ bottom: 0,
8073
+ width: "".concat((isMuted ? 0 : volume) * 100, "%"),
8074
+ background: "#fff",
8075
+ borderRadius: "1.5px",
8076
+ transition: "width 0.1s ease-out"
8077
+ }
8078
+ }),
8079
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8080
+ style: {
8081
+ position: "absolute",
8082
+ top: "50%",
8083
+ left: "".concat((isMuted ? 0 : volume) * 100, "%"),
8084
+ transform: "translate(-50%, -50%)",
8085
+ width: "12px",
8086
+ height: "12px",
8087
+ background: "#fff",
8088
+ borderRadius: "50%",
8089
+ boxShadow: "0 0 3px rgba(0, 0, 0, 0.3)",
8090
+ transition: "left 0.1s ease-out"
8091
+ }
7766
8092
  })
7767
8093
  ]
7768
8094
  })
7769
- ]
7770
- }),
7771
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7772
- style: {
7773
- fontSize: "".concat(14 * responsiveScale, "px"),
7774
- fontFamily: "monospace",
7775
- color: "rgba(255, 255, 255, 0.9)",
7776
- display: viewportWidth < 480 ? "none" : "block"
7777
- },
7778
- children: [
7779
- formatTime(currentTime),
7780
- " / ",
7781
- formatTime(duration)
7782
- ]
7783
- })
7784
- ]
7785
- }),
7786
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7787
- style: {
7788
- display: "flex",
7789
- alignItems: "center",
7790
- gap: "".concat(12 * responsiveScale, "px")
7791
- },
7792
- children: [
7793
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7794
- style: {
7795
- position: "relative",
7796
- display: viewportWidth < 600 ? "none" : "block"
7797
- },
7798
- children: [
7799
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
7800
- onClick: function() {
7801
- return setShowSpeedMenu(!showSpeedMenu);
7802
- },
7803
- style: {
7804
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)",
7805
- backdropFilter: "blur(10px)",
7806
- border: "".concat(2 * responsiveScale, "px solid rgba(255, 255, 255, 0.3)"),
7807
- color: "#ffffff",
7808
- cursor: "pointer",
7809
- padding: "".concat(8 * responsiveScale, "px ").concat(14 * responsiveScale, "px"),
7810
- borderRadius: "".concat(14 * responsiveScale, "px"),
7811
- fontSize: "".concat(14 * responsiveScale, "px"),
7812
- fontFamily: "monospace",
7813
- fontWeight: "700",
7814
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
7815
- 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)",
7816
- minWidth: "".concat(56 * responsiveScale, "px"),
7817
- minHeight: "".concat(40 * responsiveScale, "px")
7818
- },
7819
- onMouseEnter: function(e) {
7820
- var target = e.target;
7821
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7822
- 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)";
7823
- },
7824
- onMouseLeave: function(e) {
7825
- var target = e.target;
7826
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7827
- 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)";
7828
- },
7829
- title: "Playback Speed",
7830
- children: [
7831
- playbackRate,
7832
- "x"
7833
- ]
7834
- }),
7835
- showSpeedMenu && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7836
- style: {
7837
- position: "absolute",
7838
- bottom: "100%",
7839
- right: 0,
7840
- marginBottom: "12px",
7841
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.95) 100%)",
7842
- backdropFilter: "blur(20px)",
7843
- borderRadius: "12px",
7844
- border: "1px solid rgba(255, 255, 255, 0.1)",
7845
- overflow: "hidden",
7846
- minWidth: "90px",
7847
- boxShadow: "0 16px 48px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1)"
7848
- },
7849
- children: [
7850
- 0.25,
7851
- 0.5,
7852
- 0.75,
7853
- 1,
7854
- 1.25,
7855
- 1.5,
7856
- 1.75,
7857
- 2
7858
- ].map(function(speed) {
7859
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
7860
- onClick: function() {
7861
- return handlePlaybackRateChange(speed);
7862
- },
7863
- style: {
7864
- display: "block",
7865
- width: "100%",
7866
- padding: "10px 16px",
7867
- background: playbackRate === speed ? "linear-gradient(135deg, rgba(99, 102, 241, 0.8) 0%, rgba(139, 92, 246, 0.6) 100%)" : "transparent",
7868
- border: "none",
7869
- color: "white",
7870
- cursor: "pointer",
7871
- fontSize: "13px",
7872
- fontFamily: "monospace",
7873
- fontWeight: "600",
7874
- textAlign: "center",
7875
- transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
7876
- borderBottom: speed !== 2 ? "1px solid rgba(255, 255, 255, 0.05)" : "none"
7877
- },
7878
- onMouseEnter: function(e) {
7879
- if (playbackRate !== speed) {
7880
- e.target.style.background = "linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%)";
7881
- }
7882
- },
7883
- onMouseLeave: function(e) {
7884
- if (playbackRate !== speed) {
7885
- e.target.style.background = "transparent";
7886
- }
7887
- },
7888
- children: [
7889
- speed,
7890
- "x"
7891
- ]
7892
- }, speed);
7893
- })
7894
- })
7895
- ]
7896
- }),
7897
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7898
- onClick: function() {
7899
- if (onFullscreenToggle) {
7900
- onFullscreenToggle();
7901
- } else if (playerRef.current) {
7902
- playerRef.current.toggleFullscreen().catch(function(err) {
7903
- console.error("Fullscreen error:", err);
7904
- });
7905
- }
7906
- },
7907
- style: {
7908
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)",
7909
- backdropFilter: "blur(10px)",
7910
- border: "".concat(2 * responsiveScale, "px solid rgba(255, 255, 255, 0.3)"),
7911
- color: "#ffffff",
7912
- cursor: "pointer",
7913
- padding: "".concat(8 * responsiveScale, "px"),
7914
- borderRadius: "".concat(16 * responsiveScale, "px"),
7915
- display: "flex",
7916
- alignItems: "center",
7917
- justifyContent: "center",
7918
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
7919
- 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)",
7920
- minWidth: "".concat(44 * responsiveScale, "px"),
7921
- minHeight: "".concat(44 * responsiveScale, "px")
7922
- },
7923
- onMouseEnter: function(e) {
7924
- var target = e.target;
7925
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7926
- 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)";
7927
- },
7928
- onMouseLeave: function(e) {
7929
- var target = e.target;
7930
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7931
- 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)";
7932
- },
7933
- title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
7934
- children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaCompress, {
7935
- size: Math.max(14, 16 * responsiveScale),
8095
+ })
8096
+ ]
8097
+ }),
8098
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8099
+ style: {
8100
+ fontSize: "".concat(13 * responsiveScale, "px"),
8101
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
8102
+ color: "rgba(255, 255, 255, 0.9)",
8103
+ display: viewportWidth < 480 ? "none" : "block",
8104
+ fontVariantNumeric: "tabular-nums",
8105
+ userSelect: "none",
8106
+ marginLeft: "".concat(4 * responsiveScale, "px")
8107
+ },
8108
+ children: [
8109
+ formatTime(currentTime),
8110
+ " ",
8111
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
7936
8112
  style: {
7937
- filter: "drop-shadow(0 0 0 transparent)"
7938
- }
7939
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaExpand, {
7940
- size: Math.max(14, 16 * responsiveScale),
8113
+ color: "rgba(255,255,255,0.5)"
8114
+ },
8115
+ children: "/"
8116
+ }),
8117
+ " ",
8118
+ formatTime(duration)
8119
+ ]
8120
+ })
8121
+ ]
8122
+ }),
8123
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8124
+ style: {
8125
+ display: "flex",
8126
+ alignItems: "center",
8127
+ gap: "".concat(8 * responsiveScale, "px")
8128
+ },
8129
+ children: [
8130
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8131
+ style: {
8132
+ position: "relative",
8133
+ display: viewportWidth < 600 ? "none" : "block"
8134
+ },
8135
+ children: [
8136
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
8137
+ className: "sc-ctrl-btn",
8138
+ onClick: function onClick() {
8139
+ setShowSpeedMenu(!showSpeedMenu);
8140
+ resetControlsTimer();
8141
+ },
7941
8142
  style: {
7942
- filter: "drop-shadow(0 0 0 transparent)"
7943
- }
8143
+ padding: "".concat(6 * responsiveScale, "px ").concat(10 * responsiveScale, "px"),
8144
+ borderRadius: "".concat(6 * responsiveScale, "px"),
8145
+ fontSize: "".concat(13 * responsiveScale, "px"),
8146
+ fontFamily: "'SF Mono', 'Cascadia Code', monospace",
8147
+ fontWeight: "600",
8148
+ minHeight: "".concat(32 * responsiveScale, "px")
8149
+ },
8150
+ title: "Playback Speed",
8151
+ children: [
8152
+ playbackRate,
8153
+ "x"
8154
+ ]
8155
+ }),
8156
+ showSpeedMenu && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8157
+ style: {
8158
+ position: "absolute",
8159
+ bottom: "100%",
8160
+ right: 0,
8161
+ marginBottom: "8px",
8162
+ background: "rgba(0, 0, 0, 0.8)",
8163
+ backdropFilter: "blur(24px)",
8164
+ WebkitBackdropFilter: "blur(24px)",
8165
+ borderRadius: "10px",
8166
+ border: "1px solid rgba(255, 255, 255, 0.1)",
8167
+ overflow: "hidden",
8168
+ minWidth: "80px",
8169
+ boxShadow: "0 12px 40px rgba(0, 0, 0, 0.5)",
8170
+ animation: "sc-fade-in 0.15s ease"
8171
+ },
8172
+ children: [
8173
+ 0.25,
8174
+ 0.5,
8175
+ 0.75,
8176
+ 1,
8177
+ 1.25,
8178
+ 1.5,
8179
+ 1.75,
8180
+ 2
8181
+ ].map(function(speed) {
8182
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
8183
+ onClick: function onClick() {
8184
+ return handlePlaybackRateChange(speed);
8185
+ },
8186
+ style: {
8187
+ display: "block",
8188
+ width: "100%",
8189
+ padding: "".concat(8 * responsiveScale, "px ").concat(14 * responsiveScale, "px"),
8190
+ background: playbackRate === speed ? "rgba(255, 255, 255, 0.12)" : "transparent",
8191
+ border: "none",
8192
+ color: playbackRate === speed ? "#fff" : "rgba(255, 255, 255, 0.7)",
8193
+ cursor: "pointer",
8194
+ fontSize: "".concat(12 * responsiveScale, "px"),
8195
+ fontFamily: "'SF Mono', monospace",
8196
+ fontWeight: playbackRate === speed ? "700" : "500",
8197
+ textAlign: "center",
8198
+ transition: "background 0.15s ease, color 0.15s ease"
8199
+ },
8200
+ onMouseEnter: function onMouseEnter(e) {
8201
+ if (playbackRate !== speed) {
8202
+ e.target.style.background = "rgba(255, 255, 255, 0.08)";
8203
+ e.target.style.color = "#fff";
8204
+ }
8205
+ },
8206
+ onMouseLeave: function onMouseLeave(e) {
8207
+ if (playbackRate !== speed) {
8208
+ e.target.style.background = "transparent";
8209
+ e.target.style.color = "rgba(255, 255, 255, 0.7)";
8210
+ }
8211
+ },
8212
+ children: [
8213
+ speed,
8214
+ "x"
8215
+ ]
8216
+ }, speed);
8217
+ })
7944
8218
  })
8219
+ ]
8220
+ }),
8221
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
8222
+ className: "sc-ctrl-btn",
8223
+ onClick: function onClick() {
8224
+ if (onFullscreenToggle) {
8225
+ onFullscreenToggle();
8226
+ } else if (wrapperRef.current) {
8227
+ if (!document.fullscreenElement) {
8228
+ wrapperRef.current.requestFullscreen().catch(function() {});
8229
+ } else {
8230
+ document.exitFullscreen().catch(function() {});
8231
+ }
8232
+ }
8233
+ resetControlsTimer();
8234
+ },
8235
+ style: {
8236
+ padding: "".concat(8 * responsiveScale, "px"),
8237
+ borderRadius: "50%",
8238
+ minWidth: "".concat(36 * responsiveScale, "px"),
8239
+ minHeight: "".concat(36 * responsiveScale, "px")
8240
+ },
8241
+ title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
8242
+ children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaCompress, {
8243
+ size: Math.max(14, 18 * responsiveScale)
8244
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaExpand, {
8245
+ size: Math.max(14, 18 * responsiveScale)
7945
8246
  })
7946
- ]
7947
- })
7948
- ]
7949
- })
7950
- ]
7951
- })
8247
+ })
8248
+ ]
8249
+ })
8250
+ ]
8251
+ })
8252
+ ]
7952
8253
  }) : showCustomControls && !showLicenseWarning && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8254
+ className: "sc-controls-bar",
7953
8255
  style: {
7954
8256
  position: "absolute",
7955
8257
  bottom: "".concat(10 * responsiveScale, "px"),
7956
8258
  right: "".concat(10 * responsiveScale, "px"),
7957
- transform: "none",
7958
8259
  display: "flex",
7959
8260
  flexDirection: isPortrait ? "column" : "row",
7960
- gap: "".concat(10 * responsiveScale, "px"),
7961
- zIndex: 10
8261
+ gap: "".concat(8 * responsiveScale, "px"),
8262
+ zIndex: 10,
8263
+ opacity: controlsVisible ? 1 : 0,
8264
+ transform: controlsVisible ? "translateY(0)" : "translateY(4px)",
8265
+ pointerEvents: controlsVisible ? "auto" : "none"
7962
8266
  },
7963
8267
  children: [
7964
8268
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7965
8269
  style: {
7966
- position: "relative",
7967
8270
  display: "flex",
7968
8271
  alignItems: "center",
7969
- padding: "8px",
7970
- margin: "-8px"
8272
+ background: "rgba(0, 0, 0, 0.6)",
8273
+ borderRadius: "".concat(18 * responsiveScale, "px"),
8274
+ padding: "2px"
7971
8275
  },
7972
- onMouseEnter: function() {
8276
+ onMouseEnter: function onMouseEnter() {
7973
8277
  return setShowVolumeSlider(true);
7974
8278
  },
7975
- onMouseLeave: function() {
8279
+ onMouseLeave: function onMouseLeave() {
7976
8280
  return setShowVolumeSlider(false);
7977
8281
  },
7978
8282
  children: [
7979
8283
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7980
- onClick: function() {
7981
- if (playerRef.current) {
7982
- playerRef.current.toggleMute();
7983
- }
7984
- if (onVolumeToggle) {
7985
- onVolumeToggle();
7986
- }
7987
- },
7988
- onMouseEnter: function(e) {
7989
- var target = e.currentTarget;
7990
- 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)";
7991
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
7992
- },
7993
- onMouseLeave: function(e) {
7994
- var target = e.currentTarget;
7995
- 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)";
7996
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
8284
+ className: "sc-ctrl-btn",
8285
+ onClick: function onClick() {
8286
+ if (playerRef.current) playerRef.current.toggleMute();
8287
+ onVolumeToggle === null || onVolumeToggle === void 0 ? void 0 : onVolumeToggle();
8288
+ resetControlsTimer();
7997
8289
  },
7998
8290
  style: {
7999
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)",
8000
- color: "#ffffff",
8001
- border: "none",
8002
- borderRadius: "".concat(18 * responsiveScale, "px"),
8003
8291
  padding: "".concat(8 * responsiveScale, "px"),
8004
- cursor: "pointer",
8005
- display: "flex",
8006
- alignItems: "center",
8007
- justifyContent: "center",
8008
- backdropFilter: "blur(20px)",
8009
- 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)",
8010
- transition: "all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",
8011
- minWidth: "".concat(46 * responsiveScale, "px"),
8012
- minHeight: "".concat(46 * responsiveScale, "px")
8292
+ borderRadius: "50%",
8293
+ minWidth: "".concat(36 * responsiveScale, "px"),
8294
+ minHeight: "".concat(36 * responsiveScale, "px")
8013
8295
  },
8014
8296
  title: isMuted ? "Unmute" : "Mute",
8015
- children: isMuted || volume === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaVolumeMute, {
8016
- size: Math.max(14, 16 * responsiveScale),
8017
- style: {
8018
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))",
8019
- color: "#ffffff"
8020
- }
8021
- }) : volume < 0.5 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaVolumeDown, {
8022
- size: Math.max(14, 16 * responsiveScale),
8023
- style: {
8024
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))",
8025
- color: "#ffffff"
8026
- }
8027
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaVolumeUp, {
8028
- size: Math.max(14, 16 * responsiveScale),
8029
- style: {
8030
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))",
8031
- color: "#ffffff"
8032
- }
8297
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VolumeIcon, {
8298
+ size: Math.max(14, 18 * responsiveScale)
8033
8299
  })
8034
8300
  }),
8035
- showVolumeSlider && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
8036
- children: [
8037
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8038
- style: {
8039
- position: "absolute",
8040
- bottom: "100%",
8041
- left: "50%",
8042
- transform: "translateX(-50%)",
8043
- width: "60px",
8044
- height: "20px",
8045
- marginBottom: "-16px",
8046
- zIndex: 9
8047
- },
8048
- onMouseEnter: function() {
8049
- return setShowVolumeSlider(true);
8050
- },
8051
- onMouseLeave: function() {
8052
- return setShowVolumeSlider(false);
8053
- }
8054
- }),
8055
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8056
- style: {
8057
- position: "absolute",
8058
- bottom: "100%",
8059
- left: "50%",
8060
- transform: "translateX(-50%)",
8061
- marginBottom: "4px",
8062
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.96) 0%, rgba(20, 20, 20, 0.92) 100%)",
8063
- backdropFilter: "blur(20px)",
8064
- padding: "10px 14px",
8065
- borderRadius: "14px",
8066
- border: "2px solid rgba(255, 255, 255, 0.7)",
8067
- display: "flex",
8068
- flexDirection: "column",
8069
- alignItems: "center",
8070
- justifyContent: "center",
8071
- height: "128px",
8072
- 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)",
8073
- zIndex: 10,
8074
- transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
8075
- },
8076
- onMouseEnter: function(e) {
8077
- setShowVolumeSlider(true);
8078
- 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)";
8079
- e.currentTarget.style.borderColor = "rgba(96, 165, 250, 0.8)";
8080
- },
8081
- onMouseLeave: function(e) {
8082
- setShowVolumeSlider(false);
8083
- 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)";
8084
- e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.7)";
8085
- },
8086
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8301
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8302
+ style: {
8303
+ width: showVolumeSlider ? "".concat(62 * responsiveScale, "px") : "0px",
8304
+ overflow: "hidden",
8305
+ transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
8306
+ display: "flex",
8307
+ alignItems: "center",
8308
+ paddingLeft: showVolumeSlider ? "2px" : "0",
8309
+ paddingRight: showVolumeSlider ? "6px" : "0"
8310
+ },
8311
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8312
+ style: {
8313
+ position: "relative",
8314
+ width: "".concat(56 * responsiveScale, "px"),
8315
+ height: "3px",
8316
+ cursor: "pointer",
8317
+ borderRadius: "1.5px"
8318
+ },
8319
+ onMouseDown: function onMouseDown(e) {
8320
+ e.preventDefault();
8321
+ var el = e.currentTarget;
8322
+ var move = function move(ev) {
8323
+ var r2 = el.getBoundingClientRect();
8324
+ handleVolumeChange(Math.max(0, Math.min(1, (ev.clientX - r2.left) / r2.width)));
8325
+ };
8326
+ var up = function up1() {
8327
+ document.removeEventListener("mousemove", move);
8328
+ document.removeEventListener("mouseup", up);
8329
+ };
8330
+ document.addEventListener("mousemove", move);
8331
+ document.addEventListener("mouseup", up);
8332
+ var r = el.getBoundingClientRect();
8333
+ handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
8334
+ },
8335
+ onClick: function onClick(e) {
8336
+ e.stopPropagation();
8337
+ var r = e.currentTarget.getBoundingClientRect();
8338
+ handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
8339
+ },
8340
+ children: [
8341
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8087
8342
  style: {
8088
- position: "relative",
8089
- width: "8px",
8090
- height: "104px",
8091
- cursor: "pointer",
8092
- transition: "transform 0.2s ease-in-out"
8093
- },
8094
- onMouseDown: function(e) {
8095
- e.preventDefault();
8096
- var sliderElement = e.currentTarget;
8097
- var handleMouseMove = function(moveEvent) {
8098
- if (!sliderElement) return;
8099
- var rect2 = sliderElement.getBoundingClientRect();
8100
- var y2 = moveEvent.clientY - rect2.top;
8101
- var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
8102
- handleVolumeChange(percentage2);
8103
- };
8104
- var handleMouseUp = function() {
8105
- document.removeEventListener("mousemove", handleMouseMove);
8106
- document.removeEventListener("mouseup", handleMouseUp);
8107
- };
8108
- document.addEventListener("mousemove", handleMouseMove);
8109
- document.addEventListener("mouseup", handleMouseUp);
8110
- var rect = sliderElement.getBoundingClientRect();
8111
- var y = e.clientY - rect.top;
8112
- var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
8113
- handleVolumeChange(percentage);
8114
- },
8115
- onClick: function(e) {
8116
- e.stopPropagation();
8117
- var rect = e.currentTarget.getBoundingClientRect();
8118
- var y = e.clientY - rect.top;
8119
- var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
8120
- handleVolumeChange(percentage);
8121
- },
8122
- children: [
8123
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8124
- style: {
8125
- position: "absolute",
8126
- bottom: "0",
8127
- left: "0",
8128
- width: "100%",
8129
- height: "100%",
8130
- background: "linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.5) 100%)",
8131
- borderRadius: "4px",
8132
- border: "1px solid rgba(255, 255, 255, 0.4)",
8133
- boxShadow: "inset 0 1px 3px rgba(0, 0, 0, 0.3)"
8134
- }
8135
- }),
8136
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8137
- style: {
8138
- position: "absolute",
8139
- bottom: "0",
8140
- left: "0",
8141
- width: "100%",
8142
- height: "".concat((isMuted ? 0 : volume) * 100, "%"),
8143
- background: "linear-gradient(180deg, rgba(125, 211, 252, 1) 0%, rgba(96, 165, 250, 0.98) 50%, rgba(59, 130, 246, 0.95) 100%)",
8144
- borderRadius: "4px",
8145
- transition: "height 0.15s ease-out, box-shadow 0.2s ease-in-out",
8146
- boxShadow: "0 0 12px rgba(96, 165, 250, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4)"
8147
- }
8148
- }),
8149
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8150
- style: {
8151
- position: "absolute",
8152
- bottom: "calc(".concat((isMuted ? 0 : volume) * 100, "% - 8px)"),
8153
- left: "50%",
8154
- transform: "translateX(-50%)",
8155
- width: "16px",
8156
- height: "16px",
8157
- background: "linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%)",
8158
- borderRadius: "50%",
8159
- border: "2px solid rgba(96, 165, 250, 0.9)",
8160
- 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)",
8161
- 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",
8162
- cursor: "grab"
8163
- },
8164
- onMouseEnter: function(e) {
8165
- 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)";
8166
- e.currentTarget.style.cursor = "grab";
8167
- },
8168
- onMouseLeave: function(e) {
8169
- 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)";
8170
- },
8171
- onMouseDown: function(e) {
8172
- e.currentTarget.style.cursor = "grabbing";
8173
- },
8174
- onMouseUp: function(e) {
8175
- e.currentTarget.style.cursor = "grab";
8176
- }
8177
- })
8178
- ]
8343
+ position: "absolute",
8344
+ inset: 0,
8345
+ background: "rgba(255, 255, 255, 0.2)",
8346
+ borderRadius: "1.5px"
8347
+ }
8348
+ }),
8349
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8350
+ style: {
8351
+ position: "absolute",
8352
+ top: 0,
8353
+ left: 0,
8354
+ bottom: 0,
8355
+ width: "".concat((isMuted ? 0 : volume) * 100, "%"),
8356
+ background: "#fff",
8357
+ borderRadius: "1.5px",
8358
+ transition: "width 0.1s ease-out"
8359
+ }
8360
+ }),
8361
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8362
+ style: {
8363
+ position: "absolute",
8364
+ top: "50%",
8365
+ left: "".concat((isMuted ? 0 : volume) * 100, "%"),
8366
+ transform: "translate(-50%, -50%)",
8367
+ width: "12px",
8368
+ height: "12px",
8369
+ background: "#fff",
8370
+ borderRadius: "50%",
8371
+ boxShadow: "0 0 3px rgba(0, 0, 0, 0.3)",
8372
+ transition: "left 0.1s ease-out"
8373
+ }
8179
8374
  })
8180
- })
8181
- ]
8375
+ ]
8376
+ })
8182
8377
  })
8183
8378
  ]
8184
8379
  }),
8185
8380
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
8186
- onClick: function() {
8381
+ className: "sc-ctrl-btn",
8382
+ onClick: function onClick() {
8187
8383
  if (onFullscreenToggle) {
8188
8384
  onFullscreenToggle();
8189
- } else if (playerRef.current) {
8190
- playerRef.current.toggleFullscreen().catch(function(err) {
8191
- console.error("Fullscreen error:", err);
8192
- });
8385
+ } else if (wrapperRef.current) {
8386
+ if (!document.fullscreenElement) {
8387
+ wrapperRef.current.requestFullscreen().catch(function() {});
8388
+ } else {
8389
+ document.exitFullscreen().catch(function() {});
8390
+ }
8193
8391
  }
8194
- },
8195
- onMouseEnter: function(e) {
8196
- var target = e.currentTarget;
8197
- 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)";
8198
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
8199
- },
8200
- onMouseLeave: function(e) {
8201
- var target = e.currentTarget;
8202
- 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)";
8203
- target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
8392
+ resetControlsTimer();
8204
8393
  },
8205
8394
  style: {
8206
- background: "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)",
8207
- color: "#ffffff",
8208
- border: "none",
8209
- borderRadius: "".concat(18 * responsiveScale, "px"),
8210
8395
  padding: "".concat(8 * responsiveScale, "px"),
8211
- cursor: "pointer",
8212
- display: "flex",
8213
- alignItems: "center",
8214
- justifyContent: "center",
8215
- backdropFilter: "blur(20px)",
8216
- 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)",
8217
- transition: "all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",
8218
- minWidth: "".concat(46 * responsiveScale, "px"),
8219
- minHeight: "".concat(46 * responsiveScale, "px")
8396
+ borderRadius: "50%",
8397
+ minWidth: "".concat(36 * responsiveScale, "px"),
8398
+ minHeight: "".concat(36 * responsiveScale, "px"),
8399
+ background: "rgba(0, 0, 0, 0.6)"
8220
8400
  },
8221
8401
  title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
8222
8402
  children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaCompress, {
8223
- size: Math.max(14, 16 * responsiveScale),
8224
- style: {
8225
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))",
8226
- color: "#ffffff"
8227
- }
8403
+ size: Math.max(14, 18 * responsiveScale)
8228
8404
  }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fa.FaExpand, {
8229
- size: Math.max(14, 16 * responsiveScale),
8230
- style: {
8231
- filter: "drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))",
8232
- color: "#ffffff"
8233
- }
8405
+ size: Math.max(14, 18 * responsiveScale)
8234
8406
  })
8235
8407
  })
8236
8408
  ]
@@ -8343,7 +8515,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
8343
8515
  // src/StormcloudPlayer.tsx
8344
8516
  var import_react6 = __toESM(require("react"), 1);
8345
8517
  // src/props.ts
8346
- var noop = function() {};
8518
+ var noop = function noop() {};
8347
8519
  var defaultProps = {
8348
8520
  playing: false,
8349
8521
  loop: false,
@@ -8389,29 +8561,29 @@ var defaultProps = {
8389
8561
  // src/utils.ts
8390
8562
  var import_react2 = require("react");
8391
8563
  var lazy = import_react2.lazy;
8392
- var omit = function(object, keys) {
8564
+ var omit = function omit(object, keys) {
8393
8565
  var result = _object_spread({}, object);
8394
8566
  keys.forEach(function(key) {
8395
8567
  delete result[key];
8396
8568
  });
8397
8569
  return result;
8398
8570
  };
8399
- var isMediaStream = function(url) {
8571
+ var isMediaStream = function isMediaStream(url) {
8400
8572
  return typeof window !== "undefined" && window.MediaStream && _instanceof(url, window.MediaStream);
8401
8573
  };
8402
- var supportsWebKitPresentationMode = function() {
8574
+ var supportsWebKitPresentationMode = function supportsWebKitPresentationMode() {
8403
8575
  if (typeof window === "undefined") return false;
8404
8576
  var video = document.createElement("video");
8405
8577
  return "webkitSupportsPresentationMode" in video;
8406
8578
  };
8407
- var randomString = function() {
8579
+ var randomString = function randomString() {
8408
8580
  return Math.random().toString(36).substr(2, 9);
8409
8581
  };
8410
- var parseQuery = function(url) {
8582
+ var parseQuery = function parseQuery(url) {
8411
8583
  var query = {};
8412
8584
  var queryString = url.split("?")[1] || "";
8413
8585
  if (!queryString) return query;
8414
- var manualParse = function(qs) {
8586
+ var manualParse = function manualParse(qs) {
8415
8587
  qs.split("&").forEach(function(param) {
8416
8588
  var _param_split = _sliced_to_array(param.split("="), 2), key = _param_split[0], value = _param_split[1];
8417
8589
  if (key) {
@@ -8438,7 +8610,7 @@ var parseQuery = function(url) {
8438
8610
  }
8439
8611
  return query;
8440
8612
  };
8441
- var merge = function(target) {
8613
+ var merge = function merge1(target) {
8442
8614
  for(var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
8443
8615
  sources[_key - 1] = arguments[_key];
8444
8616
  }
@@ -8458,19 +8630,19 @@ var merge = function(target) {
8458
8630
  target
8459
8631
  ].concat(_to_consumable_array(sources)));
8460
8632
  };
8461
- var isObject = function(item) {
8633
+ var isObject = function isObject(item) {
8462
8634
  return item && (typeof item === "undefined" ? "undefined" : _type_of(item)) === "object" && !Array.isArray(item);
8463
8635
  };
8464
8636
  var IS_BROWSER = typeof window !== "undefined" && window.document;
8465
8637
  var IS_GLOBAL = typeof globalThis !== "undefined" && globalThis.window && globalThis.window.document;
8466
8638
  var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(navigator.userAgent);
8467
8639
  var IS_SAFARI = IS_BROWSER && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
8468
- var SUPPORTS_HLS = function() {
8640
+ var SUPPORTS_HLS = function SUPPORTS_HLS() {
8469
8641
  if (!IS_BROWSER) return false;
8470
8642
  var video = document.createElement("video");
8471
8643
  return Boolean(video.canPlayType("application/vnd.apple.mpegurl"));
8472
8644
  };
8473
- var SUPPORTS_DASH = function() {
8645
+ var SUPPORTS_DASH = function SUPPORTS_DASH() {
8474
8646
  if (!IS_BROWSER) return false;
8475
8647
  var video = document.createElement("video");
8476
8648
  return Boolean(video.canPlayType("application/dash+xml"));
@@ -8482,23 +8654,23 @@ var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
8482
8654
  var VIDEO_EXTENSIONS = /\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\?)/i;
8483
8655
  var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\?)/i;
8484
8656
  var canPlay = {
8485
- hls: function(url) {
8657
+ hls: function hls(url) {
8486
8658
  if (!url || typeof url !== "string") return false;
8487
8659
  return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);
8488
8660
  },
8489
- dash: function(url) {
8661
+ dash: function dash(url) {
8490
8662
  if (!url || typeof url !== "string") return false;
8491
8663
  return DASH_EXTENSIONS.test(url);
8492
8664
  },
8493
- video: function(url) {
8665
+ video: function video(url) {
8494
8666
  if (!url || typeof url !== "string") return false;
8495
8667
  return VIDEO_EXTENSIONS.test(url);
8496
8668
  },
8497
- audio: function(url) {
8669
+ audio: function audio(url) {
8498
8670
  if (!url || typeof url !== "string") return false;
8499
8671
  return AUDIO_EXTENSIONS.test(url);
8500
8672
  },
8501
- file: function(url) {
8673
+ file: function file(url) {
8502
8674
  if (!url || typeof url !== "string") return false;
8503
8675
  return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);
8504
8676
  }
@@ -8510,11 +8682,11 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react3_Component) {
8510
8682
  function HlsPlayer() {
8511
8683
  _class_call_check(this, HlsPlayer);
8512
8684
  var _this;
8513
- var _this1, _arguments = arguments;
8514
- _this = _call_super(this, HlsPlayer, _to_consumable_array(_arguments)), _this1 = _this;
8515
- _this1.player = null;
8516
- _this1.mounted = false;
8517
- _this1.load = function() {
8685
+ var _this1;
8686
+ _this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
8687
+ _this.player = null;
8688
+ _this.mounted = false;
8689
+ _this.load = function() {
8518
8690
  return _async_to_generator(function() {
8519
8691
  var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
8520
8692
  return _ts_generator(this, function(_state) {
@@ -8587,87 +8759,87 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react3_Component) {
8587
8759
  });
8588
8760
  })();
8589
8761
  };
8590
- _this1.play = function() {
8591
- if (_this1.props.videoElement) {
8592
- var video = _this1.props.videoElement;
8762
+ _this.play = function() {
8763
+ if (_this.props.videoElement) {
8764
+ var video = _this.props.videoElement;
8593
8765
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
8594
8766
  if (hasValidSource) {
8595
8767
  var _video_play, _this_props_onPlay, _this_props;
8596
8768
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
8597
8769
  var _this_props_onError, _this_props;
8598
8770
  console.error("[HlsPlayer] Failed to play:", error);
8599
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8771
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8600
8772
  });
8601
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8773
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8602
8774
  } else {
8603
8775
  console.warn("[HlsPlayer] Cannot play: video has no valid source");
8604
8776
  }
8605
8777
  }
8606
8778
  };
8607
- _this1.pause = function() {
8608
- if (_this1.props.videoElement) {
8779
+ _this.pause = function() {
8780
+ if (_this.props.videoElement) {
8609
8781
  var _this_props_onPause, _this_props;
8610
- _this1.props.videoElement.pause();
8611
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8782
+ _this.props.videoElement.pause();
8783
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8612
8784
  }
8613
8785
  };
8614
- _this1.stop = function() {
8615
- _this1.pause();
8616
- if (_this1.props.videoElement) {
8617
- _this1.props.videoElement.currentTime = 0;
8786
+ _this.stop = function() {
8787
+ _this.pause();
8788
+ if (_this.props.videoElement) {
8789
+ _this.props.videoElement.currentTime = 0;
8618
8790
  }
8619
8791
  };
8620
- _this1.seekTo = function(seconds, keepPlaying) {
8621
- if (_this1.props.videoElement) {
8622
- _this1.props.videoElement.currentTime = seconds;
8792
+ _this.seekTo = function(seconds, keepPlaying) {
8793
+ if (_this.props.videoElement) {
8794
+ _this.props.videoElement.currentTime = seconds;
8623
8795
  if (!keepPlaying) {
8624
- _this1.pause();
8796
+ _this.pause();
8625
8797
  }
8626
8798
  }
8627
8799
  };
8628
- _this1.setVolume = function(volume) {
8629
- if (_this1.props.videoElement) {
8630
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8800
+ _this.setVolume = function(volume) {
8801
+ if (_this.props.videoElement) {
8802
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8631
8803
  }
8632
8804
  };
8633
- _this1.mute = function() {
8634
- if (_this1.props.videoElement) {
8635
- _this1.props.videoElement.muted = true;
8805
+ _this.mute = function() {
8806
+ if (_this.props.videoElement) {
8807
+ _this.props.videoElement.muted = true;
8636
8808
  }
8637
8809
  };
8638
- _this1.unmute = function() {
8639
- if (_this1.props.videoElement) {
8640
- _this1.props.videoElement.muted = false;
8810
+ _this.unmute = function() {
8811
+ if (_this.props.videoElement) {
8812
+ _this.props.videoElement.muted = false;
8641
8813
  }
8642
8814
  };
8643
- _this1.setPlaybackRate = function(rate) {
8644
- if (_this1.props.videoElement && rate > 0) {
8645
- _this1.props.videoElement.playbackRate = rate;
8815
+ _this.setPlaybackRate = function(rate) {
8816
+ if (_this.props.videoElement && rate > 0) {
8817
+ _this.props.videoElement.playbackRate = rate;
8646
8818
  }
8647
8819
  };
8648
- _this1.getDuration = function() {
8649
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
8650
- return _this1.props.videoElement.duration;
8820
+ _this.getDuration = function() {
8821
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
8822
+ return _this.props.videoElement.duration;
8651
8823
  }
8652
8824
  return null;
8653
8825
  };
8654
- _this1.getCurrentTime = function() {
8655
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
8656
- return _this1.props.videoElement.currentTime;
8826
+ _this.getCurrentTime = function() {
8827
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
8828
+ return _this.props.videoElement.currentTime;
8657
8829
  }
8658
8830
  return null;
8659
8831
  };
8660
- _this1.getSecondsLoaded = function() {
8661
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
8662
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
8832
+ _this.getSecondsLoaded = function() {
8833
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
8834
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
8663
8835
  }
8664
8836
  return null;
8665
8837
  };
8666
- _this1.getInternalPlayer = function() {
8838
+ _this.getInternalPlayer = function() {
8667
8839
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
8668
- if (key === "player") return _this1.player;
8669
- if (key === "video") return _this1.props.videoElement;
8670
- if (key === "hls" && _this1.player) return _this1.player.hls;
8840
+ if (key === "player") return _this.player;
8841
+ if (key === "video") return _this.props.videoElement;
8842
+ if (key === "hls" && _this.player) return _this.player.hls;
8671
8843
  return null;
8672
8844
  };
8673
8845
  return _this;
@@ -8716,49 +8888,49 @@ var FilePlayer = /*#__PURE__*/ function(_import_react4_Component) {
8716
8888
  function FilePlayer() {
8717
8889
  _class_call_check(this, FilePlayer);
8718
8890
  var _this;
8719
- var _this1, _arguments = arguments;
8720
- _this = _call_super(this, FilePlayer, _to_consumable_array(_arguments)), _this1 = _this;
8721
- _this1.mounted = false;
8722
- _this1.ready = false;
8723
- _this1.load = function() {
8891
+ var _this1;
8892
+ _this = _call_super(this, FilePlayer, arguments), _this1 = _this;
8893
+ _this.mounted = false;
8894
+ _this.ready = false;
8895
+ _this.load = function() {
8724
8896
  var _this_props_onMount, _this_props;
8725
- if (!_this1.props.videoElement || !_this1.props.src) return;
8726
- var video = _this1.props.videoElement;
8727
- var handleLoadedMetadata = function() {
8728
- if (_this1.mounted && !_this1.ready) {
8897
+ if (!_this.props.videoElement || !_this.props.src) return;
8898
+ var video = _this.props.videoElement;
8899
+ var handleLoadedMetadata = function handleLoadedMetadata() {
8900
+ if (_this.mounted && !_this.ready) {
8729
8901
  var _this_props_onReady, _this_props;
8730
- _this1.ready = true;
8731
- (_this_props_onReady = (_this_props = _this1.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
8902
+ _this.ready = true;
8903
+ (_this_props_onReady = (_this_props = _this.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
8732
8904
  }
8733
8905
  };
8734
- var handlePlay = function() {
8735
- if (_this1.mounted) {
8906
+ var handlePlay = function handlePlay() {
8907
+ if (_this.mounted) {
8736
8908
  var _this_props_onPlay, _this_props;
8737
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8909
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8738
8910
  }
8739
8911
  };
8740
- var handlePause = function() {
8741
- if (_this1.mounted) {
8912
+ var handlePause = function handlePause() {
8913
+ if (_this.mounted) {
8742
8914
  var _this_props_onPause, _this_props;
8743
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8915
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8744
8916
  }
8745
8917
  };
8746
- var handleEnded = function() {
8747
- if (_this1.mounted) {
8918
+ var handleEnded = function handleEnded() {
8919
+ if (_this.mounted) {
8748
8920
  var _this_props_onEnded, _this_props;
8749
- (_this_props_onEnded = (_this_props = _this1.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
8921
+ (_this_props_onEnded = (_this_props = _this.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
8750
8922
  }
8751
8923
  };
8752
- var handleError = function(error) {
8753
- if (_this1.mounted) {
8924
+ var handleError = function handleError(error) {
8925
+ if (_this.mounted) {
8754
8926
  var _this_props_onError, _this_props;
8755
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8927
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8756
8928
  }
8757
8929
  };
8758
- var handleLoadedData = function() {
8759
- if (_this1.mounted) {
8930
+ var handleLoadedData = function handleLoadedData() {
8931
+ if (_this.mounted) {
8760
8932
  var _this_props_onLoaded, _this_props;
8761
- (_this_props_onLoaded = (_this_props = _this1.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
8933
+ (_this_props_onLoaded = (_this_props = _this.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
8762
8934
  }
8763
8935
  };
8764
8936
  video.addEventListener("loadedmetadata", handleLoadedMetadata);
@@ -8767,15 +8939,15 @@ var FilePlayer = /*#__PURE__*/ function(_import_react4_Component) {
8767
8939
  video.addEventListener("ended", handleEnded);
8768
8940
  video.addEventListener("error", handleError);
8769
8941
  video.addEventListener("loadeddata", handleLoadedData);
8770
- video.src = _this1.props.src;
8771
- if (_this1.props.autoplay !== void 0) video.autoplay = _this1.props.autoplay;
8772
- if (_this1.props.muted !== void 0) video.muted = _this1.props.muted;
8773
- if (_this1.props.loop !== void 0) video.loop = _this1.props.loop;
8774
- if (_this1.props.controls !== void 0) video.controls = _this1.props.controls;
8775
- if (_this1.props.playsInline !== void 0) video.playsInline = _this1.props.playsInline;
8776
- if (_this1.props.preload !== void 0) video.preload = _this1.props.preload;
8777
- if (_this1.props.poster !== void 0) video.poster = _this1.props.poster;
8778
- (_this_props_onMount = (_this_props = _this1.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this1);
8942
+ video.src = _this.props.src;
8943
+ if (_this.props.autoplay !== void 0) video.autoplay = _this.props.autoplay;
8944
+ if (_this.props.muted !== void 0) video.muted = _this.props.muted;
8945
+ if (_this.props.loop !== void 0) video.loop = _this.props.loop;
8946
+ if (_this.props.controls !== void 0) video.controls = _this.props.controls;
8947
+ if (_this.props.playsInline !== void 0) video.playsInline = _this.props.playsInline;
8948
+ if (_this.props.preload !== void 0) video.preload = _this.props.preload;
8949
+ if (_this.props.poster !== void 0) video.poster = _this.props.poster;
8950
+ (_this_props_onMount = (_this_props = _this.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this);
8779
8951
  return function() {
8780
8952
  video.removeEventListener("loadedmetadata", handleLoadedMetadata);
8781
8953
  video.removeEventListener("play", handlePlay);
@@ -8785,90 +8957,90 @@ var FilePlayer = /*#__PURE__*/ function(_import_react4_Component) {
8785
8957
  video.removeEventListener("loadeddata", handleLoadedData);
8786
8958
  };
8787
8959
  };
8788
- _this1.play = function() {
8789
- if (_this1.props.videoElement) {
8790
- var video = _this1.props.videoElement;
8960
+ _this.play = function() {
8961
+ if (_this.props.videoElement) {
8962
+ var video = _this.props.videoElement;
8791
8963
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
8792
8964
  if (hasValidSource) {
8793
8965
  var _video_play;
8794
8966
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
8795
8967
  var _this_props_onError, _this_props;
8796
8968
  console.error("[FilePlayer] Failed to play:", error);
8797
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8969
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8798
8970
  });
8799
8971
  } else {
8800
8972
  console.warn("[FilePlayer] Cannot play: video has no valid source");
8801
8973
  }
8802
8974
  }
8803
8975
  };
8804
- _this1.pause = function() {
8805
- if (_this1.props.videoElement) {
8806
- _this1.props.videoElement.pause();
8976
+ _this.pause = function() {
8977
+ if (_this.props.videoElement) {
8978
+ _this.props.videoElement.pause();
8807
8979
  }
8808
8980
  };
8809
- _this1.stop = function() {
8810
- _this1.pause();
8811
- if (_this1.props.videoElement) {
8812
- _this1.props.videoElement.currentTime = 0;
8981
+ _this.stop = function() {
8982
+ _this.pause();
8983
+ if (_this.props.videoElement) {
8984
+ _this.props.videoElement.currentTime = 0;
8813
8985
  }
8814
8986
  };
8815
- _this1.seekTo = function(seconds, keepPlaying) {
8816
- if (_this1.props.videoElement) {
8817
- _this1.props.videoElement.currentTime = seconds;
8987
+ _this.seekTo = function(seconds, keepPlaying) {
8988
+ if (_this.props.videoElement) {
8989
+ _this.props.videoElement.currentTime = seconds;
8818
8990
  if (!keepPlaying) {
8819
- _this1.pause();
8991
+ _this.pause();
8820
8992
  }
8821
8993
  }
8822
8994
  };
8823
- _this1.setVolume = function(volume) {
8824
- if (_this1.props.videoElement) {
8825
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8995
+ _this.setVolume = function(volume) {
8996
+ if (_this.props.videoElement) {
8997
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8826
8998
  }
8827
8999
  };
8828
- _this1.mute = function() {
8829
- if (_this1.props.videoElement) {
8830
- _this1.props.videoElement.muted = true;
9000
+ _this.mute = function() {
9001
+ if (_this.props.videoElement) {
9002
+ _this.props.videoElement.muted = true;
8831
9003
  }
8832
9004
  };
8833
- _this1.unmute = function() {
8834
- if (_this1.props.videoElement) {
8835
- _this1.props.videoElement.muted = false;
9005
+ _this.unmute = function() {
9006
+ if (_this.props.videoElement) {
9007
+ _this.props.videoElement.muted = false;
8836
9008
  }
8837
9009
  };
8838
- _this1.setPlaybackRate = function(rate) {
8839
- if (_this1.props.videoElement && rate > 0) {
8840
- _this1.props.videoElement.playbackRate = rate;
9010
+ _this.setPlaybackRate = function(rate) {
9011
+ if (_this.props.videoElement && rate > 0) {
9012
+ _this.props.videoElement.playbackRate = rate;
8841
9013
  }
8842
9014
  };
8843
- _this1.setLoop = function(loop) {
8844
- if (_this1.props.videoElement) {
8845
- _this1.props.videoElement.loop = loop;
9015
+ _this.setLoop = function(loop) {
9016
+ if (_this.props.videoElement) {
9017
+ _this.props.videoElement.loop = loop;
8846
9018
  }
8847
9019
  };
8848
- _this1.getDuration = function() {
8849
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
8850
- return _this1.props.videoElement.duration;
9020
+ _this.getDuration = function() {
9021
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
9022
+ return _this.props.videoElement.duration;
8851
9023
  }
8852
9024
  return null;
8853
9025
  };
8854
- _this1.getCurrentTime = function() {
8855
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
8856
- return _this1.props.videoElement.currentTime;
9026
+ _this.getCurrentTime = function() {
9027
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
9028
+ return _this.props.videoElement.currentTime;
8857
9029
  }
8858
9030
  return null;
8859
9031
  };
8860
- _this1.getSecondsLoaded = function() {
8861
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
8862
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
9032
+ _this.getSecondsLoaded = function() {
9033
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
9034
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
8863
9035
  }
8864
9036
  return null;
8865
9037
  };
8866
- _this1.getInternalPlayer = function() {
9038
+ _this.getInternalPlayer = function() {
8867
9039
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
8868
- if (key === "video") return _this1.props.videoElement;
9040
+ if (key === "video") return _this.props.videoElement;
8869
9041
  return null;
8870
9042
  };
8871
- _this1.enablePIP = function() {
9043
+ _this.enablePIP = function() {
8872
9044
  return _async_to_generator(function() {
8873
9045
  var error;
8874
9046
  return _ts_generator(this, function(_state) {
@@ -8911,7 +9083,7 @@ var FilePlayer = /*#__PURE__*/ function(_import_react4_Component) {
8911
9083
  });
8912
9084
  })();
8913
9085
  };
8914
- _this1.disablePIP = function() {
9086
+ _this.disablePIP = function() {
8915
9087
  return _async_to_generator(function() {
8916
9088
  var error;
8917
9089
  return _ts_generator(this, function(_state) {
@@ -9005,7 +9177,7 @@ var players = [
9005
9177
  key: "file",
9006
9178
  name: "File Player",
9007
9179
  canPlay: canPlay.file,
9008
- canEnablePIP: function(url) {
9180
+ canEnablePIP: function canEnablePIP(url) {
9009
9181
  return canPlay.file(url) && (document.pictureInPictureEnabled || typeof document.webkitSupportsPresentationMode === "function");
9010
9182
  },
9011
9183
  lazyPlayer: lazy(function() {
@@ -9331,7 +9503,7 @@ var SUPPORTED_PROPS = [
9331
9503
  "onControlClick"
9332
9504
  ];
9333
9505
  var customPlayers = [];
9334
- var createStormcloudPlayer = function(playerList, fallback) {
9506
+ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallback) {
9335
9507
  var _a;
9336
9508
  return _a = /*#__PURE__*/ function(_import_react6_Component) {
9337
9509
  _inherits(_a, _import_react6_Component);
@@ -9343,10 +9515,10 @@ var createStormcloudPlayer = function(playerList, fallback) {
9343
9515
  showPreview: false
9344
9516
  };
9345
9517
  _this.references = {
9346
- wrapper: function(wrapper) {
9518
+ wrapper: function wrapper(wrapper) {
9347
9519
  _this.wrapper = wrapper;
9348
9520
  },
9349
- player: function(player) {
9521
+ player: function player(player) {
9350
9522
  _this.player = player;
9351
9523
  }
9352
9524
  };
@@ -9528,6 +9700,9 @@ var StormcloudPlayer_default = StormcloudPlayer;
9528
9700
  parseQuery: parseQuery,
9529
9701
  players: players,
9530
9702
  randomString: randomString,
9703
+ sendAdDetectTracking: sendAdDetectTracking,
9704
+ sendAdImpressionTracking: sendAdImpressionTracking,
9705
+ sendAdLoadedTracking: sendAdLoadedTracking,
9531
9706
  sendHeartbeat: sendHeartbeat,
9532
9707
  sendInitialTracking: sendInitialTracking,
9533
9708
  supportsFeature: supportsFeature,