stormcloud-video-player 0.3.53 → 0.3.54

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.
@@ -227,9 +227,17 @@ function _ts_generator(thisArg, body) {
227
227
  },
228
228
  trys: [],
229
229
  ops: []
230
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
231
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
232
- return this;
230
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
231
+ return d(g, "next", {
232
+ value: verb(0)
233
+ }), d(g, "throw", {
234
+ value: verb(1)
235
+ }), d(g, "return", {
236
+ value: verb(2)
237
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
238
+ value: function() {
239
+ return this;
240
+ }
233
241
  }), g;
234
242
  function verb(n) {
235
243
  return function(v) {
@@ -329,20 +337,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
329
337
  var __getOwnPropNames = Object.getOwnPropertyNames;
330
338
  var __getProtoOf = Object.getPrototypeOf;
331
339
  var __hasOwnProp = Object.prototype.hasOwnProperty;
332
- var __export = function(target, all) {
340
+ var __export = function __export(target, all) {
333
341
  for(var name in all)__defProp(target, name, {
334
342
  get: all[name],
335
343
  enumerable: true
336
344
  });
337
345
  };
338
- var __copyProps = function(to, from, except, desc) {
346
+ var __copyProps = function __copyProps(to, from, except, desc) {
339
347
  if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
340
348
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
341
349
  try {
342
350
  var _loop = function() {
343
351
  var key = _step.value;
344
352
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
345
- get: function() {
353
+ get: function get() {
346
354
  return from[key];
347
355
  },
348
356
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -366,7 +374,7 @@ var __copyProps = function(to, from, except, desc) {
366
374
  }
367
375
  return to;
368
376
  };
369
- var __toESM = function(mod, isNodeMode, target) {
377
+ var __toESM = function __toESM(mod, isNodeMode, target) {
370
378
  return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
371
379
  // file that has been converted to a CommonJS file using a Babel-
372
380
  // compatible transform (i.e. "__esModule" has not been set), then set
@@ -376,7 +384,7 @@ var __toESM = function(mod, isNodeMode, target) {
376
384
  enumerable: true
377
385
  }) : target, mod);
378
386
  };
379
- var __toCommonJS = function(mod) {
387
+ var __toCommonJS = function __toCommonJS(mod) {
380
388
  return __copyProps(__defProp({}, "__esModule", {
381
389
  value: true
382
390
  }), mod);
@@ -384,7 +392,7 @@ var __toCommonJS = function(mod) {
384
392
  // src/players/index.ts
385
393
  var players_exports = {};
386
394
  __export(players_exports, {
387
- default: function() {
395
+ default: function _default() {
388
396
  return players_default;
389
397
  }
390
398
  });
@@ -403,23 +411,23 @@ var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
403
411
  var VIDEO_EXTENSIONS = /\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\?)/i;
404
412
  var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\?)/i;
405
413
  var canPlay = {
406
- hls: function(url) {
414
+ hls: function hls(url) {
407
415
  if (!url || typeof url !== "string") return false;
408
416
  return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);
409
417
  },
410
- dash: function(url) {
418
+ dash: function dash(url) {
411
419
  if (!url || typeof url !== "string") return false;
412
420
  return DASH_EXTENSIONS.test(url);
413
421
  },
414
- video: function(url) {
422
+ video: function video(url) {
415
423
  if (!url || typeof url !== "string") return false;
416
424
  return VIDEO_EXTENSIONS.test(url);
417
425
  },
418
- audio: function(url) {
426
+ audio: function audio(url) {
419
427
  if (!url || typeof url !== "string") return false;
420
428
  return AUDIO_EXTENSIONS.test(url);
421
429
  },
422
- file: function(url) {
430
+ file: function file(url) {
423
431
  if (!url || typeof url !== "string") return false;
424
432
  return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);
425
433
  }
@@ -755,7 +763,7 @@ function createImaController(video, options) {
755
763
  var fn = _step.value;
756
764
  try {
757
765
  fn(payload);
758
- } catch (e) {}
766
+ } catch (unused) {}
759
767
  }
760
768
  } catch (err) {
761
769
  _didIteratorError = true;
@@ -793,7 +801,7 @@ function createImaController(video, options) {
793
801
  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'.");
794
802
  }
795
803
  }
796
- } catch (e) {}
804
+ } catch (unused) {}
797
805
  if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
798
806
  var existing = document.querySelector('script[data-ima="true"]');
799
807
  if (existing) {
@@ -835,9 +843,6 @@ function createImaController(video, options) {
835
843
  var adDisplayContainer;
836
844
  var adContainerEl;
837
845
  var lastAdTagUrl;
838
- var retryAttempts = 0;
839
- var maxRetries = 2;
840
- var backoffBaseMs = 500;
841
846
  var adsLoadedPromise;
842
847
  var adsLoadedResolve;
843
848
  var adsLoadedReject;
@@ -1041,7 +1046,7 @@ function createImaController(video, options) {
1041
1046
  if (adsManager) {
1042
1047
  try {
1043
1048
  adsManager.destroy();
1044
- } catch (e) {}
1049
+ } catch (unused) {}
1045
1050
  adsManager = void 0;
1046
1051
  }
1047
1052
  if (adVideoElement) {
@@ -1052,7 +1057,7 @@ function createImaController(video, options) {
1052
1057
  if (adsLoader) {
1053
1058
  try {
1054
1059
  adsLoader.destroy();
1055
- } catch (e) {}
1060
+ } catch (unused) {}
1056
1061
  adsLoader = void 0;
1057
1062
  }
1058
1063
  }
@@ -1070,7 +1075,7 @@ function createImaController(video, options) {
1070
1075
  try {
1071
1076
  var _adDisplayContainer_initialize;
1072
1077
  (_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
1073
- } catch (e) {}
1078
+ } catch (unused) {}
1074
1079
  }
1075
1080
  }).catch(function() {});
1076
1081
  },
@@ -1134,7 +1139,6 @@ function createImaController(video, options) {
1134
1139
  _state.sent();
1135
1140
  google = window.google;
1136
1141
  lastAdTagUrl = vastTagUrl;
1137
- retryAttempts = 0;
1138
1142
  if (!adDisplayContainer) {
1139
1143
  container = document.createElement("div");
1140
1144
  container.style.position = "absolute";
@@ -1218,32 +1222,23 @@ function createImaController(video, options) {
1218
1222
  }
1219
1223
  }, 300);
1220
1224
  }
1221
- hideContentVideo();
1225
+ showContentVideo();
1222
1226
  if (adsLoadedReject) {
1223
1227
  adsLoadedReject(new Error("Ad playback error"));
1224
1228
  adsLoadedReject = void 0;
1225
1229
  adsLoadedResolve = void 0;
1226
1230
  }
1227
- if (lastAdTagUrl && retryAttempts < maxRetries && !isNoFill) {
1228
- var delay = backoffBaseMs * Math.pow(2, retryAttempts++);
1229
- window.setTimeout(function() {
1230
- try {
1231
- makeAdsRequest(google, lastAdTagUrl);
1232
- } catch (e) {}
1233
- }, delay);
1234
- } else {
1235
- emit("ad_error", {
1236
- code: errorCode,
1237
- vastErrorCode: vastErrorCode,
1238
- message: errorMessage,
1239
- cause: innerError,
1240
- isNoFill: isNoFill
1241
- });
1242
- if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
1243
- if (video.paused) {
1244
- var _video_play;
1245
- (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
1246
- }
1231
+ emit("ad_error", {
1232
+ code: errorCode,
1233
+ vastErrorCode: vastErrorCode,
1234
+ message: errorMessage,
1235
+ cause: innerError,
1236
+ isNoFill: isNoFill
1237
+ });
1238
+ if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
1239
+ if (video.paused) {
1240
+ var _video_play;
1241
+ (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
1247
1242
  }
1248
1243
  }
1249
1244
  });
@@ -1261,7 +1256,7 @@ function createImaController(video, options) {
1261
1256
  if (adsManager) {
1262
1257
  try {
1263
1258
  adsManager.setVolume(adVolume);
1264
- } catch (e) {}
1259
+ } catch (unused) {}
1265
1260
  }
1266
1261
  emit("content_pause");
1267
1262
  });
@@ -1275,7 +1270,7 @@ function createImaController(video, options) {
1275
1270
  if (adsManager) {
1276
1271
  try {
1277
1272
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1278
- } catch (e) {}
1273
+ } catch (unused) {}
1279
1274
  }
1280
1275
  }
1281
1276
  if (adContainerEl) {
@@ -1289,7 +1284,7 @@ function createImaController(video, options) {
1289
1284
  adsManager.addEventListener(AdEvent.CONTENT_RESUME_REQUESTED, function() {
1290
1285
  adPlaying = false;
1291
1286
  setAdPlayingFlag(false);
1292
- hideContentVideo();
1287
+ showContentVideo();
1293
1288
  emit("content_resume");
1294
1289
  });
1295
1290
  adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, function() {
@@ -1305,7 +1300,7 @@ function createImaController(video, options) {
1305
1300
  }
1306
1301
  }, 300);
1307
1302
  }
1308
- hideContentVideo();
1303
+ showContentVideo();
1309
1304
  emit("all_ads_completed");
1310
1305
  });
1311
1306
  if (adsLoadedResolve) {
@@ -1327,7 +1322,7 @@ function createImaController(video, options) {
1327
1322
  }
1328
1323
  }, 300);
1329
1324
  }
1330
- hideContentVideo();
1325
+ showContentVideo();
1331
1326
  if (adsLoadedReject) {
1332
1327
  adsLoadedReject(new Error("Failed to setup ads manager"));
1333
1328
  adsLoadedReject = void 0;
@@ -1370,7 +1365,7 @@ function createImaController(video, options) {
1370
1365
  }
1371
1366
  }, 300);
1372
1367
  }
1373
- hideContentVideo();
1368
+ showContentVideo();
1374
1369
  if (adsLoadedReject) {
1375
1370
  adsLoadedReject(new Error(isNoFill ? "No ads available" : "Ads loader error"));
1376
1371
  adsLoadedReject = void 0;
@@ -1436,7 +1431,7 @@ function createImaController(video, options) {
1436
1431
  }
1437
1432
  try {
1438
1433
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1439
- } catch (e) {}
1434
+ } catch (unused) {}
1440
1435
  adsManager.start();
1441
1436
  return [
1442
1437
  2,
@@ -1518,7 +1513,7 @@ function createImaController(video, options) {
1518
1513
  try {
1519
1514
  ;
1520
1515
  adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
1521
- } catch (e) {}
1516
+ } catch (unused) {}
1522
1517
  destroyAdsManager();
1523
1518
  return [
1524
1519
  2
@@ -1549,7 +1544,7 @@ function createImaController(video, options) {
1549
1544
  try {
1550
1545
  var _adsLoader_destroy;
1551
1546
  adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
1552
- } catch (e) {}
1547
+ } catch (unused) {}
1553
1548
  adDisplayContainer = void 0;
1554
1549
  adsLoader = void 0;
1555
1550
  contentVideoHidden = false;
@@ -1598,7 +1593,7 @@ function createImaController(video, options) {
1598
1593
  if (adsManager && adPlaying) {
1599
1594
  try {
1600
1595
  adsManager.setVolume(clampedVolume);
1601
- } catch (e) {}
1596
+ } catch (unused) {}
1602
1597
  }
1603
1598
  },
1604
1599
  getAdVolume: function getAdVolume() {
@@ -3091,16 +3086,23 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3091
3086
  this.maxPlaceholderDurationMs = 5e3;
3092
3087
  this.isShowingPlaceholder = false;
3093
3088
  this.totalAdRequestsInBreak = 0;
3094
- this.maxTotalAdRequestsPerBreak = 20;
3089
+ this.maxTotalAdRequestsPerBreak = 10;
3095
3090
  this.pendingAdBreak = null;
3096
3091
  this.consecutiveFailures = 0;
3097
3092
  this.maxConsecutiveFailures = 5;
3098
3093
  this.lastAdRequestTime = 0;
3099
- this.minAdRequestIntervalMs = 2500;
3094
+ this.minAdRequestIntervalMs = 3e3;
3100
3095
  this.backoffBaseMs = 1e3;
3101
3096
  this.maxBackoffMs = 15e3;
3097
+ this.globalConsecutiveNoFills = 0;
3098
+ this.globalNoFillThreshold = 3;
3099
+ this.globalNoFillCooldownUntil = 0;
3100
+ this.globalNoFillBackoffBaseMs = 5e3;
3101
+ this.globalNoFillBackoffMaxMs = 6e4;
3102
+ this.globalLastGamRequestTime = 0;
3103
+ this.globalMinGamIntervalMs = 3e3;
3102
3104
  this.preloadPool = [];
3103
- this.maxPreloadPoolSize = 3;
3105
+ this.maxPreloadPoolSize = 2;
3104
3106
  this.preloadPoolActive = false;
3105
3107
  this.preloadPoolLoopRunning = false;
3106
3108
  this.continuousFetchLoopRunning = false;
@@ -3243,7 +3245,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3243
3245
  });
3244
3246
  this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
3245
3247
  return _async_to_generator(function() {
3246
- var _this_hls_levels, _this_hls, _this_hls_levels_some, adBehavior, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
3248
+ var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
3247
3249
  return _ts_generator(this, function(_state) {
3248
3250
  switch(_state.label){
3249
3251
  case 0:
@@ -3252,10 +3254,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3252
3254
  } else {
3253
3255
  ;
3254
3256
  ;
3255
- 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) {
3257
+ 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) {
3256
3258
  var _level_details, _level_details1;
3257
3259
  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";
3258
- })) !== null && _this_hls_levels_some !== void 0 ? _this_hls_levels_some : false;
3260
+ })) !== null && _ref !== void 0 ? _ref : false;
3259
3261
  }
3260
3262
  if (this.config.debugAdTiming) {
3261
3263
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -3319,9 +3321,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3319
3321
  var tag = "";
3320
3322
  var value = "";
3321
3323
  if (Array.isArray(entry)) {
3322
- var _entry_;
3324
+ var _entry_, _entry_1;
3323
3325
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
3324
- var _entry_1;
3325
3326
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
3326
3327
  } else if (typeof entry === "string") {
3327
3328
  var idx = entry.indexOf(":");
@@ -3444,9 +3445,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3444
3445
  var tag = "";
3445
3446
  var value = "";
3446
3447
  if (Array.isArray(entry)) {
3447
- var _entry_;
3448
+ var _entry_, _entry_1;
3448
3449
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
3449
- var _entry_1;
3450
3450
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
3451
3451
  } else if (typeof entry === "string") {
3452
3452
  var idx = entry.indexOf(":");
@@ -3496,10 +3496,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3496
3496
  }
3497
3497
  });
3498
3498
  } else if (tag.includes("EXT-X-DATERANGE")) {
3499
+ var _attrs_CLASS;
3499
3500
  var attrs = _this.parseAttributeList(value);
3500
3501
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
3501
3502
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
3502
- var _attrs_CLASS;
3503
3503
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
3504
3504
  var duration = _this.toNumber(attrs["DURATION"]);
3505
3505
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -3613,6 +3613,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3613
3613
  _this.clearAdRequestWatchdog();
3614
3614
  _this.activeAdRequestToken = null;
3615
3615
  _this.showAds = true;
3616
+ _this.resetGamNoFillCounter();
3616
3617
  if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null) {
3617
3618
  if (_this.adStopTimerId == null) {
3618
3619
  _this.currentAdBreakStartWallClockMs = Date.now();
@@ -3901,11 +3902,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3901
3902
  }
3902
3903
  var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
3903
3904
  if (daterangeMatch) {
3904
- var _daterangeMatch_;
3905
+ var _daterangeMatch_, _attrs_CLASS;
3905
3906
  var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
3906
3907
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
3907
3908
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
3908
- var _attrs_CLASS;
3909
3909
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
3910
3910
  var duration = this.toNumber(attrs["DURATION"]);
3911
3911
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -3981,7 +3981,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3981
3981
  var out = "";
3982
3982
  for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
3983
3983
  return out;
3984
- } catch (e) {
3984
+ } catch (unused) {
3985
3985
  return void 0;
3986
3986
  }
3987
3987
  }
@@ -4000,6 +4000,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4000
4000
  });
4001
4001
  }
4002
4002
  if (marker.type === "start") {
4003
+ var _this_config_immediateManifestAds;
4003
4004
  var _this_pendingAdBreak;
4004
4005
  if (!this.video.muted) {
4005
4006
  this.video.muted = true;
@@ -4024,7 +4025,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4024
4025
  this.expectedAdBreakDurationMs = durationMs;
4025
4026
  this.currentAdBreakStartWallClockMs = Date.now();
4026
4027
  var isManifestMarker = this.isManifestBasedMarker(marker);
4027
- var _this_config_immediateManifestAds;
4028
4028
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
4029
4029
  if (this.config.debugAdTiming) {
4030
4030
  console.log("[StormcloudVideoPlayer] Ad start decision:", {
@@ -4179,9 +4179,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4179
4179
  var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
4180
4180
  var match;
4181
4181
  while((match = regex.exec(value)) !== null){
4182
- var _match_;
4182
+ var _match_, _ref, _match_1;
4183
4183
  var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
4184
- var _match_1, _ref;
4185
4184
  var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
4186
4185
  if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
4187
4186
  rawVal = rawVal.slice(1, -1);
@@ -4526,13 +4525,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4526
4525
  {
4527
4526
  key: "shouldShowNativeControls",
4528
4527
  value: function shouldShowNativeControls() {
4528
+ var _this_config_showCustomControls;
4529
4529
  var streamType = this.getStreamType();
4530
4530
  if (streamType === "other") {
4531
- var _this_config_showCustomControls;
4532
- return !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false);
4531
+ var _this_config_showCustomControls1;
4532
+ return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
4533
4533
  }
4534
- var _this_config_showCustomControls1;
4535
- return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
4534
+ return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
4536
4535
  }
4537
4536
  },
4538
4537
  {
@@ -4640,6 +4639,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4640
4639
  var _this, loadPromise;
4641
4640
  return _ts_generator(this, function(_state) {
4642
4641
  _this = this;
4642
+ if (this.isGamInCooldown()) {
4643
+ if (this.config.debugAdTiming) {
4644
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping preload");
4645
+ }
4646
+ return [
4647
+ 2
4648
+ ];
4649
+ }
4643
4650
  if (this.preloadPool.some(function(entry) {
4644
4651
  return entry.vastUrl === vastUrl;
4645
4652
  }) || this.failedVastUrls.has(vastUrl) || this.isUrlInCooldown(vastUrl)) {
@@ -4669,26 +4676,32 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4669
4676
  case 1:
4670
4677
  _state.trys.push([
4671
4678
  1,
4672
- 4,
4679
+ 5,
4673
4680
  ,
4674
- 5
4681
+ 6
4675
4682
  ]);
4676
4683
  continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
4677
4684
  preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
4678
4685
  preloadIma.initialize();
4679
- errorListener = function(payload) {
4686
+ errorListener = function errorListener(payload) {
4680
4687
  hasAdError = true;
4681
4688
  adErrorPayload = payload;
4682
4689
  };
4683
4690
  preloadIma.on("ad_error", errorListener);
4684
- errorListenerCleanup = function() {
4691
+ errorListenerCleanup = function errorListenerCleanup() {
4685
4692
  return preloadIma.off("ad_error", errorListener);
4686
4693
  };
4687
4694
  return [
4688
4695
  4,
4689
- preloadIma.requestAds(vastUrl)
4696
+ this.enforceGlobalRateLimit()
4690
4697
  ];
4691
4698
  case 2:
4699
+ _state.sent();
4700
+ return [
4701
+ 4,
4702
+ preloadIma.requestAds(vastUrl)
4703
+ ];
4704
+ case 3:
4692
4705
  _state.sent();
4693
4706
  preloadIma.pause();
4694
4707
  return [
@@ -4697,7 +4710,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4697
4710
  return setTimeout(resolve, 1500);
4698
4711
  })
4699
4712
  ];
4700
- case 3:
4713
+ case 4:
4701
4714
  _state.sent();
4702
4715
  preloadIma.pause();
4703
4716
  if (hasAdError) {
@@ -4706,6 +4719,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4706
4719
  errorListenerCleanup();
4707
4720
  }
4708
4721
  preloadIma.destroy();
4722
+ this.recordGamNoFill();
4709
4723
  if (isNoFill) {
4710
4724
  if (this.config.debugAdTiming) {
4711
4725
  console.log("[PRELOAD-POOL] ⚠️ Ad preload returned no-fill: ".concat(vastUrl));
@@ -4732,7 +4746,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4732
4746
  isReady: true,
4733
4747
  loadPromise: Promise.resolve()
4734
4748
  };
4735
- lateErrorListener = function(payload) {
4749
+ lateErrorListener = function lateErrorListener(payload) {
4736
4750
  var index = _this.preloadPool.findIndex(function(entry) {
4737
4751
  return entry.vastUrl === vastUrl;
4738
4752
  });
@@ -4743,7 +4757,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4743
4757
  }
4744
4758
  try {
4745
4759
  preloadIma.destroy();
4746
- } catch (e) {}
4760
+ } catch (unused) {}
4747
4761
  }
4748
4762
  };
4749
4763
  preloadIma.on("ad_error", lateErrorListener);
@@ -4756,13 +4770,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4756
4770
  }
4757
4771
  return [
4758
4772
  3,
4759
- 5
4773
+ 6
4760
4774
  ];
4761
- case 4:
4775
+ case 5:
4762
4776
  error = _state.sent();
4763
4777
  if (errorListenerCleanup) {
4764
4778
  errorListenerCleanup();
4765
4779
  }
4780
+ this.recordGamNoFill();
4766
4781
  if (this.config.debugAdTiming) {
4767
4782
  console.warn("[PRELOAD-POOL] ⚠️ Failed to preload ad: ".concat(vastUrl), error);
4768
4783
  }
@@ -4773,9 +4788,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4773
4788
  }
4774
4789
  return [
4775
4790
  3,
4776
- 5
4791
+ 6
4777
4792
  ];
4778
- case 5:
4793
+ case 6:
4779
4794
  return [
4780
4795
  2
4781
4796
  ];
@@ -4814,6 +4829,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4814
4829
  3,
4815
4830
  10
4816
4831
  ];
4832
+ if (this.isGamInCooldown()) {
4833
+ if (this.config.debugAdTiming) {
4834
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping preload pool loop");
4835
+ }
4836
+ return [
4837
+ 3,
4838
+ 10
4839
+ ];
4840
+ }
4817
4841
  if (!(!this.inAdBreak && this.preloadPool.length >= this.maxPreloadPoolSize)) return [
4818
4842
  3,
4819
4843
  3
@@ -4846,7 +4870,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4846
4870
  3,
4847
4871
  8
4848
4872
  ];
4849
- if (!this.preloadPoolActive) {
4873
+ if (!this.preloadPoolActive || this.isGamInCooldown()) {
4850
4874
  return [
4851
4875
  3,
4852
4876
  8
@@ -5062,9 +5086,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5062
5086
  case 1:
5063
5087
  _state.trys.push([
5064
5088
  1,
5065
- 7,
5089
+ 8,
5066
5090
  ,
5067
- 13
5091
+ 14
5068
5092
  ]);
5069
5093
  if (!(usePreloadedAd && preloadedController)) return [
5070
5094
  3,
@@ -5100,15 +5124,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5100
5124
  this.ima.setAdVolume(adVolume);
5101
5125
  return [
5102
5126
  3,
5103
- 6
5127
+ 7
5104
5128
  ];
5105
5129
  case 3:
5130
+ return [
5131
+ 4,
5132
+ this.enforceGlobalRateLimit()
5133
+ ];
5134
+ case 4:
5135
+ _state.sent();
5106
5136
  this.lastAdRequestTime = Date.now();
5107
5137
  return [
5108
5138
  4,
5109
5139
  this.ima.requestAds(firstAdUrl)
5110
5140
  ];
5111
- case 4:
5141
+ case 5:
5112
5142
  _state.sent();
5113
5143
  if (this.config.debugAdTiming) {
5114
5144
  console.log("[CONTINUOUS-FETCH] \u2705 First ad request successful, starting playback");
@@ -5123,7 +5153,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5123
5153
  4,
5124
5154
  this.ima.play()
5125
5155
  ];
5126
- case 5:
5156
+ case 6:
5127
5157
  _state.sent();
5128
5158
  if (this.expectedAdBreakDurationMs != null) {
5129
5159
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -5131,36 +5161,36 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5131
5161
  }
5132
5162
  adVolume1 = currentMuted ? 0 : currentVolume;
5133
5163
  this.ima.setAdVolume(adVolume1);
5134
- _state.label = 6;
5135
- case 6:
5164
+ _state.label = 7;
5165
+ case 7:
5136
5166
  return [
5137
5167
  3,
5138
- 13
5168
+ 14
5139
5169
  ];
5140
- case 7:
5170
+ case 8:
5141
5171
  error = _state.sent();
5142
5172
  if (this.config.debugAdTiming) {
5143
5173
  console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
5144
5174
  }
5145
5175
  if (!!usePreloadedAd) return [
5146
5176
  3,
5147
- 11
5177
+ 12
5148
5178
  ];
5149
5179
  fallbackPreloaded = this.getPreloadedAd();
5150
5180
  if (!fallbackPreloaded) return [
5151
5181
  3,
5152
- 11
5182
+ 12
5153
5183
  ];
5154
5184
  if (this.config.debugAdTiming) {
5155
5185
  console.log("[CONTINUOUS-FETCH] \uD83D\uDD04 First ad failed, using preloaded fallback");
5156
5186
  }
5157
- _state.label = 8;
5158
- case 8:
5187
+ _state.label = 9;
5188
+ case 9:
5159
5189
  _state.trys.push([
5160
- 8,
5161
- 10,
5190
+ 9,
5191
+ 11,
5162
5192
  ,
5163
- 11
5193
+ 12
5164
5194
  ]);
5165
5195
  this.ima.destroy();
5166
5196
  this.video.muted = true;
@@ -5179,7 +5209,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5179
5209
  4,
5180
5210
  this.ima.play()
5181
5211
  ];
5182
- case 9:
5212
+ case 10:
5183
5213
  _state.sent();
5184
5214
  if (this.expectedAdBreakDurationMs != null) {
5185
5215
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -5190,16 +5220,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5190
5220
  return [
5191
5221
  2
5192
5222
  ];
5193
- case 10:
5223
+ case 11:
5194
5224
  fallbackError = _state.sent();
5195
5225
  if (this.config.debugAdTiming) {
5196
5226
  console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F Preloaded fallback also failed:", fallbackError);
5197
5227
  }
5198
5228
  return [
5199
5229
  3,
5200
- 11
5230
+ 12
5201
5231
  ];
5202
- case 11:
5232
+ case 12:
5203
5233
  if (this.isTemporaryAdError(error)) {
5204
5234
  this.temporaryFailureUrls.set(firstAdUrl, Date.now());
5205
5235
  if (this.config.debugAdTiming) {
@@ -5217,13 +5247,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5217
5247
  4,
5218
5248
  this.tryNextAvailableAdWithRateLimit()
5219
5249
  ];
5220
- case 12:
5250
+ case 13:
5221
5251
  _state.sent();
5222
5252
  return [
5223
5253
  3,
5224
- 13
5254
+ 14
5225
5255
  ];
5226
- case 13:
5256
+ case 14:
5227
5257
  return [
5228
5258
  2
5229
5259
  ];
@@ -5274,6 +5304,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5274
5304
  "break"
5275
5305
  ];
5276
5306
  }
5307
+ if (_this.isGamInCooldown()) {
5308
+ if (_this.config.debugAdTiming) {
5309
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping URL generation");
5310
+ }
5311
+ return [
5312
+ 2,
5313
+ "break"
5314
+ ];
5315
+ }
5277
5316
  if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
5278
5317
  if (_this.config.debugAdTiming) {
5279
5318
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
@@ -5470,6 +5509,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5470
5509
  2
5471
5510
  ];
5472
5511
  }
5512
+ if (this.isGamInCooldown()) {
5513
+ if (this.config.debugAdTiming) {
5514
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, ending ad break gracefully");
5515
+ }
5516
+ this.handleAdPodComplete();
5517
+ return [
5518
+ 2
5519
+ ];
5520
+ }
5473
5521
  if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
5474
5522
  if (this.config.debugAdTiming) {
5475
5523
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(this.consecutiveFailures, "), ending ad break"));
@@ -5666,6 +5714,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5666
5714
  case 0:
5667
5715
  remaining = this.getRemainingAdMs();
5668
5716
  waitTime = Math.min(this.maxPlaceholderDurationMs, remaining);
5717
+ if (this.isGamInCooldown()) {
5718
+ if (this.config.debugAdTiming) {
5719
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping placeholder wait");
5720
+ }
5721
+ this.handleAdPodComplete();
5722
+ return [
5723
+ 2
5724
+ ];
5725
+ }
5669
5726
  if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
5670
5727
  if (this.config.debugAdTiming) {
5671
5728
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Skipping placeholder - too many consecutive failures");
@@ -5929,11 +5986,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5929
5986
  {
5930
5987
  key: "ensureAdStoppedByTimer",
5931
5988
  value: function ensureAdStoppedByTimer() {
5989
+ var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
5932
5990
  if (!this.inAdBreak) return;
5933
5991
  this.adStopTimerId = void 0;
5934
5992
  var adPlaying = this.ima.isAdPlaying();
5935
5993
  var pendingAds = this.adPodQueue.length > 0;
5936
- var _this_config_adBreakCheckIntervalMs;
5937
5994
  var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
5938
5995
  var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
5939
5996
  var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
@@ -5941,7 +5998,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5941
5998
  if (this.currentAdBreakStartWallClockMs != null) {
5942
5999
  elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
5943
6000
  }
5944
- var _this_expectedAdBreakDurationMs;
5945
6001
  var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
5946
6002
  var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
5947
6003
  var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
@@ -6055,6 +6111,73 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6055
6111
  }
6056
6112
  }
6057
6113
  },
6114
+ {
6115
+ key: "isGamInCooldown",
6116
+ value: function isGamInCooldown() {
6117
+ return Date.now() < this.globalNoFillCooldownUntil;
6118
+ }
6119
+ },
6120
+ {
6121
+ key: "recordGamNoFill",
6122
+ value: function recordGamNoFill() {
6123
+ this.globalConsecutiveNoFills++;
6124
+ if (this.globalConsecutiveNoFills >= this.globalNoFillThreshold) {
6125
+ var exponent = this.globalConsecutiveNoFills - this.globalNoFillThreshold;
6126
+ var backoff = Math.min(this.globalNoFillBackoffBaseMs * Math.pow(2, exponent), this.globalNoFillBackoffMaxMs);
6127
+ this.globalNoFillCooldownUntil = Date.now() + backoff;
6128
+ if (this.config.debugAdTiming) {
6129
+ console.log("[CIRCUIT-BREAKER] GAM cooldown activated: ".concat(backoff, "ms (").concat(this.globalConsecutiveNoFills, " consecutive no-fills)"));
6130
+ }
6131
+ }
6132
+ }
6133
+ },
6134
+ {
6135
+ key: "resetGamNoFillCounter",
6136
+ value: function resetGamNoFillCounter() {
6137
+ if (this.globalConsecutiveNoFills > 0 && this.config.debugAdTiming) {
6138
+ console.log("[CIRCUIT-BREAKER] Resetting no-fill counter (was ".concat(this.globalConsecutiveNoFills, ")"));
6139
+ }
6140
+ this.globalConsecutiveNoFills = 0;
6141
+ this.globalNoFillCooldownUntil = 0;
6142
+ }
6143
+ },
6144
+ {
6145
+ key: "enforceGlobalRateLimit",
6146
+ value: function enforceGlobalRateLimit() {
6147
+ return _async_to_generator(function() {
6148
+ var now, elapsed, waitMs;
6149
+ return _ts_generator(this, function(_state) {
6150
+ switch(_state.label){
6151
+ case 0:
6152
+ now = Date.now();
6153
+ elapsed = now - this.globalLastGamRequestTime;
6154
+ if (!(elapsed < this.globalMinGamIntervalMs)) return [
6155
+ 3,
6156
+ 2
6157
+ ];
6158
+ waitMs = this.globalMinGamIntervalMs - elapsed;
6159
+ if (this.config.debugAdTiming) {
6160
+ console.log("[RATE-LIMIT] Waiting ".concat(waitMs, "ms before next GAM request"));
6161
+ }
6162
+ return [
6163
+ 4,
6164
+ new Promise(function(resolve) {
6165
+ return setTimeout(resolve, waitMs);
6166
+ })
6167
+ ];
6168
+ case 1:
6169
+ _state.sent();
6170
+ _state.label = 2;
6171
+ case 2:
6172
+ this.globalLastGamRequestTime = Date.now();
6173
+ return [
6174
+ 2
6175
+ ];
6176
+ }
6177
+ });
6178
+ }).call(this);
6179
+ }
6180
+ },
6058
6181
  {
6059
6182
  key: "playSingleAd",
6060
6183
  value: function playSingleAd(vastTagUrl) {
@@ -6086,6 +6209,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6086
6209
  }
6087
6210
  throw new Error("Too many consecutive failures");
6088
6211
  }
6212
+ if (this.isGamInCooldown()) {
6213
+ if (this.config.debugAdTiming) {
6214
+ console.warn("[CIRCUIT-BREAKER] GAM in cooldown, skipping ad request");
6215
+ }
6216
+ throw new Error("GAM in cooldown");
6217
+ }
6089
6218
  this.recreateImaController();
6090
6219
  requestToken = ++this.adRequestTokenCounter;
6091
6220
  this.activeAdRequestToken = requestToken;
@@ -6094,16 +6223,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6094
6223
  case 1:
6095
6224
  _state.trys.push([
6096
6225
  1,
6097
- 11,
6226
+ 12,
6098
6227
  ,
6099
- 16
6228
+ 17
6100
6229
  ]);
6230
+ return [
6231
+ 4,
6232
+ this.enforceGlobalRateLimit()
6233
+ ];
6234
+ case 2:
6235
+ _state.sent();
6101
6236
  this.lastAdRequestTime = Date.now();
6102
6237
  return [
6103
6238
  4,
6104
6239
  this.ima.requestAds(vastTagUrl)
6105
6240
  ];
6106
- case 2:
6241
+ case 3:
6107
6242
  _state.sent();
6108
6243
  this.clearAdRequestWatchdog();
6109
6244
  if (this.activeAdRequestToken !== requestToken) {
@@ -6111,20 +6246,20 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6111
6246
  2
6112
6247
  ];
6113
6248
  }
6114
- _state.label = 3;
6115
- case 3:
6249
+ _state.label = 4;
6250
+ case 4:
6116
6251
  _state.trys.push([
6117
- 3,
6118
- 5,
6252
+ 4,
6253
+ 6,
6119
6254
  ,
6120
- 10
6255
+ 11
6121
6256
  ]);
6122
6257
  this.startAdFailsafeTimer(requestToken);
6123
6258
  return [
6124
6259
  4,
6125
6260
  this.ima.play()
6126
6261
  ];
6127
- case 4:
6262
+ case 5:
6128
6263
  _state.sent();
6129
6264
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6130
6265
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -6138,9 +6273,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6138
6273
  this.temporaryFailureUrls.delete(vastTagUrl);
6139
6274
  return [
6140
6275
  3,
6141
- 10
6276
+ 11
6142
6277
  ];
6143
- case 5:
6278
+ case 6:
6144
6279
  playError = _state.sent();
6145
6280
  if (this.config.debugAdTiming) {
6146
6281
  console.error("[AD-ERROR] Failed to play ad:", playError);
@@ -6148,18 +6283,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6148
6283
  preloadedFallback = this.getPreloadedAd();
6149
6284
  if (!preloadedFallback) return [
6150
6285
  3,
6151
- 9
6286
+ 10
6152
6287
  ];
6153
6288
  if (this.config.debugAdTiming) {
6154
6289
  console.log("[AD-ERROR] Play failed, trying preloaded fallback ad");
6155
6290
  }
6156
- _state.label = 6;
6157
- case 6:
6291
+ _state.label = 7;
6292
+ case 7:
6158
6293
  _state.trys.push([
6159
- 6,
6160
- 8,
6294
+ 7,
6295
+ 9,
6161
6296
  ,
6162
- 9
6297
+ 10
6163
6298
  ]);
6164
6299
  this.clearAdFailsafeTimer();
6165
6300
  this.ima.destroy();
@@ -6175,7 +6310,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6175
6310
  4,
6176
6311
  this.ima.play()
6177
6312
  ];
6178
- case 7:
6313
+ case 8:
6179
6314
  _state.sent();
6180
6315
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6181
6316
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -6188,16 +6323,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6188
6323
  return [
6189
6324
  2
6190
6325
  ];
6191
- case 8:
6326
+ case 9:
6192
6327
  fallbackError = _state.sent();
6193
6328
  if (this.config.debugAdTiming) {
6194
6329
  console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError);
6195
6330
  }
6196
6331
  return [
6197
6332
  3,
6198
- 9
6333
+ 10
6199
6334
  ];
6200
- case 9:
6335
+ case 10:
6201
6336
  if (this.isTemporaryAdError(playError)) {
6202
6337
  this.temporaryFailureUrls.set(vastTagUrl, Date.now());
6203
6338
  if (this.config.debugAdTiming) {
@@ -6214,12 +6349,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6214
6349
  this.activeAdRequestToken = null;
6215
6350
  }
6216
6351
  throw playError;
6217
- case 10:
6352
+ case 11:
6218
6353
  return [
6219
6354
  3,
6220
- 16
6355
+ 17
6221
6356
  ];
6222
- case 11:
6357
+ case 12:
6223
6358
  error = _state.sent();
6224
6359
  errorMessage = (error === null || error === void 0 ? void 0 : error.message) || "";
6225
6360
  if (this.config.debugAdTiming) {
@@ -6228,18 +6363,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6228
6363
  preloadedFallback1 = this.getPreloadedAd();
6229
6364
  if (!preloadedFallback1) return [
6230
6365
  3,
6231
- 15
6366
+ 16
6232
6367
  ];
6233
6368
  if (this.config.debugAdTiming) {
6234
6369
  console.log("[AD-ERROR] Request failed, trying preloaded fallback ad");
6235
6370
  }
6236
- _state.label = 12;
6237
- case 12:
6371
+ _state.label = 13;
6372
+ case 13:
6238
6373
  _state.trys.push([
6239
- 12,
6240
- 14,
6374
+ 13,
6375
+ 15,
6241
6376
  ,
6242
- 15
6377
+ 16
6243
6378
  ]);
6244
6379
  this.clearAdRequestWatchdog();
6245
6380
  this.clearAdFailsafeTimer();
@@ -6256,7 +6391,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6256
6391
  4,
6257
6392
  this.ima.play()
6258
6393
  ];
6259
- case 13:
6394
+ case 14:
6260
6395
  _state.sent();
6261
6396
  currentMuted2 = this.video.muted;
6262
6397
  currentVolume2 = this.video.volume;
@@ -6265,16 +6400,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6265
6400
  return [
6266
6401
  2
6267
6402
  ];
6268
- case 14:
6403
+ case 15:
6269
6404
  fallbackError1 = _state.sent();
6270
6405
  if (this.config.debugAdTiming) {
6271
6406
  console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError1);
6272
6407
  }
6273
6408
  return [
6274
6409
  3,
6275
- 15
6410
+ 16
6276
6411
  ];
6277
- case 15:
6412
+ case 16:
6278
6413
  if (this.isTemporaryAdError(error)) {
6279
6414
  this.temporaryFailureUrls.set(vastTagUrl, Date.now());
6280
6415
  if (this.config.debugAdTiming) {
@@ -6292,7 +6427,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6292
6427
  this.activeAdRequestToken = null;
6293
6428
  }
6294
6429
  throw error;
6295
- case 16:
6430
+ case 17:
6296
6431
  return [
6297
6432
  2
6298
6433
  ];
@@ -6328,6 +6463,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6328
6463
  this.currentAdIndex = 0;
6329
6464
  this.totalAdsInBreak = 0;
6330
6465
  this.consecutiveFailures = 0;
6466
+ this.globalConsecutiveNoFills = 0;
6331
6467
  this.ima.stop().catch(function() {});
6332
6468
  var restoredMuted = this.ima.getOriginalMutedState();
6333
6469
  var restoredVolume = this.ima.getOriginalVolume();
@@ -6359,6 +6495,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6359
6495
  key: "handleAdFailure",
6360
6496
  value: function handleAdFailure() {
6361
6497
  this.consecutiveFailures++;
6498
+ this.recordGamNoFill();
6362
6499
  var remaining = this.getRemainingAdMs();
6363
6500
  if (this.config.debugAdTiming) {
6364
6501
  console.log("[CONTINUOUS-FETCH] Ad failure: remaining=".concat(remaining, "ms, queued ads=").concat(this.adRequestQueue.length, ", consecutiveFailures=").concat(this.consecutiveFailures), this.adRequestQueue.length > 0 ? {
@@ -6386,8 +6523,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6386
6523
  key: "startAdRequestWatchdog",
6387
6524
  value: function startAdRequestWatchdog(token) {
6388
6525
  var _this = this;
6389
- this.clearAdRequestWatchdog();
6390
6526
  var _this_config_adFailsafeTimeoutMs;
6527
+ this.clearAdRequestWatchdog();
6391
6528
  var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
6392
6529
  this.adRequestWatchdogToken = token;
6393
6530
  this.adRequestWatchdogId = window.setTimeout(function() {
@@ -6430,8 +6567,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6430
6567
  key: "startAdFailsafeTimer",
6431
6568
  value: function startAdFailsafeTimer(token) {
6432
6569
  var _this = this;
6433
- this.clearAdFailsafeTimer();
6434
6570
  var _this_config_adFailsafeTimeoutMs;
6571
+ this.clearAdFailsafeTimer();
6435
6572
  var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
6436
6573
  this.adFailsafeToken = token;
6437
6574
  this.adFailsafeTimerId = window.setTimeout(function() {
@@ -6751,11 +6888,11 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react2_Component) {
6751
6888
  function HlsPlayer() {
6752
6889
  _class_call_check(this, HlsPlayer);
6753
6890
  var _this;
6754
- var _this1, _arguments = arguments;
6755
- _this = _call_super(this, HlsPlayer, _to_consumable_array(_arguments)), _this1 = _this;
6756
- _this1.player = null;
6757
- _this1.mounted = false;
6758
- _this1.load = function() {
6891
+ var _this1;
6892
+ _this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
6893
+ _this.player = null;
6894
+ _this.mounted = false;
6895
+ _this.load = function() {
6759
6896
  return _async_to_generator(function() {
6760
6897
  var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
6761
6898
  return _ts_generator(this, function(_state) {
@@ -6828,87 +6965,87 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react2_Component) {
6828
6965
  });
6829
6966
  })();
6830
6967
  };
6831
- _this1.play = function() {
6832
- if (_this1.props.videoElement) {
6833
- var video = _this1.props.videoElement;
6968
+ _this.play = function() {
6969
+ if (_this.props.videoElement) {
6970
+ var video = _this.props.videoElement;
6834
6971
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
6835
6972
  if (hasValidSource) {
6836
6973
  var _video_play, _this_props_onPlay, _this_props;
6837
6974
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
6838
6975
  var _this_props_onError, _this_props;
6839
6976
  console.error("[HlsPlayer] Failed to play:", error);
6840
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
6977
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
6841
6978
  });
6842
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
6979
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
6843
6980
  } else {
6844
6981
  console.warn("[HlsPlayer] Cannot play: video has no valid source");
6845
6982
  }
6846
6983
  }
6847
6984
  };
6848
- _this1.pause = function() {
6849
- if (_this1.props.videoElement) {
6985
+ _this.pause = function() {
6986
+ if (_this.props.videoElement) {
6850
6987
  var _this_props_onPause, _this_props;
6851
- _this1.props.videoElement.pause();
6852
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
6988
+ _this.props.videoElement.pause();
6989
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
6853
6990
  }
6854
6991
  };
6855
- _this1.stop = function() {
6856
- _this1.pause();
6857
- if (_this1.props.videoElement) {
6858
- _this1.props.videoElement.currentTime = 0;
6992
+ _this.stop = function() {
6993
+ _this.pause();
6994
+ if (_this.props.videoElement) {
6995
+ _this.props.videoElement.currentTime = 0;
6859
6996
  }
6860
6997
  };
6861
- _this1.seekTo = function(seconds, keepPlaying) {
6862
- if (_this1.props.videoElement) {
6863
- _this1.props.videoElement.currentTime = seconds;
6998
+ _this.seekTo = function(seconds, keepPlaying) {
6999
+ if (_this.props.videoElement) {
7000
+ _this.props.videoElement.currentTime = seconds;
6864
7001
  if (!keepPlaying) {
6865
- _this1.pause();
7002
+ _this.pause();
6866
7003
  }
6867
7004
  }
6868
7005
  };
6869
- _this1.setVolume = function(volume) {
6870
- if (_this1.props.videoElement) {
6871
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
7006
+ _this.setVolume = function(volume) {
7007
+ if (_this.props.videoElement) {
7008
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
6872
7009
  }
6873
7010
  };
6874
- _this1.mute = function() {
6875
- if (_this1.props.videoElement) {
6876
- _this1.props.videoElement.muted = true;
7011
+ _this.mute = function() {
7012
+ if (_this.props.videoElement) {
7013
+ _this.props.videoElement.muted = true;
6877
7014
  }
6878
7015
  };
6879
- _this1.unmute = function() {
6880
- if (_this1.props.videoElement) {
6881
- _this1.props.videoElement.muted = false;
7016
+ _this.unmute = function() {
7017
+ if (_this.props.videoElement) {
7018
+ _this.props.videoElement.muted = false;
6882
7019
  }
6883
7020
  };
6884
- _this1.setPlaybackRate = function(rate) {
6885
- if (_this1.props.videoElement && rate > 0) {
6886
- _this1.props.videoElement.playbackRate = rate;
7021
+ _this.setPlaybackRate = function(rate) {
7022
+ if (_this.props.videoElement && rate > 0) {
7023
+ _this.props.videoElement.playbackRate = rate;
6887
7024
  }
6888
7025
  };
6889
- _this1.getDuration = function() {
6890
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
6891
- return _this1.props.videoElement.duration;
7026
+ _this.getDuration = function() {
7027
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
7028
+ return _this.props.videoElement.duration;
6892
7029
  }
6893
7030
  return null;
6894
7031
  };
6895
- _this1.getCurrentTime = function() {
6896
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
6897
- return _this1.props.videoElement.currentTime;
7032
+ _this.getCurrentTime = function() {
7033
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
7034
+ return _this.props.videoElement.currentTime;
6898
7035
  }
6899
7036
  return null;
6900
7037
  };
6901
- _this1.getSecondsLoaded = function() {
6902
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
6903
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
7038
+ _this.getSecondsLoaded = function() {
7039
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
7040
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
6904
7041
  }
6905
7042
  return null;
6906
7043
  };
6907
- _this1.getInternalPlayer = function() {
7044
+ _this.getInternalPlayer = function() {
6908
7045
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
6909
- if (key === "player") return _this1.player;
6910
- if (key === "video") return _this1.props.videoElement;
6911
- if (key === "hls" && _this1.player) return _this1.player.hls;
7046
+ if (key === "player") return _this.player;
7047
+ if (key === "video") return _this.props.videoElement;
7048
+ if (key === "hls" && _this.player) return _this.player.hls;
6912
7049
  return null;
6913
7050
  };
6914
7051
  return _this;
@@ -6957,49 +7094,49 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
6957
7094
  function FilePlayer() {
6958
7095
  _class_call_check(this, FilePlayer);
6959
7096
  var _this;
6960
- var _this1, _arguments = arguments;
6961
- _this = _call_super(this, FilePlayer, _to_consumable_array(_arguments)), _this1 = _this;
6962
- _this1.mounted = false;
6963
- _this1.ready = false;
6964
- _this1.load = function() {
7097
+ var _this1;
7098
+ _this = _call_super(this, FilePlayer, arguments), _this1 = _this;
7099
+ _this.mounted = false;
7100
+ _this.ready = false;
7101
+ _this.load = function() {
6965
7102
  var _this_props_onMount, _this_props;
6966
- if (!_this1.props.videoElement || !_this1.props.src) return;
6967
- var video = _this1.props.videoElement;
6968
- var handleLoadedMetadata = function() {
6969
- if (_this1.mounted && !_this1.ready) {
7103
+ if (!_this.props.videoElement || !_this.props.src) return;
7104
+ var video = _this.props.videoElement;
7105
+ var handleLoadedMetadata = function handleLoadedMetadata() {
7106
+ if (_this.mounted && !_this.ready) {
6970
7107
  var _this_props_onReady, _this_props;
6971
- _this1.ready = true;
6972
- (_this_props_onReady = (_this_props = _this1.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
7108
+ _this.ready = true;
7109
+ (_this_props_onReady = (_this_props = _this.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
6973
7110
  }
6974
7111
  };
6975
- var handlePlay = function() {
6976
- if (_this1.mounted) {
7112
+ var handlePlay = function handlePlay() {
7113
+ if (_this.mounted) {
6977
7114
  var _this_props_onPlay, _this_props;
6978
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
7115
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
6979
7116
  }
6980
7117
  };
6981
- var handlePause = function() {
6982
- if (_this1.mounted) {
7118
+ var handlePause = function handlePause() {
7119
+ if (_this.mounted) {
6983
7120
  var _this_props_onPause, _this_props;
6984
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
7121
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
6985
7122
  }
6986
7123
  };
6987
- var handleEnded = function() {
6988
- if (_this1.mounted) {
7124
+ var handleEnded = function handleEnded() {
7125
+ if (_this.mounted) {
6989
7126
  var _this_props_onEnded, _this_props;
6990
- (_this_props_onEnded = (_this_props = _this1.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
7127
+ (_this_props_onEnded = (_this_props = _this.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
6991
7128
  }
6992
7129
  };
6993
- var handleError = function(error) {
6994
- if (_this1.mounted) {
7130
+ var handleError = function handleError(error) {
7131
+ if (_this.mounted) {
6995
7132
  var _this_props_onError, _this_props;
6996
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
7133
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
6997
7134
  }
6998
7135
  };
6999
- var handleLoadedData = function() {
7000
- if (_this1.mounted) {
7136
+ var handleLoadedData = function handleLoadedData() {
7137
+ if (_this.mounted) {
7001
7138
  var _this_props_onLoaded, _this_props;
7002
- (_this_props_onLoaded = (_this_props = _this1.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
7139
+ (_this_props_onLoaded = (_this_props = _this.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
7003
7140
  }
7004
7141
  };
7005
7142
  video.addEventListener("loadedmetadata", handleLoadedMetadata);
@@ -7008,15 +7145,15 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
7008
7145
  video.addEventListener("ended", handleEnded);
7009
7146
  video.addEventListener("error", handleError);
7010
7147
  video.addEventListener("loadeddata", handleLoadedData);
7011
- video.src = _this1.props.src;
7012
- if (_this1.props.autoplay !== void 0) video.autoplay = _this1.props.autoplay;
7013
- if (_this1.props.muted !== void 0) video.muted = _this1.props.muted;
7014
- if (_this1.props.loop !== void 0) video.loop = _this1.props.loop;
7015
- if (_this1.props.controls !== void 0) video.controls = _this1.props.controls;
7016
- if (_this1.props.playsInline !== void 0) video.playsInline = _this1.props.playsInline;
7017
- if (_this1.props.preload !== void 0) video.preload = _this1.props.preload;
7018
- if (_this1.props.poster !== void 0) video.poster = _this1.props.poster;
7019
- (_this_props_onMount = (_this_props = _this1.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this1);
7148
+ video.src = _this.props.src;
7149
+ if (_this.props.autoplay !== void 0) video.autoplay = _this.props.autoplay;
7150
+ if (_this.props.muted !== void 0) video.muted = _this.props.muted;
7151
+ if (_this.props.loop !== void 0) video.loop = _this.props.loop;
7152
+ if (_this.props.controls !== void 0) video.controls = _this.props.controls;
7153
+ if (_this.props.playsInline !== void 0) video.playsInline = _this.props.playsInline;
7154
+ if (_this.props.preload !== void 0) video.preload = _this.props.preload;
7155
+ if (_this.props.poster !== void 0) video.poster = _this.props.poster;
7156
+ (_this_props_onMount = (_this_props = _this.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this);
7020
7157
  return function() {
7021
7158
  video.removeEventListener("loadedmetadata", handleLoadedMetadata);
7022
7159
  video.removeEventListener("play", handlePlay);
@@ -7026,90 +7163,90 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
7026
7163
  video.removeEventListener("loadeddata", handleLoadedData);
7027
7164
  };
7028
7165
  };
7029
- _this1.play = function() {
7030
- if (_this1.props.videoElement) {
7031
- var video = _this1.props.videoElement;
7166
+ _this.play = function() {
7167
+ if (_this.props.videoElement) {
7168
+ var video = _this.props.videoElement;
7032
7169
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
7033
7170
  if (hasValidSource) {
7034
7171
  var _video_play;
7035
7172
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
7036
7173
  var _this_props_onError, _this_props;
7037
7174
  console.error("[FilePlayer] Failed to play:", error);
7038
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
7175
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
7039
7176
  });
7040
7177
  } else {
7041
7178
  console.warn("[FilePlayer] Cannot play: video has no valid source");
7042
7179
  }
7043
7180
  }
7044
7181
  };
7045
- _this1.pause = function() {
7046
- if (_this1.props.videoElement) {
7047
- _this1.props.videoElement.pause();
7182
+ _this.pause = function() {
7183
+ if (_this.props.videoElement) {
7184
+ _this.props.videoElement.pause();
7048
7185
  }
7049
7186
  };
7050
- _this1.stop = function() {
7051
- _this1.pause();
7052
- if (_this1.props.videoElement) {
7053
- _this1.props.videoElement.currentTime = 0;
7187
+ _this.stop = function() {
7188
+ _this.pause();
7189
+ if (_this.props.videoElement) {
7190
+ _this.props.videoElement.currentTime = 0;
7054
7191
  }
7055
7192
  };
7056
- _this1.seekTo = function(seconds, keepPlaying) {
7057
- if (_this1.props.videoElement) {
7058
- _this1.props.videoElement.currentTime = seconds;
7193
+ _this.seekTo = function(seconds, keepPlaying) {
7194
+ if (_this.props.videoElement) {
7195
+ _this.props.videoElement.currentTime = seconds;
7059
7196
  if (!keepPlaying) {
7060
- _this1.pause();
7197
+ _this.pause();
7061
7198
  }
7062
7199
  }
7063
7200
  };
7064
- _this1.setVolume = function(volume) {
7065
- if (_this1.props.videoElement) {
7066
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
7201
+ _this.setVolume = function(volume) {
7202
+ if (_this.props.videoElement) {
7203
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
7067
7204
  }
7068
7205
  };
7069
- _this1.mute = function() {
7070
- if (_this1.props.videoElement) {
7071
- _this1.props.videoElement.muted = true;
7206
+ _this.mute = function() {
7207
+ if (_this.props.videoElement) {
7208
+ _this.props.videoElement.muted = true;
7072
7209
  }
7073
7210
  };
7074
- _this1.unmute = function() {
7075
- if (_this1.props.videoElement) {
7076
- _this1.props.videoElement.muted = false;
7211
+ _this.unmute = function() {
7212
+ if (_this.props.videoElement) {
7213
+ _this.props.videoElement.muted = false;
7077
7214
  }
7078
7215
  };
7079
- _this1.setPlaybackRate = function(rate) {
7080
- if (_this1.props.videoElement && rate > 0) {
7081
- _this1.props.videoElement.playbackRate = rate;
7216
+ _this.setPlaybackRate = function(rate) {
7217
+ if (_this.props.videoElement && rate > 0) {
7218
+ _this.props.videoElement.playbackRate = rate;
7082
7219
  }
7083
7220
  };
7084
- _this1.setLoop = function(loop) {
7085
- if (_this1.props.videoElement) {
7086
- _this1.props.videoElement.loop = loop;
7221
+ _this.setLoop = function(loop) {
7222
+ if (_this.props.videoElement) {
7223
+ _this.props.videoElement.loop = loop;
7087
7224
  }
7088
7225
  };
7089
- _this1.getDuration = function() {
7090
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
7091
- return _this1.props.videoElement.duration;
7226
+ _this.getDuration = function() {
7227
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
7228
+ return _this.props.videoElement.duration;
7092
7229
  }
7093
7230
  return null;
7094
7231
  };
7095
- _this1.getCurrentTime = function() {
7096
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
7097
- return _this1.props.videoElement.currentTime;
7232
+ _this.getCurrentTime = function() {
7233
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
7234
+ return _this.props.videoElement.currentTime;
7098
7235
  }
7099
7236
  return null;
7100
7237
  };
7101
- _this1.getSecondsLoaded = function() {
7102
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
7103
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
7238
+ _this.getSecondsLoaded = function() {
7239
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
7240
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
7104
7241
  }
7105
7242
  return null;
7106
7243
  };
7107
- _this1.getInternalPlayer = function() {
7244
+ _this.getInternalPlayer = function() {
7108
7245
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
7109
- if (key === "video") return _this1.props.videoElement;
7246
+ if (key === "video") return _this.props.videoElement;
7110
7247
  return null;
7111
7248
  };
7112
- _this1.enablePIP = function() {
7249
+ _this.enablePIP = function() {
7113
7250
  return _async_to_generator(function() {
7114
7251
  var error;
7115
7252
  return _ts_generator(this, function(_state) {
@@ -7152,7 +7289,7 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
7152
7289
  });
7153
7290
  })();
7154
7291
  };
7155
- _this1.disablePIP = function() {
7292
+ _this.disablePIP = function() {
7156
7293
  return _async_to_generator(function() {
7157
7294
  var error;
7158
7295
  return _ts_generator(this, function(_state) {
@@ -7246,7 +7383,7 @@ var players = [
7246
7383
  key: "file",
7247
7384
  name: "File Player",
7248
7385
  canPlay: canPlay.file,
7249
- canEnablePIP: function(url) {
7386
+ canEnablePIP: function canEnablePIP(url) {
7250
7387
  return canPlay.file(url) && (document.pictureInPictureEnabled || typeof document.webkitSupportsPresentationMode === "function");
7251
7388
  },
7252
7389
  lazyPlayer: lazy(function() {