hls.js 1.6.0-beta.2.0.canary.10880 → 1.6.0-beta.2.0.canary.10883

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.
@@ -77,6 +77,7 @@ let Events = /*#__PURE__*/function (Events) {
77
77
  Events["MEDIA_DETACHING"] = "hlsMediaDetaching";
78
78
  Events["MEDIA_DETACHED"] = "hlsMediaDetached";
79
79
  Events["MEDIA_ENDED"] = "hlsMediaEnded";
80
+ Events["STALL_RESOLVED"] = "hlsStallResolved";
80
81
  Events["BUFFER_RESET"] = "hlsBufferReset";
81
82
  Events["BUFFER_CODECS"] = "hlsBufferCodecs";
82
83
  Events["BUFFER_CREATED"] = "hlsBufferCreated";
@@ -173,10 +174,10 @@ var PlaylistLevelType = {
173
174
  class EWMA {
174
175
  // About half of the estimated value will be from the last |halfLife| samples by weight.
175
176
  constructor(halfLife, estimate = 0, weight = 0) {
176
- this.halfLife = void 0;
177
- this.alpha_ = void 0;
178
- this.estimate_ = void 0;
179
- this.totalWeight_ = void 0;
177
+ this.halfLife = undefined;
178
+ this.alpha_ = undefined;
179
+ this.estimate_ = undefined;
180
+ this.totalWeight_ = undefined;
180
181
  this.halfLife = halfLife;
181
182
  // Larger values of alpha expire historical data more slowly.
182
183
  this.alpha_ = halfLife ? Math.exp(Math.log(0.5) / halfLife) : 0;
@@ -212,13 +213,13 @@ class EWMA {
212
213
 
213
214
  class EwmaBandWidthEstimator {
214
215
  constructor(slow, fast, defaultEstimate, defaultTTFB = 100) {
215
- this.defaultEstimate_ = void 0;
216
- this.minWeight_ = void 0;
217
- this.minDelayMs_ = void 0;
218
- this.slow_ = void 0;
219
- this.fast_ = void 0;
220
- this.defaultTTFB_ = void 0;
221
- this.ttfb_ = void 0;
216
+ this.defaultEstimate_ = undefined;
217
+ this.minWeight_ = undefined;
218
+ this.minDelayMs_ = undefined;
219
+ this.slow_ = undefined;
220
+ this.fast_ = undefined;
221
+ this.defaultTTFB_ = undefined;
222
+ this.ttfb_ = undefined;
222
223
  this.defaultEstimate_ = defaultEstimate;
223
224
  this.minWeight_ = 0.001;
224
225
  this.minDelayMs_ = 50;
@@ -290,9 +291,9 @@ class EwmaBandWidthEstimator {
290
291
  function _defineProperty(e, r, t) {
291
292
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
292
293
  value: t,
293
- enumerable: !0,
294
- configurable: !0,
295
- writable: !0
294
+ enumerable: true,
295
+ configurable: true,
296
+ writable: true
296
297
  }) : e[r] = t, e;
297
298
  }
298
299
  function _extends() {
@@ -317,7 +318,7 @@ function ownKeys(e, r) {
317
318
  function _objectSpread2(e) {
318
319
  for (var r = 1; r < arguments.length; r++) {
319
320
  var t = null != arguments[r] ? arguments[r] : {};
320
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
321
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
321
322
  _defineProperty(e, r, t[r]);
322
323
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
323
324
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
@@ -328,7 +329,7 @@ function _objectSpread2(e) {
328
329
  function _toPrimitive(t, r) {
329
330
  if ("object" != typeof t || !t) return t;
330
331
  var e = t[Symbol.toPrimitive];
331
- if (void 0 !== e) {
332
+ if (undefined !== e) {
332
333
  var i = e.call(t, r || "default");
333
334
  if ("object" != typeof i) return i;
334
335
  throw new TypeError("@@toPrimitive must return a primitive value.");
@@ -342,12 +343,12 @@ function _toPropertyKey(t) {
342
343
 
343
344
  class Logger {
344
345
  constructor(label, logger) {
345
- this.trace = void 0;
346
- this.debug = void 0;
347
- this.log = void 0;
348
- this.warn = void 0;
349
- this.info = void 0;
350
- this.error = void 0;
346
+ this.trace = undefined;
347
+ this.debug = undefined;
348
+ this.log = undefined;
349
+ this.warn = undefined;
350
+ this.info = undefined;
351
+ this.error = undefined;
351
352
  const lb = `[${label}]:`;
352
353
  this.trace = noop;
353
354
  this.debug = logger.debug.bind(null, lb);
@@ -401,7 +402,7 @@ function enableLogs(debugConfig, context, id) {
401
402
  // Some browsers don't allow to use bind on console object anyway
402
403
  // fallback to default if needed
403
404
  try {
404
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.10880"}`);
405
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.10883"}`);
405
406
  } catch (e) {
406
407
  /* log fn threw an exception. All logger methods are no-ops. */
407
408
  return createLogger();
@@ -535,7 +536,7 @@ function areCodecsMediaSourceSupported(codecs, type, preferManagedMediaSource =
535
536
  function isCodecMediaSourceSupported(codec, type, preferManagedMediaSource = true) {
536
537
  var _MediaSource$isTypeSu;
537
538
  const MediaSource = getMediaSource(preferManagedMediaSource);
538
- return (_MediaSource$isTypeSu = MediaSource == null ? void 0 : MediaSource.isTypeSupported(mimeTypeForCodec(codec, type))) != null ? _MediaSource$isTypeSu : false;
539
+ return (_MediaSource$isTypeSu = MediaSource == null ? undefined : MediaSource.isTypeSupported(mimeTypeForCodec(codec, type))) != null ? _MediaSource$isTypeSu : false;
539
540
  }
540
541
  function mimeTypeForCodec(codec, type) {
541
542
  return `${type}/mp4;codecs=${codec}`;
@@ -678,9 +679,9 @@ function getSkipValue(details) {
678
679
  }
679
680
  class HlsUrlParameters {
680
681
  constructor(msn, part, skip) {
681
- this.msn = void 0;
682
- this.part = void 0;
683
- this.skip = void 0;
682
+ this.msn = undefined;
683
+ this.part = undefined;
684
+ this.skip = undefined;
684
685
  this.msn = msn;
685
686
  this.part = part;
686
687
  this.skip = skip;
@@ -701,27 +702,27 @@ class HlsUrlParameters {
701
702
  }
702
703
  class Level {
703
704
  constructor(data) {
704
- this._attrs = void 0;
705
- this.audioCodec = void 0;
706
- this.bitrate = void 0;
707
- this.codecSet = void 0;
708
- this.url = void 0;
709
- this.frameRate = void 0;
710
- this.height = void 0;
711
- this.id = void 0;
712
- this.name = void 0;
713
- this.videoCodec = void 0;
714
- this.width = void 0;
715
- this.details = void 0;
705
+ this._attrs = undefined;
706
+ this.audioCodec = undefined;
707
+ this.bitrate = undefined;
708
+ this.codecSet = undefined;
709
+ this.url = undefined;
710
+ this.frameRate = undefined;
711
+ this.height = undefined;
712
+ this.id = undefined;
713
+ this.name = undefined;
714
+ this.videoCodec = undefined;
715
+ this.width = undefined;
716
+ this.details = undefined;
716
717
  this.fragmentError = 0;
717
718
  this.loadError = 0;
718
- this.loaded = void 0;
719
+ this.loaded = undefined;
719
720
  this.realBitrate = 0;
720
- this.supportedPromise = void 0;
721
- this.supportedResult = void 0;
721
+ this.supportedPromise = undefined;
722
+ this.supportedResult = undefined;
722
723
  this._avgBitrate = 0;
723
- this._audioGroups = void 0;
724
- this._subtitleGroups = void 0;
724
+ this._audioGroups = undefined;
725
+ this._subtitleGroups = undefined;
725
726
  // Deprecated (retained for backwards compatibility)
726
727
  this._urlId = 0;
727
728
  this.url = [data.url];
@@ -814,11 +815,11 @@ class Level {
814
815
  }
815
816
  get audioGroupId() {
816
817
  var _this$audioGroups;
817
- return (_this$audioGroups = this.audioGroups) == null ? void 0 : _this$audioGroups[0];
818
+ return (_this$audioGroups = this.audioGroups) == null ? undefined : _this$audioGroups[0];
818
819
  }
819
820
  get textGroupId() {
820
821
  var _this$subtitleGroups;
821
- return (_this$subtitleGroups = this.subtitleGroups) == null ? void 0 : _this$subtitleGroups[0];
822
+ return (_this$subtitleGroups = this.subtitleGroups) == null ? undefined : _this$subtitleGroups[0];
822
823
  }
823
824
  addFallback() {}
824
825
  }
@@ -885,9 +886,9 @@ function getVideoSelectionOptions(currentVideoRange, videoPreference) {
885
886
 
886
887
  function getStartCodecTier(codecTiers, currentVideoRange, currentBw, audioPreference, videoPreference) {
887
888
  const codecSets = Object.keys(codecTiers);
888
- const channelsPreference = audioPreference == null ? void 0 : audioPreference.channels;
889
- const audioCodecPreference = audioPreference == null ? void 0 : audioPreference.audioCodec;
890
- const videoCodecPreference = videoPreference == null ? void 0 : videoPreference.videoCodec;
889
+ const channelsPreference = audioPreference == null ? undefined : audioPreference.channels;
890
+ const audioCodecPreference = audioPreference == null ? undefined : audioPreference.audioCodec;
891
+ const videoCodecPreference = videoPreference == null ? undefined : videoPreference.videoCodec;
891
892
  const preferStereo = channelsPreference && parseInt(channelsPreference) === 2;
892
893
  // Use first level set to determine stereo, and minimum resolution and framerate
893
894
  let hasStereo = false;
@@ -1062,13 +1063,13 @@ function getCodecTiers(levels, audioTracksByGroup, minAutoLevel, maxAutoLevel) {
1062
1063
  }
1063
1064
  function useAlternateAudio(audioTrackUrl, hls) {
1064
1065
  var _hls$levels$hls$loadL;
1065
- return !!audioTrackUrl && audioTrackUrl !== ((_hls$levels$hls$loadL = hls.levels[hls.loadLevel]) == null ? void 0 : _hls$levels$hls$loadL.uri);
1066
+ return !!audioTrackUrl && audioTrackUrl !== ((_hls$levels$hls$loadL = hls.levels[hls.loadLevel]) == null ? undefined : _hls$levels$hls$loadL.uri);
1066
1067
  }
1067
1068
 
1068
1069
  class AbrController extends Logger {
1069
1070
  constructor(_hls) {
1070
1071
  super('abr', _hls.logger);
1071
- this.hls = void 0;
1072
+ this.hls = undefined;
1072
1073
  this.lastLevelLoadSec = 0;
1073
1074
  this.lastLoadedFragLevel = -1;
1074
1075
  this.firstSelection = -1;
@@ -1080,7 +1081,7 @@ class AbrController extends Logger {
1080
1081
  this.fragCurrent = null;
1081
1082
  this.partCurrent = null;
1082
1083
  this.bitrateTestDelay = 0;
1083
- this.bwEstimator = void 0;
1084
+ this.bwEstimator = undefined;
1084
1085
  /*
1085
1086
  This method monitors the download rate of the current fragment, and will downswitch if that fragment will not load
1086
1087
  quickly enough to prevent underbuffering
@@ -1148,7 +1149,7 @@ class AbrController extends Logger {
1148
1149
  return;
1149
1150
  }
1150
1151
  const bwe = loadRate ? loadRate * 8 : bwEstimate;
1151
- const live = ((_this$hls$latestLevel = this.hls.latestLevelDetails) == null ? void 0 : _this$hls$latestLevel.live) === true;
1152
+ const live = ((_this$hls$latestLevel = this.hls.latestLevelDetails) == null ? undefined : _this$hls$latestLevel.live) === true;
1152
1153
  const abrBandWidthUpFactor = this.hls.config.abrBandWidthUpFactor;
1153
1154
  let fragLevelNextLoadedDelay = Number.POSITIVE_INFINITY;
1154
1155
  let nextLoadLevel;
@@ -1557,7 +1558,7 @@ class AbrController extends Logger {
1557
1558
  // If no matching level found, see if min auto level would be a better option
1558
1559
  const minLevel = hls.levels[minAutoLevel];
1559
1560
  const autoLevel = hls.levels[hls.loadLevel];
1560
- if ((minLevel == null ? void 0 : minLevel.bitrate) < (autoLevel == null ? void 0 : autoLevel.bitrate)) {
1561
+ if ((minLevel == null ? undefined : minLevel.bitrate) < (autoLevel == null ? undefined : autoLevel.bitrate)) {
1561
1562
  return minAutoLevel;
1562
1563
  }
1563
1564
  // or if bitrate is not lower, continue to use loadLevel
@@ -1601,7 +1602,7 @@ class AbrController extends Logger {
1601
1602
  const firstSelection = loadLevel === -1 || lastLoadedFragLevel === -1;
1602
1603
  let currentCodecSet;
1603
1604
  let currentVideoRange = 'SDR';
1604
- let currentFrameRate = (level == null ? void 0 : level.frameRate) || 0;
1605
+ let currentFrameRate = (level == null ? undefined : level.frameRate) || 0;
1605
1606
  const {
1606
1607
  audioPreference,
1607
1608
  videoPreference
@@ -1629,8 +1630,8 @@ class AbrController extends Logger {
1629
1630
  currentBw = Math.max(currentBw, minBitrate);
1630
1631
  this.log(`picked start tier ${JSON.stringify(startTier)}`);
1631
1632
  } else {
1632
- currentCodecSet = level == null ? void 0 : level.codecSet;
1633
- currentVideoRange = level == null ? void 0 : level.videoRange;
1633
+ currentCodecSet = level == null ? undefined : level.codecSet;
1634
+ currentVideoRange = level == null ? undefined : level.videoRange;
1634
1635
  }
1635
1636
  const currentFragDuration = partCurrent ? partCurrent.duration : fragCurrent ? fragCurrent.duration : 0;
1636
1637
  const ttfbEstimateSec = this.bwEstimator.getEstimateTTFB() / 1000;
@@ -1652,7 +1653,7 @@ class AbrController extends Logger {
1652
1653
  }
1653
1654
  }
1654
1655
  const levelDetails = levelInfo.details;
1655
- const avgDuration = (partCurrent ? levelDetails == null ? void 0 : levelDetails.partTarget : levelDetails == null ? void 0 : levelDetails.averagetargetduration) || currentFragDuration;
1656
+ const avgDuration = (partCurrent ? levelDetails == null ? undefined : levelDetails.partTarget : levelDetails == null ? undefined : levelDetails.averagetargetduration) || currentFragDuration;
1656
1657
  let adjustedbw;
1657
1658
  // follow algorithm captured from stagefright :
1658
1659
  // https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/httplive/LiveSession.cpp
@@ -1918,7 +1919,7 @@ function shouldRetry(retryConfig, retryCount, isTimeout, loaderResponse) {
1918
1919
  if (!retryConfig) {
1919
1920
  return false;
1920
1921
  }
1921
- const httpStatus = loaderResponse == null ? void 0 : loaderResponse.code;
1922
+ const httpStatus = loaderResponse == null ? undefined : loaderResponse.code;
1922
1923
  const retry = retryCount < retryConfig.maxNumRetry && (retryForHttpStatus(httpStatus) || !!isTimeout);
1923
1924
  return retryConfig.shouldRetry ? retryConfig.shouldRetry(retryConfig, retryCount, isTimeout, loaderResponse, retry) : retry;
1924
1925
  }
@@ -1944,7 +1945,7 @@ var ErrorActionFlags = {
1944
1945
  class ErrorController extends Logger {
1945
1946
  constructor(hls) {
1946
1947
  super('error-controller', hls.logger);
1947
- this.hls = void 0;
1948
+ this.hls = undefined;
1948
1949
  this.playlistError = 0;
1949
1950
  this.penalizedRenditions = {};
1950
1951
  this.hls = hls;
@@ -1977,7 +1978,7 @@ class ErrorController extends Logger {
1977
1978
  this.playlistError = 0;
1978
1979
  }
1979
1980
  getVariantLevelIndex(frag) {
1980
- return (frag == null ? void 0 : frag.type) === PlaylistLevelType.MAIN ? frag.level : this.hls.loadLevel;
1981
+ return (frag == null ? undefined : frag.type) === PlaylistLevelType.MAIN ? frag.level : this.hls.loadLevel;
1981
1982
  }
1982
1983
  onManifestLoading() {
1983
1984
  this.playlistError = 0;
@@ -2032,7 +2033,7 @@ class ErrorController extends Logger {
2032
2033
  return;
2033
2034
  case ErrorDetails.LEVEL_LOAD_ERROR:
2034
2035
  case ErrorDetails.LEVEL_LOAD_TIMEOUT:
2035
- if (typeof (context == null ? void 0 : context.level) === 'number') {
2036
+ if (typeof (context == null ? undefined : context.level) === 'number') {
2036
2037
  data.errorAction = this.getPlaylistRetryOrSwitchAction(data, context.level);
2037
2038
  }
2038
2039
  return;
@@ -2055,7 +2056,7 @@ class ErrorController extends Logger {
2055
2056
  case ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:
2056
2057
  {
2057
2058
  const level = hls.levels[hls.loadLevel];
2058
- const restrictedHdcpLevel = level == null ? void 0 : level.attrs['HDCP-LEVEL'];
2059
+ const restrictedHdcpLevel = level == null ? undefined : level.attrs['HDCP-LEVEL'];
2059
2060
  if (restrictedHdcpLevel) {
2060
2061
  data.errorAction = {
2061
2062
  action: NetworkErrorAction.SendAlternateToPenaltyBox,
@@ -2177,7 +2178,7 @@ class ErrorController extends Logger {
2177
2178
  if (!hls.autoLevelEnabled) {
2178
2179
  hls.loadLevel = -1;
2179
2180
  }
2180
- const fragErrorType = (_data$frag2 = data.frag) == null ? void 0 : _data$frag2.type;
2181
+ const fragErrorType = (_data$frag2 = data.frag) == null ? undefined : _data$frag2.type;
2181
2182
  // Find alternate audio codec if available on audio codec error
2182
2183
  const isAudioCodecError = fragErrorType === PlaylistLevelType.AUDIO && errorDetails === ErrorDetails.FRAG_PARSING_ERROR || data.sourceBufferName === 'audio' && (errorDetails === ErrorDetails.BUFFER_ADD_CODEC_ERROR || errorDetails === ErrorDetails.BUFFER_APPEND_ERROR);
2183
2184
  const findAudioCodecAlternate = isAudioCodecError && levels.some(({
@@ -2237,7 +2238,7 @@ class ErrorController extends Logger {
2237
2238
  }
2238
2239
  onErrorOut(event, data) {
2239
2240
  var _data$errorAction;
2240
- switch ((_data$errorAction = data.errorAction) == null ? void 0 : _data$errorAction.action) {
2241
+ switch ((_data$errorAction = data.errorAction) == null ? undefined : _data$errorAction.action) {
2241
2242
  case NetworkErrorAction.DoNothing:
2242
2243
  break;
2243
2244
  case NetworkErrorAction.SendAlternateToPenaltyBox:
@@ -2461,16 +2462,16 @@ function isSCTE35Attribute(attrName) {
2461
2462
  class DateRange {
2462
2463
  constructor(dateRangeAttr, dateRangeWithSameId, tagCount = 0) {
2463
2464
  var _dateRangeWithSameId$;
2464
- this.attr = void 0;
2465
- this.tagAnchor = void 0;
2466
- this.tagOrder = void 0;
2467
- this._startDate = void 0;
2468
- this._endDate = void 0;
2469
- this._dateAtEnd = void 0;
2470
- this._cue = void 0;
2471
- this._badValueForSameId = void 0;
2472
- this.tagAnchor = (dateRangeWithSameId == null ? void 0 : dateRangeWithSameId.tagAnchor) || null;
2473
- this.tagOrder = (_dateRangeWithSameId$ = dateRangeWithSameId == null ? void 0 : dateRangeWithSameId.tagOrder) != null ? _dateRangeWithSameId$ : tagCount;
2465
+ this.attr = undefined;
2466
+ this.tagAnchor = undefined;
2467
+ this.tagOrder = undefined;
2468
+ this._startDate = undefined;
2469
+ this._endDate = undefined;
2470
+ this._dateAtEnd = undefined;
2471
+ this._cue = undefined;
2472
+ this._badValueForSameId = undefined;
2473
+ this.tagAnchor = (dateRangeWithSameId == null ? undefined : dateRangeWithSameId.tagAnchor) || null;
2474
+ this.tagOrder = (_dateRangeWithSameId$ = dateRangeWithSameId == null ? undefined : dateRangeWithSameId.tagOrder) != null ? _dateRangeWithSameId$ : tagCount;
2474
2475
  if (dateRangeWithSameId) {
2475
2476
  const previousAttr = dateRangeWithSameId.attr;
2476
2477
  for (const key in previousAttr) {
@@ -2493,7 +2494,7 @@ class DateRange {
2493
2494
  this._startDate = new Date(dateRangeAttr["START-DATE"]);
2494
2495
  }
2495
2496
  if ("END-DATE" in this.attr) {
2496
- const endDate = (dateRangeWithSameId == null ? void 0 : dateRangeWithSameId.endDate) || new Date(this.attr["END-DATE"]);
2497
+ const endDate = (dateRangeWithSameId == null ? undefined : dateRangeWithSameId.endDate) || new Date(this.attr["END-DATE"]);
2497
2498
  if (isFiniteNumber(endDate.getTime())) {
2498
2499
  this._endDate = endDate;
2499
2500
  }
@@ -2780,9 +2781,9 @@ class BaseSegment {
2780
2781
  this._stats = null;
2781
2782
  this._streams = null;
2782
2783
  // baseurl is the URL to the playlist
2783
- this.base = void 0;
2784
+ this.base = undefined;
2784
2785
  // relurl is the portion of the URL that comes from inside the playlist.
2785
- this.relurl = void 0;
2786
+ this.relurl = undefined;
2786
2787
  if (typeof base === 'string') {
2787
2788
  base = {
2788
2789
  url: base
@@ -2796,7 +2797,7 @@ class BaseSegment {
2796
2797
  const params = value.split('@', 2);
2797
2798
  let start;
2798
2799
  if (params.length === 1) {
2799
- start = (previous == null ? void 0 : previous.byteRangeEndOffset) || 0;
2800
+ start = (previous == null ? undefined : previous.byteRangeEndOffset) || 0;
2800
2801
  } else {
2801
2802
  start = parseInt(params[1]);
2802
2803
  }
@@ -2879,7 +2880,7 @@ class Fragment extends BaseSegment {
2879
2880
  this._programDateTime = null;
2880
2881
  this._ref = null;
2881
2882
  // Approximate bit rate of the fragment expressed in bits per second (bps) as indicated by the last EXT-X-BITRATE (kbps) tag
2882
- this._bitrate = void 0;
2883
+ this._bitrate = undefined;
2883
2884
  this.rawProgramDateTime = null;
2884
2885
  this.tagList = [];
2885
2886
  // EXTINF has to be present for a m3u8 to be considered valid
@@ -2889,9 +2890,9 @@ class Fragment extends BaseSegment {
2889
2890
  // levelkeys are the EXT-X-KEY tags that apply to this segment for decryption
2890
2891
  // core difference from the private field _decryptdata is the lack of the initialized IV
2891
2892
  // _decryptdata will set the IV for this segment based on the segment number in the fragment
2892
- this.levelkeys = void 0;
2893
+ this.levelkeys = undefined;
2893
2894
  // A string representing the fragment type
2894
- this.type = void 0;
2895
+ this.type = undefined;
2895
2896
  // A reference to the loader. Set while the fragment is loading, and removed afterwards. Used to abort fragment loading
2896
2897
  this.loader = null;
2897
2898
  // A reference to the key loader. Set while the key is loading, and removed afterwards. Used to abort key loading
@@ -2901,25 +2902,25 @@ class Fragment extends BaseSegment {
2901
2902
  // The continuity counter of the fragment
2902
2903
  this.cc = 0;
2903
2904
  // The starting Presentation Time Stamp (PTS) of the fragment. Set after transmux complete.
2904
- this.startPTS = void 0;
2905
+ this.startPTS = undefined;
2905
2906
  // The ending Presentation Time Stamp (PTS) of the fragment. Set after transmux complete.
2906
- this.endPTS = void 0;
2907
+ this.endPTS = undefined;
2907
2908
  // The starting Decode Time Stamp (DTS) of the fragment. Set after transmux complete.
2908
- this.startDTS = void 0;
2909
+ this.startDTS = undefined;
2909
2910
  // The ending Decode Time Stamp (DTS) of the fragment. Set after transmux complete.
2910
- this.endDTS = void 0;
2911
+ this.endDTS = undefined;
2911
2912
  // The start time of the fragment, as listed in the manifest. Updated after transmux complete.
2912
2913
  this.start = 0;
2913
2914
  // The offset time (seconds) of the fragment from the start of the Playlist
2914
2915
  this.playlistOffset = 0;
2915
2916
  // Set by `updateFragPTSDTS` in level-helper
2916
- this.deltaPTS = void 0;
2917
+ this.deltaPTS = undefined;
2917
2918
  // The maximum starting Presentation Time Stamp (audio/video PTS) of the fragment. Set after transmux complete.
2918
- this.maxStartPTS = void 0;
2919
+ this.maxStartPTS = undefined;
2919
2920
  // The minimum ending Presentation Time Stamp (audio/video PTS) of the fragment. Set after transmux complete.
2920
- this.minEndPTS = void 0;
2921
+ this.minEndPTS = undefined;
2921
2922
  // Init Segment bytes (unset for media segments)
2922
- this.data = void 0;
2923
+ this.data = undefined;
2923
2924
  // A flag indicating whether the segment was downloaded in order to test bitrate, and was not buffered
2924
2925
  this.bitrateTest = false;
2925
2926
  // #EXTINF segment title
@@ -2927,9 +2928,9 @@ class Fragment extends BaseSegment {
2927
2928
  // The Media Initialization Section for this segment
2928
2929
  this.initSegment = null;
2929
2930
  // Fragment is the last fragment in the media playlist
2930
- this.endList = void 0;
2931
+ this.endList = undefined;
2931
2932
  // Fragment is marked by an EXT-X-GAP tag indicating that it does not contain media data and should not be loaded
2932
- this.gap = void 0;
2933
+ this.gap = undefined;
2933
2934
  // Deprecated
2934
2935
  this.urlId = 0;
2935
2936
  this.type = type;
@@ -3061,8 +3062,8 @@ class Fragment extends BaseSegment {
3061
3062
  }
3062
3063
  abortRequests() {
3063
3064
  var _this$loader, _this$keyLoader;
3064
- (_this$loader = this.loader) == null ? void 0 : _this$loader.abort();
3065
- (_this$keyLoader = this.keyLoader) == null ? void 0 : _this$keyLoader.abort();
3065
+ (_this$loader = this.loader) == null ? undefined : _this$loader.abort();
3066
+ (_this$keyLoader = this.keyLoader) == null ? undefined : _this$keyLoader.abort();
3066
3067
  }
3067
3068
  setElementaryStreamInfo(type, startPTS, endPTS, startDTS, endDTS, partial = false) {
3068
3069
  const {
@@ -3096,9 +3097,9 @@ class Part extends BaseSegment {
3096
3097
  this.duration = 0;
3097
3098
  this.gap = false;
3098
3099
  this.independent = false;
3099
- this.relurl = void 0;
3100
- this.fragment = void 0;
3101
- this.index = void 0;
3100
+ this.relurl = undefined;
3101
+ this.fragment = undefined;
3102
+ this.index = undefined;
3102
3103
  this.duration = partAttrs.decimalFloatingPoint('DURATION');
3103
3104
  this.gap = partAttrs.bool('GAP');
3104
3105
  this.independent = partAttrs.bool('INDEPENDENT');
@@ -3136,21 +3137,21 @@ class LevelDetails {
3136
3137
  constructor(baseUrl) {
3137
3138
  this.PTSKnown = false;
3138
3139
  this.alignedSliding = false;
3139
- this.averagetargetduration = void 0;
3140
+ this.averagetargetduration = undefined;
3140
3141
  this.endCC = 0;
3141
3142
  this.endSN = 0;
3142
- this.fragments = void 0;
3143
- this.fragmentHint = void 0;
3143
+ this.fragments = undefined;
3144
+ this.fragmentHint = undefined;
3144
3145
  this.partList = null;
3145
- this.dateRanges = void 0;
3146
+ this.dateRanges = undefined;
3146
3147
  this.dateRangeTagCount = 0;
3147
3148
  this.live = true;
3148
3149
  this.requestScheduled = -1;
3149
3150
  this.ageHeader = 0;
3150
- this.advancedDateTime = void 0;
3151
+ this.advancedDateTime = undefined;
3151
3152
  this.updated = true;
3152
3153
  this.advanced = true;
3153
- this.availabilityDelay = void 0;
3154
+ this.availabilityDelay = undefined;
3154
3155
  // Manifest reload synchronization
3155
3156
  this.misses = 0;
3156
3157
  this.startCC = 0;
@@ -3159,30 +3160,30 @@ class LevelDetails {
3159
3160
  this.targetduration = 0;
3160
3161
  this.totalduration = 0;
3161
3162
  this.type = null;
3162
- this.url = void 0;
3163
+ this.url = undefined;
3163
3164
  this.m3u8 = '';
3164
3165
  this.version = null;
3165
3166
  this.canBlockReload = false;
3166
3167
  this.canSkipUntil = 0;
3167
3168
  this.canSkipDateRanges = false;
3168
3169
  this.skippedSegments = 0;
3169
- this.recentlyRemovedDateranges = void 0;
3170
+ this.recentlyRemovedDateranges = undefined;
3170
3171
  this.partHoldBack = 0;
3171
3172
  this.holdBack = 0;
3172
3173
  this.partTarget = 0;
3173
- this.preloadHint = void 0;
3174
- this.renditionReports = void 0;
3174
+ this.preloadHint = undefined;
3175
+ this.renditionReports = undefined;
3175
3176
  this.tuneInGoal = 0;
3176
- this.deltaUpdateFailed = void 0;
3177
+ this.deltaUpdateFailed = undefined;
3177
3178
  this.driftStartTime = 0;
3178
3179
  this.driftEndTime = 0;
3179
3180
  this.driftStart = 0;
3180
3181
  this.driftEnd = 0;
3181
- this.encryptedFragments = void 0;
3182
+ this.encryptedFragments = undefined;
3182
3183
  this.playlistParsingError = null;
3183
3184
  this.variableList = null;
3184
3185
  this.hasVariableRefs = false;
3185
- this.appliedTimelineOffset = void 0;
3186
+ this.appliedTimelineOffset = undefined;
3186
3187
  this.fragments = [];
3187
3188
  this.encryptedFragments = [];
3188
3189
  this.dateRanges = {};
@@ -3932,8 +3933,8 @@ function getDuration(data, initData) {
3932
3933
  continue;
3933
3934
  }
3934
3935
  const trackDefault = track.default;
3935
- const tfhdFlags = readUint32(tfhd, 0) | (trackDefault == null ? void 0 : trackDefault.flags);
3936
- let sampleDuration = trackDefault == null ? void 0 : trackDefault.duration;
3936
+ const tfhdFlags = readUint32(tfhd, 0) | (trackDefault == null ? undefined : trackDefault.flags);
3937
+ let sampleDuration = trackDefault == null ? undefined : trackDefault.duration;
3937
3938
  if (tfhdFlags & 0x000008) {
3938
3939
  // 0x000008 indicates the presence of the default_sample_duration field
3939
3940
  if (tfhdFlags & 0x000002) {
@@ -4463,12 +4464,12 @@ class LevelKey {
4463
4464
  static clearKeyUriToKeyIdMap() {
4464
4465
  }
4465
4466
  constructor(method, uri, format, formatversions = [1], iv = null) {
4466
- this.uri = void 0;
4467
- this.method = void 0;
4468
- this.keyFormat = void 0;
4469
- this.keyFormatVersions = void 0;
4470
- this.encrypted = void 0;
4471
- this.isCommonEncryption = void 0;
4467
+ this.uri = undefined;
4468
+ this.method = undefined;
4469
+ this.keyFormat = undefined;
4470
+ this.keyFormatVersions = undefined;
4471
+ this.encrypted = undefined;
4472
+ this.isCommonEncryption = undefined;
4472
4473
  this.iv = null;
4473
4474
  this.key = null;
4474
4475
  this.keyId = null;
@@ -5100,7 +5101,7 @@ function findFragmentWithStartDate(details, startDateTime, programDateTimes, ind
5100
5101
  const pdtStart = pdtFragment.programDateTime;
5101
5102
  if (startDateTime >= pdtStart || index === 0) {
5102
5103
  var _programDateTimes;
5103
- const durationBetweenPdt = (((_programDateTimes = programDateTimes[index + 1]) == null ? void 0 : _programDateTimes.start) || endTime) - pdtFragment.start;
5104
+ const durationBetweenPdt = (((_programDateTimes = programDateTimes[index + 1]) == null ? undefined : _programDateTimes.start) || endTime) - pdtFragment.start;
5104
5105
  if (startDateTime <= pdtStart + durationBetweenPdt * 1000) {
5105
5106
  // map to fragment with date-time range
5106
5107
  const startIndex = programDateTimes[index].sn - details.startSN;
@@ -5365,7 +5366,7 @@ function mergeDetails(oldDetails, newDetails) {
5365
5366
  if (currentInitSegment) {
5366
5367
  fragmentsToCheck.forEach(frag => {
5367
5368
  var _currentInitSegment;
5368
- if (frag && (!frag.initSegment || frag.initSegment.relurl === ((_currentInitSegment = currentInitSegment) == null ? void 0 : _currentInitSegment.relurl))) {
5369
+ if (frag && (!frag.initSegment || frag.initSegment.relurl === ((_currentInitSegment = currentInitSegment) == null ? undefined : _currentInitSegment.relurl))) {
5369
5370
  frag.initSegment = currentInitSegment;
5370
5371
  }
5371
5372
  });
@@ -5597,7 +5598,7 @@ function findPart(partList, sn, partIndex) {
5597
5598
  function reassignFragmentLevelIndexes(levels) {
5598
5599
  levels.forEach((level, index) => {
5599
5600
  var _level$details;
5600
- const fragments = (_level$details = level.details) == null ? void 0 : _level$details.fragments;
5601
+ const fragments = (_level$details = level.details) == null ? undefined : _level$details.fragments;
5601
5602
  if (fragments) {
5602
5603
  fragments.forEach(fragment => {
5603
5604
  fragment.level = index;
@@ -5612,7 +5613,7 @@ function reassignFragmentLevelIndexes(levels) {
5612
5613
  class BasePlaylistController extends Logger {
5613
5614
  constructor(hls, logPrefix) {
5614
5615
  super(logPrefix, hls.logger);
5615
- this.hls = void 0;
5616
+ this.hls = undefined;
5616
5617
  this.canLoad = false;
5617
5618
  this.timer = -1;
5618
5619
  this.hls = hls;
@@ -5637,7 +5638,7 @@ class BasePlaylistController extends Logger {
5637
5638
  this.clearTimer();
5638
5639
  }
5639
5640
  switchParams(playlistUri, previous, current) {
5640
- const renditionReports = previous == null ? void 0 : previous.renditionReports;
5641
+ const renditionReports = previous == null ? undefined : previous.renditionReports;
5641
5642
  if (renditionReports) {
5642
5643
  let foundIndex = -1;
5643
5644
  for (let i = 0; i < renditionReports.length; i++) {
@@ -5660,8 +5661,8 @@ class BasePlaylistController extends Logger {
5660
5661
  }
5661
5662
  if (foundIndex !== -1) {
5662
5663
  const attr = renditionReports[foundIndex];
5663
- const msn = parseInt(attr['LAST-MSN']) || (previous == null ? void 0 : previous.lastPartSn);
5664
- let part = parseInt(attr['LAST-PART']) || (previous == null ? void 0 : previous.lastPartIndex);
5664
+ const msn = parseInt(attr['LAST-MSN']) || (previous == null ? undefined : previous.lastPartSn);
5665
+ let part = parseInt(attr['LAST-PART']) || (previous == null ? undefined : previous.lastPartIndex);
5665
5666
  if (this.hls.config.lowLatencyMode) {
5666
5667
  const currentGoal = Math.min(previous.age - previous.partTarget, previous.targetduration);
5667
5668
  if (part >= 0 && currentGoal > previous.partTarget) {
@@ -5879,7 +5880,7 @@ class FragmentTracker {
5879
5880
  this.fragments = Object.create(null);
5880
5881
  this.timeRanges = Object.create(null);
5881
5882
  this.bufferPadding = 0.2;
5882
- this.hls = void 0;
5883
+ this.hls = undefined;
5883
5884
  this.hasGaps = false;
5884
5885
  this.hls = hls;
5885
5886
  this._registerListeners();
@@ -5948,7 +5949,7 @@ class FragmentTracker {
5948
5949
  const keys = Object.keys(fragments);
5949
5950
  for (let i = keys.length; i--;) {
5950
5951
  const fragmentEntity = fragments[keys[i]];
5951
- if ((fragmentEntity == null ? void 0 : fragmentEntity.body.type) === levelType && (!buffered || fragmentEntity.buffered)) {
5952
+ if ((fragmentEntity == null ? undefined : fragmentEntity.body.type) === levelType && (!buffered || fragmentEntity.buffered)) {
5952
5953
  const frag = fragmentEntity.body;
5953
5954
  if (frag.start <= position && position <= frag.end) {
5954
5955
  return frag;
@@ -5969,7 +5970,7 @@ class FragmentTracker {
5969
5970
  }
5970
5971
  // Check if any flagged fragments have been unloaded
5971
5972
  // excluding anything newer than appendedPartSn
5972
- const appendedPartSn = (appendedPart == null ? void 0 : appendedPart.fragment.sn) || -1;
5973
+ const appendedPartSn = (appendedPart == null ? undefined : appendedPart.fragment.sn) || -1;
5973
5974
  Object.keys(this.fragments).forEach(key => {
5974
5975
  const fragmentEntity = this.fragments[key];
5975
5976
  if (!fragmentEntity) {
@@ -6239,7 +6240,7 @@ class FragmentTracker {
6239
6240
  }
6240
6241
  for (let i = keys.length; i--;) {
6241
6242
  const fragmentEntity = fragments[keys[i]];
6242
- if ((fragmentEntity == null ? void 0 : fragmentEntity.body.type) === type) {
6243
+ if ((fragmentEntity == null ? undefined : fragmentEntity.body.type) === type) {
6243
6244
  return true;
6244
6245
  }
6245
6246
  }
@@ -6287,7 +6288,7 @@ class FragmentTracker {
6287
6288
  this.endListFragments = Object.create(null);
6288
6289
  this.activePartLists = Object.create(null);
6289
6290
  this.hasGaps = false;
6290
- const partlist = (_this$hls = this.hls) == null ? void 0 : (_this$hls$latestLevel = _this$hls.latestLevelDetails) == null ? void 0 : _this$hls$latestLevel.partList;
6291
+ const partlist = (_this$hls = this.hls) == null ? undefined : (_this$hls$latestLevel = _this$hls.latestLevelDetails) == null ? undefined : _this$hls$latestLevel.partList;
6291
6292
  if (partlist) {
6292
6293
  partlist.forEach(part => part.clearElementaryStreamInfo());
6293
6294
  }
@@ -6295,7 +6296,7 @@ class FragmentTracker {
6295
6296
  }
6296
6297
  function isPartial(fragmentEntity) {
6297
6298
  var _fragmentEntity$range, _fragmentEntity$range2, _fragmentEntity$range3;
6298
- return fragmentEntity.buffered && (fragmentEntity.body.gap || ((_fragmentEntity$range = fragmentEntity.range.video) == null ? void 0 : _fragmentEntity$range.partial) || ((_fragmentEntity$range2 = fragmentEntity.range.audio) == null ? void 0 : _fragmentEntity$range2.partial) || ((_fragmentEntity$range3 = fragmentEntity.range.audiovideo) == null ? void 0 : _fragmentEntity$range3.partial));
6299
+ return fragmentEntity.buffered && (fragmentEntity.body.gap || ((_fragmentEntity$range = fragmentEntity.range.video) == null ? undefined : _fragmentEntity$range.partial) || ((_fragmentEntity$range2 = fragmentEntity.range.audio) == null ? undefined : _fragmentEntity$range2.partial) || ((_fragmentEntity$range3 = fragmentEntity.range.audiovideo) == null ? undefined : _fragmentEntity$range3.partial));
6299
6300
  }
6300
6301
  function getFragmentKey(fragment) {
6301
6302
  return `${fragment.type}_${fragment.level}_${fragment.sn}`;
@@ -6303,9 +6304,9 @@ function getFragmentKey(fragment) {
6303
6304
 
6304
6305
  class AESCrypto {
6305
6306
  constructor(subtle, iv, aesMode) {
6306
- this.subtle = void 0;
6307
- this.aesIV = void 0;
6308
- this.aesMode = void 0;
6307
+ this.subtle = undefined;
6308
+ this.aesIV = undefined;
6309
+ this.aesMode = undefined;
6309
6310
  this.subtle = subtle;
6310
6311
  this.aesIV = iv;
6311
6312
  this.aesMode = aesMode;
@@ -6350,8 +6351,8 @@ class AESDecryptor {
6350
6351
  this.key = new Uint32Array(0);
6351
6352
  this.ksRows = 0;
6352
6353
  this.keySize = 0;
6353
- this.keySchedule = void 0;
6354
- this.invKeySchedule = void 0;
6354
+ this.keySchedule = undefined;
6355
+ this.invKeySchedule = undefined;
6355
6356
  this.initTable();
6356
6357
  }
6357
6358
 
@@ -6565,9 +6566,9 @@ class AESDecryptor {
6565
6566
 
6566
6567
  class FastAESKey {
6567
6568
  constructor(subtle, key, aesMode) {
6568
- this.subtle = void 0;
6569
- this.key = void 0;
6570
- this.aesMode = void 0;
6569
+ this.subtle = undefined;
6570
+ this.key = undefined;
6571
+ this.aesMode = undefined;
6571
6572
  this.subtle = subtle;
6572
6573
  this.key = key;
6573
6574
  this.aesMode = aesMode;
@@ -6597,7 +6598,7 @@ class Decrypter {
6597
6598
  removePKCS7Padding = true
6598
6599
  } = {}) {
6599
6600
  this.logEnabled = true;
6600
- this.removePKCS7Padding = void 0;
6601
+ this.removePKCS7Padding = undefined;
6601
6602
  this.subtle = null;
6602
6603
  this.softwareDecrypter = null;
6603
6604
  this.key = null;
@@ -6605,8 +6606,8 @@ class Decrypter {
6605
6606
  this.remainderData = null;
6606
6607
  this.currentIV = null;
6607
6608
  this.currentResult = null;
6608
- this.useSoftware = void 0;
6609
- this.enableSoftwareAES = void 0;
6609
+ this.useSoftware = undefined;
6610
+ this.enableSoftwareAES = undefined;
6610
6611
  this.enableSoftwareAES = config.enableSoftwareAES;
6611
6612
  this.removePKCS7Padding = removePKCS7Padding;
6612
6613
  // built in decryptor expects PKCS7 padding
@@ -6774,7 +6775,7 @@ const MIN_CHUNK_SIZE = Math.pow(2, 17); // 128kb
6774
6775
 
6775
6776
  class FragmentLoader {
6776
6777
  constructor(config) {
6777
- this.config = void 0;
6778
+ this.config = undefined;
6778
6779
  this.loader = null;
6779
6780
  this.partLoadTimeout = -1;
6780
6781
  this.config = config;
@@ -7040,7 +7041,7 @@ function createLoaderContext(frag, part = null) {
7040
7041
  var _frag$decryptdata;
7041
7042
  let byteRangeStart = start;
7042
7043
  let byteRangeEnd = end;
7043
- if (frag.sn === 'initSegment' && isMethodFullSegmentAesCbc((_frag$decryptdata = frag.decryptdata) == null ? void 0 : _frag$decryptdata.method)) {
7044
+ if (frag.sn === 'initSegment' && isMethodFullSegmentAesCbc((_frag$decryptdata = frag.decryptdata) == null ? undefined : _frag$decryptdata.method)) {
7044
7045
  // MAP segment encrypted with method 'AES-128' or 'AES-256' (cbc), when served with HTTP Range,
7045
7046
  // has the unencrypted size specified in the range.
7046
7047
  // Ref: https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08#section-6.3.6
@@ -7080,7 +7081,7 @@ function isMethodFullSegmentAesCbc(method) {
7080
7081
  class LoadError extends Error {
7081
7082
  constructor(data) {
7082
7083
  super(data.error.message);
7083
- this.data = void 0;
7084
+ this.data = undefined;
7084
7085
  this.data = data;
7085
7086
  }
7086
7087
  }
@@ -7117,7 +7118,7 @@ class LoadError extends Error {
7117
7118
  class TaskLoop extends Logger {
7118
7119
  constructor(label, logger) {
7119
7120
  super(label, logger);
7120
- this._boundTick = void 0;
7121
+ this._boundTick = undefined;
7121
7122
  this._tickTimer = null;
7122
7123
  this._tickInterval = null;
7123
7124
  this._tickCallCount = 0;
@@ -7209,12 +7210,12 @@ class TaskLoop extends Logger {
7209
7210
 
7210
7211
  class ChunkMetadata {
7211
7212
  constructor(level, sn, id, size = 0, part = -1, partial = false) {
7212
- this.level = void 0;
7213
- this.sn = void 0;
7214
- this.part = void 0;
7215
- this.id = void 0;
7216
- this.size = void 0;
7217
- this.partial = void 0;
7213
+ this.level = undefined;
7214
+ this.sn = undefined;
7215
+ this.part = undefined;
7216
+ this.id = undefined;
7217
+ this.size = undefined;
7218
+ this.partial = undefined;
7218
7219
  this.transmuxing = getNewPerformanceTiming();
7219
7220
  this.buffering = {
7220
7221
  audio: getNewPerformanceTiming(),
@@ -7283,8 +7284,7 @@ class BufferHelper {
7283
7284
  return {
7284
7285
  len: 0,
7285
7286
  start: pos,
7286
- end: pos,
7287
- nextStart: undefined
7287
+ end: pos
7288
7288
  };
7289
7289
  }
7290
7290
  static bufferedInfo(buffered, pos, maxHoleDuration) {
@@ -7347,7 +7347,8 @@ class BufferHelper {
7347
7347
  len: bufferLen,
7348
7348
  start: bufferStart || 0,
7349
7349
  end: bufferEnd || 0,
7350
- nextStart: bufferStartNext
7350
+ nextStart: bufferStartNext,
7351
+ buffered
7351
7352
  };
7352
7353
  }
7353
7354
 
@@ -7368,7 +7369,7 @@ class BufferHelper {
7368
7369
  function findFirstFragWithCC(fragments, cc) {
7369
7370
  for (let i = 0, len = fragments.length; i < len; i++) {
7370
7371
  var _fragments$i;
7371
- if (((_fragments$i = fragments[i]) == null ? void 0 : _fragments$i.cc) === cc) {
7372
+ if (((_fragments$i = fragments[i]) == null ? undefined : _fragments$i.cc) === cc) {
7372
7373
  return fragments[i];
7373
7374
  }
7374
7375
  }
@@ -7529,16 +7530,16 @@ const State = {
7529
7530
  class BaseStreamController extends TaskLoop {
7530
7531
  constructor(hls, fragmentTracker, keyLoader, logPrefix, playlistType) {
7531
7532
  super(logPrefix, hls.logger);
7532
- this.hls = void 0;
7533
+ this.hls = undefined;
7533
7534
  this.fragPrevious = null;
7534
7535
  this.fragCurrent = null;
7535
- this.fragmentTracker = void 0;
7536
+ this.fragmentTracker = undefined;
7536
7537
  this.transmuxer = null;
7537
7538
  this._state = State.STOPPED;
7538
- this.playlistType = void 0;
7539
+ this.playlistType = undefined;
7539
7540
  this.media = null;
7540
7541
  this.mediaBuffer = null;
7541
- this.config = void 0;
7542
+ this.config = undefined;
7542
7543
  this.bitrateTest = false;
7543
7544
  this.lastCurrentTime = 0;
7544
7545
  this.nextLoadPosition = 0;
@@ -7546,15 +7547,15 @@ class BaseStreamController extends TaskLoop {
7546
7547
  this.startTimeOffset = null;
7547
7548
  this.retryDate = 0;
7548
7549
  this.levels = null;
7549
- this.fragmentLoader = void 0;
7550
- this.keyLoader = void 0;
7550
+ this.fragmentLoader = undefined;
7551
+ this.keyLoader = undefined;
7551
7552
  this.levelLastLoaded = null;
7552
7553
  this.startFragRequested = false;
7553
- this.decrypter = void 0;
7554
+ this.decrypter = undefined;
7554
7555
  this.initPTS = [];
7555
7556
  this.buffering = true;
7556
7557
  this.loadingParts = false;
7557
- this.loopSn = void 0;
7558
+ this.loopSn = undefined;
7558
7559
  this.onMediaSeeking = () => {
7559
7560
  const {
7560
7561
  config,
@@ -7729,7 +7730,7 @@ class BaseStreamController extends TaskLoop {
7729
7730
  getLevelDetails() {
7730
7731
  if (this.levels && this.levelLastLoaded !== null) {
7731
7732
  var _this$levelLastLoaded;
7732
- return (_this$levelLastLoaded = this.levelLastLoaded) == null ? void 0 : _this$levelLastLoaded.details;
7733
+ return (_this$levelLastLoaded = this.levelLastLoaded) == null ? undefined : _this$levelLastLoaded.details;
7733
7734
  }
7734
7735
  }
7735
7736
  onMediaAttached(event, data) {
@@ -7848,7 +7849,7 @@ class BaseStreamController extends TaskLoop {
7848
7849
  if (this.state === State.STOPPED || this.state === State.ERROR) {
7849
7850
  return;
7850
7851
  }
7851
- this.warn(`Frag error: ${(reason == null ? void 0 : reason.message) || reason}`);
7852
+ this.warn(`Frag error: ${(reason == null ? undefined : reason.message) || reason}`);
7852
7853
  this.resetFragmentLoading(fragment);
7853
7854
  });
7854
7855
  }
@@ -7869,7 +7870,7 @@ class BaseStreamController extends TaskLoop {
7869
7870
  if (backtracked === 1 || this.reduceMaxBufferLength(minForwardBufferLength, frag.duration)) {
7870
7871
  fragmentTracker.removeFragment(frag);
7871
7872
  }
7872
- } else if (((_this$mediaBuffer = this.mediaBuffer) == null ? void 0 : _this$mediaBuffer.buffered.length) === 0) {
7873
+ } else if (((_this$mediaBuffer = this.mediaBuffer) == null ? undefined : _this$mediaBuffer.buffered.length) === 0) {
7873
7874
  // Stop gap for bad tracker / buffer flush behavior
7874
7875
  fragmentTracker.removeAllFragments();
7875
7876
  } else if (fragmentTracker.hasParts(frag.type)) {
@@ -7902,7 +7903,7 @@ class BaseStreamController extends TaskLoop {
7902
7903
  }
7903
7904
  waitForLive(levelInfo) {
7904
7905
  const details = levelInfo.details;
7905
- return (details == null ? void 0 : details.live) && details.type !== 'EVENT' && (this.levelLastLoaded !== levelInfo || details.expired);
7906
+ return (details == null ? undefined : details.live) && details.type !== 'EVENT' && (this.levelLastLoaded !== levelInfo || details.expired);
7906
7907
  }
7907
7908
  flushMainBuffer(startOffset, endOffset, type = null) {
7908
7909
  if (!(startOffset - endOffset)) {
@@ -7919,7 +7920,7 @@ class BaseStreamController extends TaskLoop {
7919
7920
  }
7920
7921
  _loadInitSegment(fragment, level) {
7921
7922
  this._doFragLoad(fragment, level).then(data => {
7922
- const frag = data == null ? void 0 : data.frag;
7923
+ const frag = data == null ? undefined : data.frag;
7923
7924
  if (!frag || this.fragContextChanged(frag) || !this.levels) {
7924
7925
  throw new Error('init load aborted');
7925
7926
  }
@@ -8006,7 +8007,7 @@ class BaseStreamController extends TaskLoop {
8006
8007
  return;
8007
8008
  }
8008
8009
  }
8009
- const level = (_this$levels = this.levels) == null ? void 0 : _this$levels[frag.level];
8010
+ const level = (_this$levels = this.levels) == null ? undefined : _this$levels[frag.level];
8010
8011
  if (level != null && level.fragmentError) {
8011
8012
  this.log(`Resetting level fragment error count of ${level.fragmentError} on frag buffered`);
8012
8013
  level.fragmentError = 0;
@@ -8037,7 +8038,7 @@ class BaseStreamController extends TaskLoop {
8037
8038
  _doFragLoad(frag, level, targetBufferTime = null, progressCallback) {
8038
8039
  var _frag$decryptdata;
8039
8040
  this.fragCurrent = frag;
8040
- const details = level == null ? void 0 : level.details;
8041
+ const details = level == null ? undefined : level.details;
8041
8042
  if (!this.levels || !details) {
8042
8043
  throw new Error(`frag load aborted, missing level${details ? '' : ' detail'}s`);
8043
8044
  }
@@ -8068,7 +8069,7 @@ class BaseStreamController extends TaskLoop {
8068
8069
  if (isMediaFragment(frag) && (!fragPrevious || frag.sn !== fragPrevious.sn)) {
8069
8070
  const shouldLoadParts = this.shouldLoadParts(level.details, frag.end);
8070
8071
  if (shouldLoadParts !== this.loadingParts) {
8071
- this.log(`LL-Part loading ${shouldLoadParts ? 'ON' : 'OFF'} loading sn ${fragPrevious == null ? void 0 : fragPrevious.sn}->${frag.sn}`);
8072
+ this.log(`LL-Part loading ${shouldLoadParts ? 'ON' : 'OFF'} loading sn ${fragPrevious == null ? undefined : fragPrevious.sn}->${frag.sn}`);
8072
8073
  this.loadingParts = shouldLoadParts;
8073
8074
  }
8074
8075
  }
@@ -8131,7 +8132,7 @@ class BaseStreamController extends TaskLoop {
8131
8132
  let result;
8132
8133
  if (dataOnProgress && keyLoadingPromise) {
8133
8134
  result = keyLoadingPromise.then(keyLoadedData => {
8134
- if (!keyLoadedData || this.fragContextChanged(keyLoadedData == null ? void 0 : keyLoadedData.frag)) {
8135
+ if (!keyLoadedData || this.fragContextChanged(keyLoadedData == null ? undefined : keyLoadedData.frag)) {
8135
8136
  return null;
8136
8137
  }
8137
8138
  return this.fragmentLoader.load(frag, progressCallback);
@@ -8159,7 +8160,7 @@ class BaseStreamController extends TaskLoop {
8159
8160
  return new Promise((resolve, reject) => {
8160
8161
  var _level$details2;
8161
8162
  const partsLoaded = [];
8162
- const initialPartList = (_level$details2 = level.details) == null ? void 0 : _level$details2.partList;
8163
+ const initialPartList = (_level$details2 = level.details) == null ? undefined : _level$details2.partList;
8163
8164
  const loadPart = part => {
8164
8165
  this.fragmentLoader.loadPart(frag, part, progressCallback).then(partLoadedData => {
8165
8166
  partsLoaded[part.index] = partLoadedData;
@@ -8237,10 +8238,10 @@ class BaseStreamController extends TaskLoop {
8237
8238
  // Buffer must be ahead of first part + duration of parts after last segment
8238
8239
  // and playback must be at or past segment adjacent to part list
8239
8240
  const firstPart = details.partList[0];
8240
- const safePartStart = firstPart.end + (((_details$fragmentHint = details.fragmentHint) == null ? void 0 : _details$fragmentHint.duration) || 0);
8241
+ const safePartStart = firstPart.end + (((_details$fragmentHint = details.fragmentHint) == null ? undefined : _details$fragmentHint.duration) || 0);
8241
8242
  if (bufferEnd >= safePartStart) {
8242
8243
  var _this$media;
8243
- const playhead = this.hls.hasEnoughToStart ? ((_this$media = this.media) == null ? void 0 : _this$media.currentTime) || this.lastCurrentTime : this.getLoadPosition();
8244
+ const playhead = this.hls.hasEnoughToStart ? ((_this$media = this.media) == null ? undefined : _this$media.currentTime) || this.lastCurrentTime : this.getLoadPosition();
8244
8245
  if (playhead > firstPart.start - firstPart.fragment.duration) {
8245
8246
  return true;
8246
8247
  }
@@ -8380,7 +8381,7 @@ class BaseStreamController extends TaskLoop {
8380
8381
  }
8381
8382
  getAppendedFrag(position, playlistType = PlaylistLevelType.MAIN) {
8382
8383
  var _this$fragmentTracker;
8383
- const fragOrPart = (_this$fragmentTracker = this.fragmentTracker) == null ? void 0 : _this$fragmentTracker.getAppendedFrag(position, playlistType);
8384
+ const fragOrPart = (_this$fragmentTracker = this.fragmentTracker) == null ? undefined : _this$fragmentTracker.getAppendedFrag(position, playlistType);
8384
8385
  if (fragOrPart && 'fragment' in fragOrPart) {
8385
8386
  return fragOrPart.fragment;
8386
8387
  }
@@ -8420,7 +8421,7 @@ class BaseStreamController extends TaskLoop {
8420
8421
  const mainStart = this.hls.startPosition;
8421
8422
  const liveSyncPosition = this.hls.liveSyncPosition;
8422
8423
  const startPosition = frag ? (mainStart !== -1 && mainStart >= start ? mainStart : liveSyncPosition) || frag.start : pos;
8423
- this.log(`Setting startPosition to ${startPosition} to match initial live edge. mainStart: ${mainStart} liveSyncPosition: ${liveSyncPosition} frag.start: ${(_frag = frag) == null ? void 0 : _frag.start}`);
8424
+ this.log(`Setting startPosition to ${startPosition} to match initial live edge. mainStart: ${mainStart} liveSyncPosition: ${liveSyncPosition} frag.start: ${(_frag = frag) == null ? undefined : _frag.start}`);
8424
8425
  this.startPosition = this.nextLoadPosition = startPosition;
8425
8426
  }
8426
8427
  } else if (pos <= start) {
@@ -8694,7 +8695,7 @@ class BaseStreamController extends TaskLoop {
8694
8695
  }
8695
8696
  if (this.fragContextChanged(frag)) {
8696
8697
  var _this$fragCurrent;
8697
- this.warn(`Frag load error must match current frag to retry ${frag.url} > ${(_this$fragCurrent = this.fragCurrent) == null ? void 0 : _this$fragCurrent.url}`);
8698
+ this.warn(`Frag load error must match current frag to retry ${frag.url} > ${(_this$fragCurrent = this.fragCurrent) == null ? undefined : _this$fragCurrent.url}`);
8698
8699
  return;
8699
8700
  }
8700
8701
  const gapTagEncountered = data.details === ErrorDetails.FRAG_GAP;
@@ -8752,7 +8753,7 @@ class BaseStreamController extends TaskLoop {
8752
8753
  // reduce max buf len if current position is buffered
8753
8754
  const buffered = bufferedInfo && bufferedInfo.len > 0.5;
8754
8755
  if (buffered) {
8755
- this.reduceMaxBufferLength(bufferedInfo.len, (frag == null ? void 0 : frag.duration) || 10);
8756
+ this.reduceMaxBufferLength(bufferedInfo.len, (frag == null ? undefined : frag.duration) || 10);
8756
8757
  }
8757
8758
  const flushBuffer = !buffered;
8758
8759
  if (flushBuffer) {
@@ -8862,7 +8863,7 @@ class BaseStreamController extends TaskLoop {
8862
8863
  }
8863
8864
  return result;
8864
8865
  }, false);
8865
- if (!parsed && ((_this$transmuxer = this.transmuxer) == null ? void 0 : _this$transmuxer.error) === null) {
8866
+ if (!parsed && ((_this$transmuxer = this.transmuxer) == null ? undefined : _this$transmuxer.error) === null) {
8866
8867
  const error = new Error(`Found no media in fragment ${frag.sn} of ${this.playlistLabel()} ${frag.level} resetting transmuxer to fallback to playlist timing`);
8867
8868
  if (level.fragmentError === 0) {
8868
8869
  // Mark and track the odd empty segment as a gap to avoid reloading
@@ -8907,7 +8908,7 @@ class BaseStreamController extends TaskLoop {
8907
8908
  }
8908
8909
  resetTransmuxer() {
8909
8910
  var _this$transmuxer2;
8910
- (_this$transmuxer2 = this.transmuxer) == null ? void 0 : _this$transmuxer2.reset();
8911
+ (_this$transmuxer2 = this.transmuxer) == null ? undefined : _this$transmuxer2.reset();
8911
8912
  }
8912
8913
  recoverWorkerError(data) {
8913
8914
  if (data.event === 'demuxerWorker') {
@@ -8934,7 +8935,7 @@ class BaseStreamController extends TaskLoop {
8934
8935
 
8935
8936
  class BufferOperationQueue {
8936
8937
  constructor(sourceBufferReference) {
8937
- this.tracks = void 0;
8938
+ this.tracks = undefined;
8938
8939
  this.queues = {
8939
8940
  video: [],
8940
8941
  audio: [],
@@ -8987,7 +8988,7 @@ class BufferOperationQueue {
8987
8988
  }
8988
8989
  [this.queues.video, this.queues.audio, this.queues.audiovideo].forEach(queue => {
8989
8990
  var _queue$;
8990
- const label = (_queue$ = queue[0]) == null ? void 0 : _queue$.label;
8991
+ const label = (_queue$ = queue[0]) == null ? undefined : _queue$.label;
8991
8992
  if (label === 'async-blocker' || label === 'async-blocker-prepend') {
8992
8993
  queue[0].execute();
8993
8994
  queue.splice(0, 1);
@@ -9022,7 +9023,7 @@ class BufferOperationQueue {
9022
9023
  }
9023
9024
 
9024
9025
  // Only shift the current operation off, otherwise the updateend handler will do this for us
9025
- const sb = (_this$tracks$type = this.tracks[type]) == null ? void 0 : _this$tracks$type.buffer;
9026
+ const sb = (_this$tracks$type = this.tracks[type]) == null ? undefined : _this$tracks$type.buffer;
9026
9027
  if (!(sb != null && sb.updating)) {
9027
9028
  this.shiftAndExecuteNext(type);
9028
9029
  }
@@ -9038,7 +9039,7 @@ class BufferOperationQueue {
9038
9039
  }
9039
9040
  current(type) {
9040
9041
  var _this$queues;
9041
- return ((_this$queues = this.queues) == null ? void 0 : _this$queues[type][0]) || null;
9042
+ return ((_this$queues = this.queues) == null ? undefined : _this$queues[type][0]) || null;
9042
9043
  }
9043
9044
  toString() {
9044
9045
  const {
@@ -9059,8 +9060,8 @@ ${this.list('audiovideo')}}`;
9059
9060
  }
9060
9061
  listSbInfo(type) {
9061
9062
  var _this$tracks2;
9062
- const track = (_this$tracks2 = this.tracks) == null ? void 0 : _this$tracks2[type];
9063
- const sb = track == null ? void 0 : track.buffer;
9063
+ const track = (_this$tracks2 = this.tracks) == null ? undefined : _this$tracks2[type];
9064
+ const sb = track == null ? undefined : track.buffer;
9064
9065
  if (!sb) {
9065
9066
  return 'none';
9066
9067
  }
@@ -9068,7 +9069,7 @@ ${this.list('audiovideo')}}`;
9068
9069
  }
9069
9070
  listOps(type) {
9070
9071
  var _this$queues3;
9071
- return ((_this$queues3 = this.queues) == null ? void 0 : _this$queues3[type].map(op => op.label).join(', ')) || '';
9072
+ return ((_this$queues3 = this.queues) == null ? undefined : _this$queues3[type].map(op => op.label).join(', ')) || '';
9072
9073
  }
9073
9074
  }
9074
9075
 
@@ -9083,8 +9084,8 @@ class HlsJsTrackRemovedError extends Error {
9083
9084
  class BufferController extends Logger {
9084
9085
  constructor(hls, fragmentTracker) {
9085
9086
  super('buffer-controller', hls.logger);
9086
- this.hls = void 0;
9087
- this.fragmentTracker = void 0;
9087
+ this.hls = undefined;
9088
+ this.fragmentTracker = undefined;
9088
9089
  // The level details used to determine duration, target-duration and live
9089
9090
  this.details = null;
9090
9091
  // cache the self generated object url to detect hijack of video tag
@@ -9104,11 +9105,11 @@ class BufferController extends Logger {
9104
9105
  // Keep track of video append position for unblocking audio
9105
9106
  this.lastVideoAppendEnd = 0;
9106
9107
  // Whether or not to use ManagedMediaSource API and append source element to media element.
9107
- this.appendSource = void 0;
9108
+ this.appendSource = undefined;
9108
9109
  // Transferred MediaSource information used to detmerine if duration end endstream may be appended
9109
- this.transferData = void 0;
9110
+ this.transferData = undefined;
9110
9111
  // Directives used to override default MediaSource handling
9111
- this.overrides = void 0;
9112
+ this.overrides = undefined;
9112
9113
  // Error counters
9113
9114
  this.appendErrors = {
9114
9115
  audio: 0,
@@ -9124,7 +9125,7 @@ class BufferController extends Logger {
9124
9125
  if (!this.hls) {
9125
9126
  return;
9126
9127
  }
9127
- if (((_this$mediaSource = this.mediaSource) == null ? void 0 : _this$mediaSource.readyState) !== 'open') {
9128
+ if (((_this$mediaSource = this.mediaSource) == null ? undefined : _this$mediaSource.readyState) !== 'open') {
9128
9129
  return;
9129
9130
  }
9130
9131
  this.hls.pauseBuffering();
@@ -9297,7 +9298,7 @@ class BufferController extends Logger {
9297
9298
  // in case alt audio is not used, only one BUFFER_CODEC event will be fired from main stream controller
9298
9299
  // it will contain the expected nb of source buffers, no need to compute it
9299
9300
  let codecEvents = 2;
9300
- if (data.audio && !data.video || !data.altAudio || !false) {
9301
+ if (data.audio && !data.video || !data.altAudio || true) {
9301
9302
  codecEvents = 1;
9302
9303
  }
9303
9304
  this.bufferCodecEventsTotal = codecEvents;
@@ -9346,7 +9347,7 @@ class BufferController extends Logger {
9346
9347
  }
9347
9348
  assignMediaSource(ms) {
9348
9349
  var _this$transferData2, _ms$constructor;
9349
- this.log(`${((_this$transferData2 = this.transferData) == null ? void 0 : _this$transferData2.mediaSource) === ms ? 'transferred' : 'created'} media source: ${(_ms$constructor = ms.constructor) == null ? void 0 : _ms$constructor.name}`);
9350
+ this.log(`${((_this$transferData2 = this.transferData) == null ? undefined : _this$transferData2.mediaSource) === ms ? 'transferred' : 'created'} media source: ${(_ms$constructor = ms.constructor) == null ? undefined : _ms$constructor.name}`);
9350
9351
  // MediaSource listeners are arrow functions with a lexical scope, and do not need to be bound
9351
9352
  ms.addEventListener('sourceopen', this._onMediaSourceOpen);
9352
9353
  ms.addEventListener('sourceended', this._onMediaSourceEnded);
@@ -9387,7 +9388,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
9387
9388
  data.tracks = undefined;
9388
9389
  const currentTime = media.currentTime;
9389
9390
  const details = this.details;
9390
- const startTime = Math.max(currentTime, (details == null ? void 0 : details.fragments[0].start) || 0);
9391
+ const startTime = Math.max(currentTime, (details == null ? undefined : details.fragments[0].start) || 0);
9391
9392
  if (startTime - currentTime > 1) {
9392
9393
  this.log(`attachTransferred: waiting for playback to reach new tracks start time ${currentTime} -> ${startTime}`);
9393
9394
  return;
@@ -9432,7 +9433,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
9432
9433
  }
9433
9434
  get mediaSourceOpenOrEnded() {
9434
9435
  var _this$mediaSource2;
9435
- const readyState = (_this$mediaSource2 = this.mediaSource) == null ? void 0 : _this$mediaSource2.readyState;
9436
+ const readyState = (_this$mediaSource2 = this.mediaSource) == null ? undefined : _this$mediaSource2.readyState;
9436
9437
  return readyState === 'open' || readyState === 'ended';
9437
9438
  }
9438
9439
  onMediaDetaching(event, data) {
@@ -9527,7 +9528,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
9527
9528
  }
9528
9529
  resetBuffer(type) {
9529
9530
  var _this$tracks$type;
9530
- const sb = (_this$tracks$type = this.tracks[type]) == null ? void 0 : _this$tracks$type.buffer;
9531
+ const sb = (_this$tracks$type = this.tracks[type]) == null ? undefined : _this$tracks$type.buffer;
9531
9532
  this.removeBuffer(type);
9532
9533
  if (sb) {
9533
9534
  try {
@@ -9579,10 +9580,10 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
9579
9580
  metadata
9580
9581
  } = parsedTrack;
9581
9582
  let track = tracks[trackName];
9582
- const transferredTrack = (_this$transferData3 = this.transferData) == null ? void 0 : (_this$transferData3$t = _this$transferData3.tracks) == null ? void 0 : _this$transferData3$t[trackName];
9583
+ const transferredTrack = (_this$transferData3 = this.transferData) == null ? undefined : (_this$transferData3$t = _this$transferData3.tracks) == null ? undefined : _this$transferData3$t[trackName];
9583
9584
  const sbTrack = transferredTrack != null && transferredTrack.buffer ? transferredTrack : track;
9584
- const sbCodec = (sbTrack == null ? void 0 : sbTrack.pendingCodec) || (sbTrack == null ? void 0 : sbTrack.codec);
9585
- const trackLevelCodec = sbTrack == null ? void 0 : sbTrack.levelCodec;
9585
+ const sbCodec = (sbTrack == null ? undefined : sbTrack.pendingCodec) || (sbTrack == null ? undefined : sbTrack.codec);
9586
+ const trackLevelCodec = sbTrack == null ? undefined : sbTrack.levelCodec;
9586
9587
  const forceChangeType = !sbTrack || !!this.hls.config.assetPlayerId;
9587
9588
  if (!track) {
9588
9589
  track = tracks[trackName] = {
@@ -9597,9 +9598,9 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
9597
9598
  }
9598
9599
  // check if SourceBuffer codec needs to change
9599
9600
  const currentCodecFull = pickMostCompleteCodecName(sbCodec, trackLevelCodec);
9600
- const currentCodec = currentCodecFull == null ? void 0 : currentCodecFull.replace(VIDEO_CODEC_PROFILE_REPLACE, '$1');
9601
+ const currentCodec = currentCodecFull == null ? undefined : currentCodecFull.replace(VIDEO_CODEC_PROFILE_REPLACE, '$1');
9601
9602
  let trackCodec = pickMostCompleteCodecName(codec, levelCodec);
9602
- const nextCodec = (_trackCodec = trackCodec) == null ? void 0 : _trackCodec.replace(VIDEO_CODEC_PROFILE_REPLACE, '$1');
9603
+ const nextCodec = (_trackCodec = trackCodec) == null ? undefined : _trackCodec.replace(VIDEO_CODEC_PROFILE_REPLACE, '$1');
9603
9604
  if (trackCodec && (currentCodec !== nextCodec || forceChangeType)) {
9604
9605
  if (trackName.slice(0, 5) === 'audio') {
9605
9606
  trackCodec = getCodecCompatibleName(trackCodec, this.appendSource);
@@ -9665,7 +9666,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
9665
9666
  var _this$fragmentTracker;
9666
9667
  const pStart = partOrFrag.start;
9667
9668
  const pTime = pStart + partOrFrag.duration * 0.05;
9668
- const atGap = ((_this$fragmentTracker = this.fragmentTracker.getAppendedFrag(pStart, PlaylistLevelType.MAIN)) == null ? void 0 : _this$fragmentTracker.gap) === true;
9669
+ const atGap = ((_this$fragmentTracker = this.fragmentTracker.getAppendedFrag(pStart, PlaylistLevelType.MAIN)) == null ? undefined : _this$fragmentTracker.gap) === true;
9669
9670
  if (atGap) {
9670
9671
  return;
9671
9672
  }
@@ -9674,7 +9675,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
9674
9675
  execute: () => {
9675
9676
  var _this$fragmentTracker2;
9676
9677
  const videoTrack = this.tracks.video;
9677
- if (this.lastVideoAppendEnd > pTime || videoTrack != null && videoTrack.buffer && BufferHelper.isBuffered(videoTrack.buffer, pTime) || ((_this$fragmentTracker2 = this.fragmentTracker.getAppendedFrag(pTime, PlaylistLevelType.MAIN)) == null ? void 0 : _this$fragmentTracker2.gap) === true) {
9678
+ if (this.lastVideoAppendEnd > pTime || videoTrack != null && videoTrack.buffer && BufferHelper.isBuffered(videoTrack.buffer, pTime) || ((_this$fragmentTracker2 = this.fragmentTracker.getAppendedFrag(pTime, PlaylistLevelType.MAIN)) == null ? undefined : _this$fragmentTracker2.gap) === true) {
9678
9679
  this.blockedAudioAppend = null;
9679
9680
  this.shiftAndExecuteNext('audio');
9680
9681
  }
@@ -9733,14 +9734,14 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
9733
9734
  // More info here: https://github.com/video-dev/hls.js/issues/332#issuecomment-257986486
9734
9735
  const audioTrack = tracks.audio;
9735
9736
  let checkTimestampOffset = false;
9736
- if (type === 'audio' && (audioTrack == null ? void 0 : audioTrack.container) === 'audio/mpeg') {
9737
+ if (type === 'audio' && (audioTrack == null ? undefined : audioTrack.container) === 'audio/mpeg') {
9737
9738
  checkTimestampOffset = !this.lastMpegAudioChunk || chunkMeta.id === 1 || this.lastMpegAudioChunk.sn !== chunkMeta.sn;
9738
9739
  this.lastMpegAudioChunk = chunkMeta;
9739
9740
  }
9740
9741
 
9741
9742
  // Block audio append until overlapping video append
9742
9743
  const videoTrack = this.tracks.video;
9743
- const videoSb = videoTrack == null ? void 0 : videoTrack.buffer;
9744
+ const videoSb = videoTrack == null ? undefined : videoTrack.buffer;
9744
9745
  if (videoSb && sn !== 'initSegment') {
9745
9746
  const partOrFrag = part || frag;
9746
9747
  const blockedAudioAppend = this.blockedAudioAppend;
@@ -9945,7 +9946,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
9945
9946
  get bufferedToEnd() {
9946
9947
  return this.sourceBufferCount > 0 && !this.sourceBuffers.some(([type]) => {
9947
9948
  var _this$tracks$type2, _this$tracks$type3;
9948
- return type && (!((_this$tracks$type2 = this.tracks[type]) != null && _this$tracks$type2.ended) || ((_this$tracks$type3 = this.tracks[type]) == null ? void 0 : _this$tracks$type3.ending));
9949
+ return type && (!((_this$tracks$type2 = this.tracks[type]) != null && _this$tracks$type2.ended) || ((_this$tracks$type3 = this.tracks[type]) == null ? undefined : _this$tracks$type3.ending));
9949
9950
  });
9950
9951
  }
9951
9952
 
@@ -9965,7 +9966,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
9965
9966
  }
9966
9967
  }
9967
9968
  });
9968
- const allowEndOfStream = ((_this$overrides = this.overrides) == null ? void 0 : _this$overrides.endOfStream) !== false;
9969
+ const allowEndOfStream = ((_this$overrides = this.overrides) == null ? undefined : _this$overrides.endOfStream) !== false;
9969
9970
  const allTracksEnding = this.sourceBufferCount > 0 && !this.sourceBuffers.some(([type]) => {
9970
9971
  var _this$tracks$type4;
9971
9972
  return type && !((_this$tracks$type4 = this.tracks[type]) != null && _this$tracks$type4.ended);
@@ -10018,7 +10019,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10018
10019
  onError(event, data) {
10019
10020
  if (data.details === ErrorDetails.BUFFER_APPEND_ERROR && data.frag) {
10020
10021
  var _data$errorAction;
10021
- const nextAutoLevel = (_data$errorAction = data.errorAction) == null ? void 0 : _data$errorAction.nextAutoLevel;
10022
+ const nextAutoLevel = (_data$errorAction = data.errorAction) == null ? undefined : _data$errorAction.nextAutoLevel;
10022
10023
  if (isFiniteNumber(nextAutoLevel) && nextAutoLevel !== data.frag.level) {
10023
10024
  this.resetAppendErrors();
10024
10025
  }
@@ -10126,7 +10127,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10126
10127
  details,
10127
10128
  mediaSource
10128
10129
  } = this;
10129
- if (!details || !this.media || (mediaSource == null ? void 0 : mediaSource.readyState) !== 'open') {
10130
+ if (!details || !this.media || (mediaSource == null ? undefined : mediaSource.readyState) !== 'open') {
10130
10131
  return null;
10131
10132
  }
10132
10133
  const playlistEnd = details.edge;
@@ -10147,7 +10148,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10147
10148
  duration: Infinity
10148
10149
  };
10149
10150
  }
10150
- const overrideDuration = (_this$overrides2 = this.overrides) == null ? void 0 : _this$overrides2.duration;
10151
+ const overrideDuration = (_this$overrides2 = this.overrides) == null ? undefined : _this$overrides2.duration;
10151
10152
  if (overrideDuration) {
10152
10153
  return {
10153
10154
  duration: overrideDuration
@@ -10199,7 +10200,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10199
10200
  // 2 tracks is the max (one for audio, one for video). If we've reach this max go ahead and create the buffers.
10200
10201
  if (this.tracksReady) {
10201
10202
  var _this$transferData4;
10202
- const transferredTracks = (_this$transferData4 = this.transferData) == null ? void 0 : _this$transferData4.tracks;
10203
+ const transferredTracks = (_this$transferData4 = this.transferData) == null ? undefined : _this$transferData4.tracks;
10203
10204
  if (transferredTracks && Object.keys(transferredTracks).length) {
10204
10205
  this.attachTransferred();
10205
10206
  } else {
@@ -10325,8 +10326,8 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10325
10326
  }
10326
10327
  get mediaSrc() {
10327
10328
  var _this$media2, _this$media2$querySel;
10328
- const media = ((_this$media2 = this.media) == null ? void 0 : (_this$media2$querySel = _this$media2.querySelector) == null ? void 0 : _this$media2$querySel.call(_this$media2, 'source')) || this.media;
10329
- return media == null ? void 0 : media.src;
10329
+ const media = ((_this$media2 = this.media) == null ? undefined : (_this$media2$querySel = _this$media2.querySelector) == null ? undefined : _this$media2$querySel.call(_this$media2, 'source')) || this.media;
10330
+ return media == null ? undefined : media.src;
10330
10331
  }
10331
10332
  onSBUpdateStart(type) {
10332
10333
  const operation = this.currentOp(type);
@@ -10337,7 +10338,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10337
10338
  }
10338
10339
  onSBUpdateEnd(type) {
10339
10340
  var _this$mediaSource4;
10340
- if (((_this$mediaSource4 = this.mediaSource) == null ? void 0 : _this$mediaSource4.readyState) === 'closed') {
10341
+ if (((_this$mediaSource4 = this.mediaSource) == null ? undefined : _this$mediaSource4.readyState) === 'closed') {
10341
10342
  this.resetBuffer(type);
10342
10343
  return;
10343
10344
  }
@@ -10350,7 +10351,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10350
10351
  }
10351
10352
  onSBUpdateError(type, event) {
10352
10353
  var _this$mediaSource5;
10353
- const error = new Error(`${type} SourceBuffer error. MediaSource readyState: ${(_this$mediaSource5 = this.mediaSource) == null ? void 0 : _this$mediaSource5.readyState}`);
10354
+ const error = new Error(`${type} SourceBuffer error. MediaSource readyState: ${(_this$mediaSource5 = this.mediaSource) == null ? undefined : _this$mediaSource5.readyState}`);
10354
10355
  this.error(`${error}`, event);
10355
10356
  // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error
10356
10357
  // SourceBuffer errors are not necessarily fatal; if so, the HTMLMediaElement will fire an error event
@@ -10375,7 +10376,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10375
10376
  mediaSource
10376
10377
  } = this;
10377
10378
  const track = this.tracks[type];
10378
- const sb = track == null ? void 0 : track.buffer;
10379
+ const sb = track == null ? undefined : track.buffer;
10379
10380
  if (!media || !mediaSource || !sb) {
10380
10381
  this.warn(`Attempting to remove from the ${type} SourceBuffer, but it does not exist`);
10381
10382
  this.shiftAndExecuteNext(type);
@@ -10398,7 +10399,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10398
10399
  // This method must result in an updateend event; if append is not called, onSBUpdateEnd must be called manually
10399
10400
  appendExecutor(data, type) {
10400
10401
  const track = this.tracks[type];
10401
- const sb = track == null ? void 0 : track.buffer;
10402
+ const sb = track == null ? undefined : track.buffer;
10402
10403
  if (!sb) {
10403
10404
  throw new HlsJsTrackRemovedError(`Attempting to append to the ${type} SourceBuffer, but it does not exist`);
10404
10405
  }
@@ -10454,7 +10455,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10454
10455
  stepOperationQueue(bufferNames) {
10455
10456
  bufferNames.forEach(type => {
10456
10457
  var _this$tracks$type5;
10457
- const sb = (_this$tracks$type5 = this.tracks[type]) == null ? void 0 : _this$tracks$type5.buffer;
10458
+ const sb = (_this$tracks$type5 = this.tracks[type]) == null ? undefined : _this$tracks$type5.buffer;
10458
10459
  // Only cycle the queue if the SB is not updating. There's a bug in Chrome which sets the SB updating flag to
10459
10460
  // true when changing the MediaSource duration (https://bugs.chromium.org/p/chromium/issues/detail?id=959359&can=2&q=mediasource%20duration)
10460
10461
  // While this is a workaround, it's probably useful to have around
@@ -10548,14 +10549,14 @@ function sourceBufferNameToIndex(type) {
10548
10549
 
10549
10550
  class CapLevelController {
10550
10551
  constructor(hls) {
10551
- this.hls = void 0;
10552
- this.autoLevelCapping = void 0;
10553
- this.firstLevel = void 0;
10554
- this.media = void 0;
10555
- this.restrictedLevels = void 0;
10556
- this.timer = void 0;
10557
- this.clientRect = void 0;
10558
- this.streamController = void 0;
10552
+ this.hls = undefined;
10553
+ this.autoLevelCapping = undefined;
10554
+ this.firstLevel = undefined;
10555
+ this.media = undefined;
10556
+ this.restrictedLevels = undefined;
10557
+ this.timer = undefined;
10558
+ this.clientRect = undefined;
10559
+ this.streamController = undefined;
10559
10560
  this.hls = hls;
10560
10561
  this.autoLevelCapping = Number.POSITIVE_INFINITY;
10561
10562
  this.firstLevel = -1;
@@ -10783,7 +10784,7 @@ const PATHWAY_PENALTY_DURATION_MS = 300000;
10783
10784
  class ContentSteeringController extends Logger {
10784
10785
  constructor(hls) {
10785
10786
  super('content-steering', hls.logger);
10786
- this.hls = void 0;
10787
+ this.hls = undefined;
10787
10788
  this.loader = null;
10788
10789
  this.uri = null;
10789
10790
  this.pathwayId = '.';
@@ -10902,7 +10903,7 @@ class ContentSteeringController extends Logger {
10902
10903
  const {
10903
10904
  errorAction
10904
10905
  } = data;
10905
- if ((errorAction == null ? void 0 : errorAction.action) === NetworkErrorAction.SendAlternateToPenaltyBox && errorAction.flags === ErrorActionFlags.MoveAllAlternatesMatchingHost) {
10906
+ if ((errorAction == null ? undefined : errorAction.action) === NetworkErrorAction.SendAlternateToPenaltyBox && errorAction.flags === ErrorActionFlags.MoveAllAlternatesMatchingHost) {
10906
10907
  const levels = this.levels;
10907
10908
  let pathwayPriority = this._pathwayPriority;
10908
10909
  let errorPathway = this.pathwayId;
@@ -11100,7 +11101,7 @@ class ContentSteeringController extends Logger {
11100
11101
  onSuccess: (response, stats, context, networkDetails) => {
11101
11102
  this.log(`Loaded steering manifest: "${url}"`);
11102
11103
  const steeringData = response.data;
11103
- if ((steeringData == null ? void 0 : steeringData.VERSION) !== 1) {
11104
+ if ((steeringData == null ? undefined : steeringData.VERSION) !== 1) {
11104
11105
  this.log(`Steering VERSION ${steeringData.VERSION} not supported!`);
11105
11106
  return;
11106
11107
  }
@@ -11144,7 +11145,7 @@ class ContentSteeringController extends Logger {
11144
11145
  let ttl = this.timeToLoad * 1000;
11145
11146
  if (error.code === 429) {
11146
11147
  const loader = this.loader;
11147
- if (typeof (loader == null ? void 0 : loader.getResponseHeader) === 'function') {
11148
+ if (typeof (loader == null ? undefined : loader.getResponseHeader) === 'function') {
11148
11149
  const retryAfter = loader.getResponseHeader('Retry-After');
11149
11150
  if (retryAfter) {
11150
11151
  ttl = parseFloat(retryAfter) * 1000;
@@ -11167,7 +11168,7 @@ class ContentSteeringController extends Logger {
11167
11168
  this.clearTimeout();
11168
11169
  this.reloadTimer = self.setTimeout(() => {
11169
11170
  var _this$hls;
11170
- const media = (_this$hls = this.hls) == null ? void 0 : _this$hls.media;
11171
+ const media = (_this$hls = this.hls) == null ? undefined : _this$hls.media;
11171
11172
  if (media && !media.ended) {
11172
11173
  this.loadSteeringManifest(uri);
11173
11174
  return;
@@ -11201,7 +11202,7 @@ function performUriReplacement(uri, stableId, perOptionKey, uriReplacement) {
11201
11202
  } = uriReplacement;
11202
11203
  let perVariantUri;
11203
11204
  if (stableId) {
11204
- perVariantUri = perOptionUris == null ? void 0 : perOptionUris[stableId];
11205
+ perVariantUri = perOptionUris == null ? undefined : perOptionUris[stableId];
11205
11206
  if (perVariantUri) {
11206
11207
  uri = perVariantUri;
11207
11208
  }
@@ -11222,15 +11223,15 @@ function performUriReplacement(uri, stableId, perOptionKey, uriReplacement) {
11222
11223
 
11223
11224
  class FPSController {
11224
11225
  constructor(hls) {
11225
- this.hls = void 0;
11226
+ this.hls = undefined;
11226
11227
  this.isVideoPlaybackQualityAvailable = false;
11227
- this.timer = void 0;
11228
+ this.timer = undefined;
11228
11229
  this.media = null;
11229
- this.lastTime = void 0;
11230
+ this.lastTime = undefined;
11230
11231
  this.lastDroppedFrames = 0;
11231
11232
  this.lastDecodedFrames = 0;
11232
11233
  // stream controller must be provided as a dependency!
11233
- this.streamController = void 0;
11234
+ this.streamController = undefined;
11234
11235
  this.hls = hls;
11235
11236
  this.registerListeners();
11236
11237
  }
@@ -12437,8 +12438,8 @@ function dummyTrack(type = '', inputTimeScale = 90000) {
12437
12438
 
12438
12439
  class BaseAudioDemuxer {
12439
12440
  constructor() {
12440
- this._audioTrack = void 0;
12441
- this._id3Track = void 0;
12441
+ this._audioTrack = undefined;
12442
+ this._id3Track = undefined;
12442
12443
  this.frameIndex = 0;
12443
12444
  this.cachedData = null;
12444
12445
  this.basePTS = null;
@@ -12730,8 +12731,8 @@ function probe(data, offset) {
12730
12731
  class AACDemuxer extends BaseAudioDemuxer {
12731
12732
  constructor(observer, config) {
12732
12733
  super();
12733
- this.observer = void 0;
12734
- this.config = void 0;
12734
+ this.observer = undefined;
12735
+ this.config = undefined;
12735
12736
  this.observer = observer;
12736
12737
  this.config = config;
12737
12738
  }
@@ -12763,7 +12764,7 @@ class AACDemuxer extends BaseAudioDemuxer {
12763
12764
  // Layer bits (position 14 and 15) in header should be always 0 for ADTS
12764
12765
  // More info https://wiki.multimedia.cx/index.php?title=ADTS
12765
12766
  const id3Data = getId3Data(data, 0);
12766
- let offset = (id3Data == null ? void 0 : id3Data.length) || 0;
12767
+ let offset = (id3Data == null ? undefined : id3Data.length) || 0;
12767
12768
  if (probe(data, offset)) {
12768
12769
  return false;
12769
12770
  }
@@ -12839,7 +12840,7 @@ class MP3Demuxer extends BaseAudioDemuxer {
12839
12840
  // Layer bits (position 14 and 15) in header should be always different from 0 (Layer I or Layer II or Layer III)
12840
12841
  // More info http://www.mp3-tech.org/programmer/frame_header.html
12841
12842
  const id3Data = getId3Data(data, 0);
12842
- let offset = (id3Data == null ? void 0 : id3Data.length) || 0;
12843
+ let offset = (id3Data == null ? undefined : id3Data.length) || 0;
12843
12844
 
12844
12845
  // Check for ac-3|ec-3 sync bytes and return false if present
12845
12846
  if (id3Data && data[offset] === 0x0b && data[offset + 1] === 0x77 && getId3Timestamp(id3Data) !== undefined &&
@@ -12871,11 +12872,11 @@ class MP4Demuxer {
12871
12872
  constructor(observer, config) {
12872
12873
  this.remainderData = null;
12873
12874
  this.timeOffset = 0;
12874
- this.config = void 0;
12875
- this.videoTrack = void 0;
12876
- this.audioTrack = void 0;
12877
- this.id3Track = void 0;
12878
- this.txtTrack = void 0;
12875
+ this.config = undefined;
12876
+ this.videoTrack = undefined;
12877
+ this.audioTrack = undefined;
12878
+ this.id3Track = undefined;
12879
+ this.txtTrack = undefined;
12879
12880
  this.config = config;
12880
12881
  }
12881
12882
  resetTimeStamp() {}
@@ -13021,8 +13022,8 @@ function getEmsgStartTime(emsgInfo, timeOffset) {
13021
13022
 
13022
13023
  class SampleAesDecrypter {
13023
13024
  constructor(observer, config, keyData) {
13024
- this.keyData = void 0;
13025
- this.decrypter = void 0;
13025
+ this.keyData = undefined;
13026
+ this.decrypter = undefined;
13026
13027
  this.keyData = keyData;
13027
13028
  this.decrypter = new Decrypter(config, {
13028
13029
  removePKCS7Padding: false
@@ -13280,10 +13281,10 @@ class BaseVideoParser {
13280
13281
 
13281
13282
  class ExpGolomb {
13282
13283
  constructor(data) {
13283
- this.data = void 0;
13284
- this.bytesAvailable = void 0;
13285
- this.word = void 0;
13286
- this.bitsAvailable = void 0;
13284
+ this.data = undefined;
13285
+ this.bytesAvailable = undefined;
13286
+ this.word = undefined;
13287
+ this.bitsAvailable = undefined;
13287
13288
  this.data = data;
13288
13289
  // the number of bytes left to examine in this.data
13289
13290
  this.bytesAvailable = data.byteLength;
@@ -13498,7 +13499,7 @@ class AvcVideoParser extends BaseVideoParser {
13498
13499
  spsfound = true;
13499
13500
  const sps = unit.data;
13500
13501
  const config = this.readSPS(sps);
13501
- if (!track.sps || track.width !== config.width || track.height !== config.height || ((_track$pixelRatio = track.pixelRatio) == null ? void 0 : _track$pixelRatio[0]) !== config.pixelRatio[0] || ((_track$pixelRatio2 = track.pixelRatio) == null ? void 0 : _track$pixelRatio2[1]) !== config.pixelRatio[1]) {
13502
+ if (!track.sps || track.width !== config.width || track.height !== config.height || ((_track$pixelRatio = track.pixelRatio) == null ? undefined : _track$pixelRatio[0]) !== config.pixelRatio[0] || ((_track$pixelRatio2 = track.pixelRatio) == null ? undefined : _track$pixelRatio2[1]) !== config.pixelRatio[1]) {
13502
13503
  track.width = config.width;
13503
13504
  track.height = config.height;
13504
13505
  track.pixelRatio = config.pixelRatio;
@@ -13744,22 +13745,22 @@ class AvcVideoParser extends BaseVideoParser {
13744
13745
  const PACKET_LENGTH = 188;
13745
13746
  class TSDemuxer {
13746
13747
  constructor(observer, config, typeSupported, logger) {
13747
- this.logger = void 0;
13748
- this.observer = void 0;
13749
- this.config = void 0;
13750
- this.typeSupported = void 0;
13748
+ this.logger = undefined;
13749
+ this.observer = undefined;
13750
+ this.config = undefined;
13751
+ this.typeSupported = undefined;
13751
13752
  this.sampleAes = null;
13752
13753
  this.pmtParsed = false;
13753
- this.audioCodec = void 0;
13754
- this.videoCodec = void 0;
13754
+ this.audioCodec = undefined;
13755
+ this.videoCodec = undefined;
13755
13756
  this._pmtId = -1;
13756
- this._videoTrack = void 0;
13757
- this._audioTrack = void 0;
13758
- this._id3Track = void 0;
13759
- this._txtTrack = void 0;
13757
+ this._videoTrack = undefined;
13758
+ this._audioTrack = undefined;
13759
+ this._id3Track = undefined;
13760
+ this._txtTrack = undefined;
13760
13761
  this.aacOverFlow = null;
13761
13762
  this.remainderData = null;
13762
- this.videoParser = void 0;
13763
+ this.videoParser = undefined;
13763
13764
  this.observer = observer;
13764
13765
  this.config = config;
13765
13766
  this.typeSupported = typeSupported;
@@ -15168,17 +15169,17 @@ class MP4 {
15168
15169
  }
15169
15170
  }
15170
15171
  }
15171
- MP4.types = void 0;
15172
- MP4.HDLR_TYPES = void 0;
15173
- MP4.STTS = void 0;
15174
- MP4.STSC = void 0;
15175
- MP4.STCO = void 0;
15176
- MP4.STSZ = void 0;
15177
- MP4.VMHD = void 0;
15178
- MP4.SMHD = void 0;
15179
- MP4.STSD = void 0;
15180
- MP4.FTYP = void 0;
15181
- MP4.DINF = void 0;
15172
+ MP4.types = undefined;
15173
+ MP4.HDLR_TYPES = undefined;
15174
+ MP4.STTS = undefined;
15175
+ MP4.STSC = undefined;
15176
+ MP4.STCO = undefined;
15177
+ MP4.STSZ = undefined;
15178
+ MP4.VMHD = undefined;
15179
+ MP4.SMHD = undefined;
15180
+ MP4.STSD = undefined;
15181
+ MP4.FTYP = undefined;
15182
+ MP4.DINF = undefined;
15182
15183
 
15183
15184
  const MPEG_TS_CLOCK_FREQ_HZ = 90000;
15184
15185
  function toTimescaleFromBase(baseTime, destScale, srcBase = 1, round = false) {
@@ -15212,10 +15213,10 @@ function createMp4Sample(isKeyframe, duration, size, cts) {
15212
15213
  }
15213
15214
  class MP4Remuxer {
15214
15215
  constructor(observer, config, typeSupported, logger) {
15215
- this.logger = void 0;
15216
- this.observer = void 0;
15217
- this.config = void 0;
15218
- this.typeSupported = void 0;
15216
+ this.logger = undefined;
15217
+ this.observer = undefined;
15218
+ this.config = undefined;
15219
+ this.typeSupported = undefined;
15219
15220
  this.ISGenerated = false;
15220
15221
  this._initPTS = null;
15221
15222
  this._initDTS = null;
@@ -15224,7 +15225,7 @@ class MP4Remuxer {
15224
15225
  this.videoSampleDuration = null;
15225
15226
  this.isAudioContiguous = false;
15226
15227
  this.isVideoContiguous = false;
15227
- this.videoTrackConfig = void 0;
15228
+ this.videoTrackConfig = undefined;
15228
15229
  this.observer = observer;
15229
15230
  this.config = config;
15230
15231
  this.typeSupported = typeSupported;
@@ -15306,7 +15307,7 @@ class MP4Remuxer {
15306
15307
  if (this.ISGenerated) {
15307
15308
  var _videoTrack$pixelRati, _config$pixelRatio, _videoTrack$pixelRati2, _config$pixelRatio2;
15308
15309
  const config = this.videoTrackConfig;
15309
- if (config && (videoTrack.width !== config.width || videoTrack.height !== config.height || ((_videoTrack$pixelRati = videoTrack.pixelRatio) == null ? void 0 : _videoTrack$pixelRati[0]) !== ((_config$pixelRatio = config.pixelRatio) == null ? void 0 : _config$pixelRatio[0]) || ((_videoTrack$pixelRati2 = videoTrack.pixelRatio) == null ? void 0 : _videoTrack$pixelRati2[1]) !== ((_config$pixelRatio2 = config.pixelRatio) == null ? void 0 : _config$pixelRatio2[1])) || !config && enoughVideoSamples || this.nextAudioPts === null && enoughAudioSamples) {
15310
+ if (config && (videoTrack.width !== config.width || videoTrack.height !== config.height || ((_videoTrack$pixelRati = videoTrack.pixelRatio) == null ? undefined : _videoTrack$pixelRati[0]) !== ((_config$pixelRatio = config.pixelRatio) == null ? undefined : _config$pixelRatio[0]) || ((_videoTrack$pixelRati2 = videoTrack.pixelRatio) == null ? undefined : _videoTrack$pixelRati2[1]) !== ((_config$pixelRatio2 = config.pixelRatio) == null ? undefined : _config$pixelRatio2[1])) || !config && enoughVideoSamples || this.nextAudioPts === null && enoughAudioSamples) {
15310
15311
  this.resetInitSegment();
15311
15312
  }
15312
15313
  }
@@ -16056,13 +16057,13 @@ function flushTextTrackUserdataCueSamples(track, timeOffset, initPTS) {
16056
16057
 
16057
16058
  class PassThroughRemuxer {
16058
16059
  constructor(observer, config, typeSupported, logger) {
16059
- this.logger = void 0;
16060
+ this.logger = undefined;
16060
16061
  this.emitInitSegment = false;
16061
- this.audioCodec = void 0;
16062
- this.videoCodec = void 0;
16063
- this.initData = void 0;
16062
+ this.audioCodec = undefined;
16063
+ this.videoCodec = undefined;
16064
+ this.initData = undefined;
16064
16065
  this.initPTS = null;
16065
- this.initTracks = void 0;
16066
+ this.initTracks = undefined;
16066
16067
  this.lastEndTime = null;
16067
16068
  this.logger = logger;
16068
16069
  }
@@ -16234,7 +16235,7 @@ function isInvalidInitPts(initPTS, startDTS, timeOffset, duration) {
16234
16235
  return Math.abs(startTime - timeOffset) > minDuration;
16235
16236
  }
16236
16237
  function getParsedTrackCodec(track, type) {
16237
- const parsedCodec = track == null ? void 0 : track.codec;
16238
+ const parsedCodec = track == null ? undefined : track.codec;
16238
16239
  if (parsedCodec && parsedCodec.length > 4) {
16239
16240
  return parsedCodec;
16240
16241
  }
@@ -16279,18 +16280,18 @@ const muxConfig = [{
16279
16280
  class Transmuxer {
16280
16281
  constructor(observer, typeSupported, config, vendor, id, logger) {
16281
16282
  this.asyncResult = false;
16282
- this.logger = void 0;
16283
- this.observer = void 0;
16284
- this.typeSupported = void 0;
16285
- this.config = void 0;
16286
- this.id = void 0;
16287
- this.demuxer = void 0;
16288
- this.remuxer = void 0;
16289
- this.decrypter = void 0;
16290
- this.probe = void 0;
16283
+ this.logger = undefined;
16284
+ this.observer = undefined;
16285
+ this.typeSupported = undefined;
16286
+ this.config = undefined;
16287
+ this.id = undefined;
16288
+ this.demuxer = undefined;
16289
+ this.remuxer = undefined;
16290
+ this.decrypter = undefined;
16291
+ this.probe = undefined;
16291
16292
  this.decryptionPromise = null;
16292
- this.transmuxConfig = void 0;
16293
- this.currentTransmuxState = void 0;
16293
+ this.transmuxConfig = undefined;
16294
+ this.currentTransmuxState = undefined;
16294
16295
  this.observer = observer;
16295
16296
  this.typeSupported = typeSupported;
16296
16297
  this.config = config;
@@ -16595,7 +16596,7 @@ class Transmuxer {
16595
16596
  }
16596
16597
  function getEncryptionType(data, decryptData) {
16597
16598
  let encryptionType = null;
16598
- if (data.byteLength > 0 && (decryptData == null ? void 0 : decryptData.key) != null && decryptData.iv !== null && decryptData.method != null) {
16599
+ if (data.byteLength > 0 && (decryptData == null ? undefined : decryptData.key) != null && decryptData.iv !== null && decryptData.method != null) {
16599
16600
  encryptionType = decryptData;
16600
16601
  }
16601
16602
  return encryptionType;
@@ -16609,11 +16610,11 @@ function isPromise(p) {
16609
16610
  }
16610
16611
  class TransmuxConfig {
16611
16612
  constructor(audioCodec, videoCodec, initSegmentData, duration, defaultInitPts) {
16612
- this.audioCodec = void 0;
16613
- this.videoCodec = void 0;
16614
- this.initSegmentData = void 0;
16615
- this.duration = void 0;
16616
- this.defaultInitPts = void 0;
16613
+ this.audioCodec = undefined;
16614
+ this.videoCodec = undefined;
16615
+ this.initSegmentData = undefined;
16616
+ this.duration = undefined;
16617
+ this.defaultInitPts = undefined;
16617
16618
  this.audioCodec = audioCodec;
16618
16619
  this.videoCodec = videoCodec;
16619
16620
  this.initSegmentData = initSegmentData;
@@ -16623,12 +16624,12 @@ class TransmuxConfig {
16623
16624
  }
16624
16625
  class TransmuxState {
16625
16626
  constructor(discontinuity, contiguous, accurateTimeOffset, trackSwitch, timeOffset, initSegmentChange) {
16626
- this.discontinuity = void 0;
16627
- this.contiguous = void 0;
16628
- this.accurateTimeOffset = void 0;
16629
- this.trackSwitch = void 0;
16630
- this.timeOffset = void 0;
16631
- this.initSegmentChange = void 0;
16627
+ this.discontinuity = undefined;
16628
+ this.contiguous = undefined;
16629
+ this.accurateTimeOffset = undefined;
16630
+ this.trackSwitch = undefined;
16631
+ this.timeOffset = undefined;
16632
+ this.initSegmentChange = undefined;
16632
16633
  this.discontinuity = discontinuity;
16633
16634
  this.contiguous = contiguous;
16634
16635
  this.accurateTimeOffset = accurateTimeOffset;
@@ -16654,15 +16655,15 @@ function fetchSupported() {
16654
16655
  const BYTERANGE = /(\d+)-(\d+)\/(\d+)/;
16655
16656
  class FetchLoader {
16656
16657
  constructor(config) {
16657
- this.fetchSetup = void 0;
16658
- this.requestTimeout = void 0;
16658
+ this.fetchSetup = undefined;
16659
+ this.requestTimeout = undefined;
16659
16660
  this.request = null;
16660
16661
  this.response = null;
16661
- this.controller = void 0;
16662
+ this.controller = undefined;
16662
16663
  this.context = null;
16663
16664
  this.config = null;
16664
16665
  this.callbacks = null;
16665
- this.stats = void 0;
16666
+ this.stats = undefined;
16666
16667
  this.loader = null;
16667
16668
  this.fetchSetup = config.fetchSetup || getRequest;
16668
16669
  this.controller = new self.AbortController();
@@ -16735,7 +16736,7 @@ class FetchLoader {
16735
16736
  }
16736
16737
  stats.loading.first = first;
16737
16738
  stats.total = getContentLength(response.headers) || stats.total;
16738
- const onProgress = (_this$callbacks2 = this.callbacks) == null ? void 0 : _this$callbacks2.onProgress;
16739
+ const onProgress = (_this$callbacks2 = this.callbacks) == null ? undefined : _this$callbacks2.onProgress;
16739
16740
  if (onProgress && isFiniteNumber(config.highWaterMark)) {
16740
16741
  return this.loadProgressively(response, stats, context, config.highWaterMark, onProgress);
16741
16742
  }
@@ -16763,11 +16764,11 @@ class FetchLoader {
16763
16764
  data: responseData,
16764
16765
  code: response.status
16765
16766
  };
16766
- const onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
16767
+ const onProgress = (_this$callbacks3 = this.callbacks) == null ? undefined : _this$callbacks3.onProgress;
16767
16768
  if (onProgress && !isFiniteNumber(config.highWaterMark)) {
16768
16769
  onProgress(stats, context, responseData, response);
16769
16770
  }
16770
- (_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(loaderResponse, stats, context, response);
16771
+ (_this$callbacks4 = this.callbacks) == null ? undefined : _this$callbacks4.onSuccess(loaderResponse, stats, context, response);
16771
16772
  }).catch(error => {
16772
16773
  var _this$callbacks5;
16773
16774
  self.clearTimeout(this.requestTimeout);
@@ -16778,7 +16779,7 @@ class FetchLoader {
16778
16779
  // when destroying, 'error' itself can be undefined
16779
16780
  const code = !error ? 0 : error.code || 0;
16780
16781
  const text = !error ? null : error.message;
16781
- (_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
16782
+ (_this$callbacks5 = this.callbacks) == null ? undefined : _this$callbacks5.onError({
16782
16783
  code,
16783
16784
  text
16784
16785
  }, context, error ? error.details : null, stats);
@@ -16869,8 +16870,8 @@ function getRequest(context, initParams) {
16869
16870
  class FetchError extends Error {
16870
16871
  constructor(message, code, details) {
16871
16872
  super(message);
16872
- this.code = void 0;
16873
- this.details = void 0;
16873
+ this.code = undefined;
16874
+ this.details = undefined;
16874
16875
  this.code = code;
16875
16876
  this.details = details;
16876
16877
  }
@@ -16879,15 +16880,15 @@ class FetchError extends Error {
16879
16880
  const AGE_HEADER_LINE_REGEX = /^age:\s*[\d.]+\s*$/im;
16880
16881
  class XhrLoader {
16881
16882
  constructor(config) {
16882
- this.xhrSetup = void 0;
16883
- this.requestTimeout = void 0;
16884
- this.retryTimeout = void 0;
16885
- this.retryDelay = void 0;
16883
+ this.xhrSetup = undefined;
16884
+ this.requestTimeout = undefined;
16885
+ this.retryTimeout = undefined;
16886
+ this.retryDelay = undefined;
16886
16887
  this.config = null;
16887
16888
  this.callbacks = null;
16888
16889
  this.context = null;
16889
16890
  this.loader = null;
16890
- this.stats = void 0;
16891
+ this.stats = undefined;
16891
16892
  this.xhrSetup = config ? config.xhrSetup || null : null;
16892
16893
  this.stats = new LoadStats();
16893
16894
  this.retryDelay = 0;
@@ -16958,7 +16959,7 @@ class XhrLoader {
16958
16959
  }).catch(error => {
16959
16960
  var _this$callbacks2;
16960
16961
  // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS
16961
- (_this$callbacks2 = this.callbacks) == null ? void 0 : _this$callbacks2.onError({
16962
+ (_this$callbacks2 = this.callbacks) == null ? undefined : _this$callbacks2.onError({
16962
16963
  code: xhr.status,
16963
16964
  text: error.message
16964
16965
  }, context, xhr, stats);
@@ -17037,7 +17038,7 @@ class XhrLoader {
17037
17038
  const len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
17038
17039
  stats.loaded = stats.total = len;
17039
17040
  stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
17040
- const onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
17041
+ const onProgress = (_this$callbacks3 = this.callbacks) == null ? undefined : _this$callbacks3.onProgress;
17041
17042
  if (onProgress) {
17042
17043
  onProgress(stats, context, data, xhr);
17043
17044
  }
@@ -17046,7 +17047,7 @@ class XhrLoader {
17046
17047
  data: data,
17047
17048
  code: status
17048
17049
  };
17049
- (_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(_response, stats, context, xhr);
17050
+ (_this$callbacks4 = this.callbacks) == null ? undefined : _this$callbacks4.onSuccess(_response, stats, context, xhr);
17050
17051
  return;
17051
17052
  }
17052
17053
  }
@@ -17065,7 +17066,7 @@ class XhrLoader {
17065
17066
  } else {
17066
17067
  var _this$callbacks5;
17067
17068
  logger.error(`${status} while loading ${context.url}`);
17068
- (_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
17069
+ (_this$callbacks5 = this.callbacks) == null ? undefined : _this$callbacks5.onError({
17069
17070
  code: status,
17070
17071
  text: xhr.statusText
17071
17072
  }, context, xhr, stats);
@@ -17081,7 +17082,7 @@ class XhrLoader {
17081
17082
  this.retry(retryConfig);
17082
17083
  } else {
17083
17084
  var _this$context;
17084
- logger.warn(`timeout while loading ${(_this$context = this.context) == null ? void 0 : _this$context.url}`);
17085
+ logger.warn(`timeout while loading ${(_this$context = this.context) == null ? undefined : _this$context.url}`);
17085
17086
  const callbacks = this.callbacks;
17086
17087
  if (callbacks) {
17087
17088
  this.abortInternal();
@@ -17096,7 +17097,7 @@ class XhrLoader {
17096
17097
  } = this;
17097
17098
  this.retryDelay = getRetryDelay(retryConfig, stats.retry);
17098
17099
  stats.retry++;
17099
- logger.warn(`${status ? 'HTTP Status ' + status : 'Timeout'} while loading ${context == null ? void 0 : context.url}, retrying ${stats.retry}/${retryConfig.maxNumRetry} in ${this.retryDelay}ms`);
17100
+ logger.warn(`${status ? 'HTTP Status ' + status : 'Timeout'} while loading ${context == null ? undefined : context.url}, retrying ${stats.retry}/${retryConfig.maxNumRetry} in ${this.retryDelay}ms`);
17100
17101
  // abort and reset internal state
17101
17102
  this.abortInternal();
17102
17103
  this.loader = null;
@@ -17283,6 +17284,7 @@ const hlsDefaultConfig = _objectSpread2(_objectSpread2({
17283
17284
  progressive: false,
17284
17285
  lowLatencyMode: true,
17285
17286
  cmcd: undefined,
17287
+ detectStallWithCurrentTimeMs: 1250,
17286
17288
  enableDateRangeMetadataCues: true,
17287
17289
  enableEmsgMetadataCues: true,
17288
17290
  enableEmsgKLVMetadata: false,
@@ -17655,7 +17657,7 @@ function hexToArrayBuffer(str) {
17655
17657
  }
17656
17658
  class ID3TrackController {
17657
17659
  constructor(hls) {
17658
- this.hls = void 0;
17660
+ this.hls = undefined;
17659
17661
  this.id3Track = null;
17660
17662
  this.media = null;
17661
17663
  this.dateRangeCuesAppended = {};
@@ -17707,7 +17709,7 @@ class ID3TrackController {
17707
17709
  onMediaAttaching(event, data) {
17708
17710
  var _data$overrides;
17709
17711
  this.media = data.media;
17710
- if (((_data$overrides = data.overrides) == null ? void 0 : _data$overrides.cueRemoval) === false) {
17712
+ if (((_data$overrides = data.overrides) == null ? undefined : _data$overrides.cueRemoval) === false) {
17711
17713
  this.removeCues = false;
17712
17714
  }
17713
17715
  }
@@ -17814,7 +17816,7 @@ class ID3TrackController {
17814
17816
  }
17815
17817
  updateId3CueEnds(startTime, type) {
17816
17818
  var _this$id3Track;
17817
- const cues = (_this$id3Track = this.id3Track) == null ? void 0 : _this$id3Track.cues;
17819
+ const cues = (_this$id3Track = this.id3Track) == null ? undefined : _this$id3Track.cues;
17818
17820
  if (cues) {
17819
17821
  for (let i = cues.length; i--;) {
17820
17822
  const cue = cues[i];
@@ -17901,7 +17903,7 @@ class ID3TrackController {
17901
17903
  }
17902
17904
  // Exit if the playlist does not have Date Ranges or does not have Program Date Time
17903
17905
  const lastFragment = details.fragments[details.fragments.length - 1];
17904
- if (ids.length === 0 || !isFiniteNumber(lastFragment == null ? void 0 : lastFragment.programDateTime)) {
17906
+ if (ids.length === 0 || !isFiniteNumber(lastFragment == null ? undefined : lastFragment.programDateTime)) {
17905
17907
  return;
17906
17908
  }
17907
17909
  if (!this.id3Track) {
@@ -17915,8 +17917,8 @@ class ID3TrackController {
17915
17917
 
17916
17918
  // Process DateRanges to determine end-time (known DURATION, END-DATE, or END-ON-NEXT)
17917
17919
  const appendedDateRangeCues = dateRangeCuesAppended[id];
17918
- const cues = (appendedDateRangeCues == null ? void 0 : appendedDateRangeCues.cues) || {};
17919
- let durationKnown = (appendedDateRangeCues == null ? void 0 : appendedDateRangeCues.durationKnown) || false;
17920
+ const cues = (appendedDateRangeCues == null ? undefined : appendedDateRangeCues.cues) || {};
17921
+ let durationKnown = (appendedDateRangeCues == null ? undefined : appendedDateRangeCues.durationKnown) || false;
17920
17922
  let endTime = MAX_CUE_ENDTIME;
17921
17923
  const {
17922
17924
  duration,
@@ -17987,8 +17989,8 @@ class ID3TrackController {
17987
17989
 
17988
17990
  class LatencyController {
17989
17991
  constructor(hls) {
17990
- this.hls = void 0;
17991
- this.config = void 0;
17992
+ this.hls = undefined;
17993
+ this.config = undefined;
17992
17994
  this.media = null;
17993
17995
  this.currentTime = 0;
17994
17996
  this.stallCount = 0;
@@ -18050,7 +18052,7 @@ class LatencyController {
18050
18052
  if (config.liveMaxLatencyDuration !== undefined) {
18051
18053
  return config.liveMaxLatencyDuration;
18052
18054
  }
18053
- const levelDetails = (_this$hls = this.hls) == null ? void 0 : _this$hls.latestLevelDetails;
18055
+ const levelDetails = (_this$hls = this.hls) == null ? undefined : _this$hls.latestLevelDetails;
18054
18056
  return levelDetails ? config.liveMaxLatencyDurationCount * levelDetails.targetduration : 0;
18055
18057
  }
18056
18058
  get targetLatency() {
@@ -18199,12 +18201,12 @@ class LevelController extends BasePlaylistController {
18199
18201
  this._levels = [];
18200
18202
  this._firstLevel = -1;
18201
18203
  this._maxAutoLevel = -1;
18202
- this._startLevel = void 0;
18204
+ this._startLevel = undefined;
18203
18205
  this.currentLevel = null;
18204
18206
  this.currentLevelIndex = -1;
18205
18207
  this.manualLevelIndex = -1;
18206
- this.steering = void 0;
18207
- this.onParsedComplete = void 0;
18208
+ this.steering = undefined;
18209
+ this.onParsedComplete = undefined;
18208
18210
  this.steering = contentSteeringController;
18209
18211
  this._registerListeners();
18210
18212
  }
@@ -18276,7 +18278,7 @@ class LevelController extends BasePlaylistController {
18276
18278
  // Returns empty and set to undefined for 'mp4a.40.34' with fallback to 'audio/mpeg' SourceBuffer
18277
18279
  levelParsed.audioCodec = audioCodec = getCodecCompatibleName(audioCodec, preferManagedMediaSource) || undefined;
18278
18280
  }
18279
- if (((_videoCodec = videoCodec) == null ? void 0 : _videoCodec.indexOf('avc1')) === 0) {
18281
+ if (((_videoCodec = videoCodec) == null ? undefined : _videoCodec.indexOf('avc1')) === 0) {
18280
18282
  videoCodec = levelParsed.videoCodec = convertAVC1ToAVCOTI(videoCodec);
18281
18283
  }
18282
18284
 
@@ -18447,7 +18449,7 @@ class LevelController extends BasePlaylistController {
18447
18449
  const bandwidthEstimate = this.hls.bandwidthEstimate;
18448
18450
  this.log(`manifest loaded, ${levels.length} level(s) found, first bitrate: ${firstLevelBitrate}`);
18449
18451
  // Update default bwe to first variant bitrate as long it has not been configured or set
18450
- if (((_this$hls$userConfig = this.hls.userConfig) == null ? void 0 : _this$hls$userConfig.abrEwmaDefaultEstimate) === undefined) {
18452
+ if (((_this$hls$userConfig = this.hls.userConfig) == null ? undefined : _this$hls$userConfig.abrEwmaDefaultEstimate) === undefined) {
18451
18453
  const startingBwEstimate = Math.min(firstLevelBitrate, this.hls.config.abrEwmaDefaultEstimateMax);
18452
18454
  if (startingBwEstimate > bandwidthEstimate && bandwidthEstimate === this.hls.abrEwmaDefaultEstimate) {
18453
18455
  this.hls.bandwidthEstimate = startingBwEstimate;
@@ -18548,7 +18550,7 @@ class LevelController extends BasePlaylistController {
18548
18550
  const levelDetails = level.details;
18549
18551
  if (!levelDetails || levelDetails.live) {
18550
18552
  // level not retrieved yet, or live playlist we need to (re)load it
18551
- const hlsUrlParameters = this.switchParams(level.uri, lastLevel == null ? void 0 : lastLevel.details, levelDetails);
18553
+ const hlsUrlParameters = this.switchParams(level.uri, lastLevel == null ? undefined : lastLevel.details, levelDetails);
18552
18554
  this.loadPlaylist(hlsUrlParameters);
18553
18555
  }
18554
18556
  }
@@ -18673,8 +18675,8 @@ class LevelController extends BasePlaylistController {
18673
18675
  const currentLevelIndex = this.currentLevelIndex;
18674
18676
  const pathwayId = currentLevel.attrs['PATHWAY-ID'];
18675
18677
  const details = currentLevel.details;
18676
- const age = details == null ? void 0 : details.age;
18677
- this.log(`Loading level index ${currentLevelIndex}${(hlsUrlParameters == null ? void 0 : hlsUrlParameters.msn) !== undefined ? ' at sn ' + hlsUrlParameters.msn + ' part ' + hlsUrlParameters.part : ''}${pathwayId ? ' Pathway ' + pathwayId : ''}${age && details.live ? ' age ' + age.toFixed(1) + (details.type ? ' ' + details.type || '' : '') : ''} ${url}`);
18678
+ const age = details == null ? undefined : details.age;
18679
+ this.log(`Loading level index ${currentLevelIndex}${(hlsUrlParameters == null ? undefined : hlsUrlParameters.msn) !== undefined ? ' at sn ' + hlsUrlParameters.msn + ' part ' + hlsUrlParameters.part : ''}${pathwayId ? ' Pathway ' + pathwayId : ''}${age && details.live ? ' age ' + age.toFixed(1) + (details.type ? ' ' + details.type || '' : '') : ''} ${url}`);
18678
18680
  this.hls.trigger(Events.LEVEL_LOADING, {
18679
18681
  url,
18680
18682
  level: currentLevelIndex,
@@ -18768,32 +18770,28 @@ function assignTrackIdsByGroup(tracks) {
18768
18770
  });
18769
18771
  }
18770
18772
 
18771
- const STALL_MINIMUM_DURATION_MS = 250;
18772
18773
  const MAX_START_GAP_JUMP = 2.0;
18773
18774
  const SKIP_BUFFER_HOLE_STEP_SECONDS = 0.1;
18774
18775
  const SKIP_BUFFER_RANGE_START = 0.05;
18775
18776
  class GapController extends Logger {
18776
- constructor(config, media, fragmentTracker, hls) {
18777
+ constructor(media, fragmentTracker, hls) {
18777
18778
  super('gap-controller', hls.logger);
18778
- this.config = void 0;
18779
18779
  this.media = null;
18780
- this.fragmentTracker = void 0;
18781
- this.hls = void 0;
18780
+ this.fragmentTracker = null;
18781
+ this.hls = null;
18782
18782
  this.nudgeRetry = 0;
18783
18783
  this.stallReported = false;
18784
18784
  this.stalled = null;
18785
18785
  this.moved = false;
18786
18786
  this.seeking = false;
18787
18787
  this.ended = 0;
18788
- this.config = config;
18788
+ this.waiting = 0;
18789
18789
  this.media = media;
18790
18790
  this.fragmentTracker = fragmentTracker;
18791
18791
  this.hls = hls;
18792
18792
  }
18793
18793
  destroy() {
18794
- this.media = null;
18795
- // @ts-ignore
18796
- this.hls = this.fragmentTracker = null;
18794
+ this.media = this.hls = this.fragmentTracker = null;
18797
18795
  }
18798
18796
 
18799
18797
  /**
@@ -18803,12 +18801,12 @@ class GapController extends Logger {
18803
18801
  * @param lastCurrentTime - Previously read playhead position
18804
18802
  */
18805
18803
  poll(lastCurrentTime, activeFrag, levelDetails, state) {
18804
+ var _this$hls;
18806
18805
  const {
18807
- config,
18808
18806
  media,
18809
18807
  stalled
18810
18808
  } = this;
18811
- if (media === null) {
18809
+ if (!media) {
18812
18810
  return;
18813
18811
  }
18814
18812
  const {
@@ -18828,43 +18826,45 @@ class GapController extends Logger {
18828
18826
  if (!seeking) {
18829
18827
  this.nudgeRetry = 0;
18830
18828
  }
18831
- if (stalled !== null) {
18832
- // The playhead is now moving, but was previously stalled
18833
- if (this.stallReported) {
18834
- const _stalledDuration = self.performance.now() - stalled;
18835
- this.warn(`playback not stuck anymore @${currentTime}, after ${Math.round(_stalledDuration)}ms`);
18836
- this.stallReported = false;
18837
- }
18838
- this.stalled = null;
18829
+ if (this.waiting === 0) {
18830
+ this.stallResolved(currentTime);
18839
18831
  }
18840
18832
  return;
18841
18833
  }
18842
18834
 
18843
18835
  // Clear stalled state when beginning or finishing seeking so that we don't report stalls coming out of a seek
18844
18836
  if (beginSeek || seeked) {
18845
- this.stalled = null;
18837
+ if (seeked) {
18838
+ this.stallResolved(currentTime);
18839
+ }
18846
18840
  return;
18847
18841
  }
18848
18842
 
18849
18843
  // The playhead should not be moving
18850
- if (media.paused && !seeking || media.ended || media.playbackRate === 0 || !BufferHelper.getBuffered(media).length) {
18844
+ if (media.paused && !seeking || media.ended || media.playbackRate === 0) {
18845
+ this.nudgeRetry = 0;
18846
+ this.stallResolved(currentTime);
18851
18847
  // Fire MEDIA_ENDED to workaround event not being dispatched by browser
18852
- if (!this.ended && media.ended) {
18848
+ if (!this.ended && media.ended && this.hls) {
18853
18849
  this.ended = currentTime || 1;
18854
18850
  this.hls.trigger(Events.MEDIA_ENDED, {
18855
18851
  stalled: false
18856
18852
  });
18857
18853
  }
18854
+ return;
18855
+ }
18856
+ if (!BufferHelper.getBuffered(media).length) {
18858
18857
  this.nudgeRetry = 0;
18859
18858
  return;
18860
18859
  }
18861
18860
  const bufferInfo = BufferHelper.bufferInfo(media, currentTime, 0);
18862
18861
  const nextStart = bufferInfo.nextStart || 0;
18863
- if (seeking) {
18862
+ const fragmentTracker = this.fragmentTracker;
18863
+ if (seeking && fragmentTracker) {
18864
18864
  // Waiting for seeking in a buffered range to complete
18865
18865
  const hasEnoughBuffer = bufferInfo.len > MAX_START_GAP_JUMP;
18866
18866
  // Next buffered range is too far ahead to jump to while still seeking
18867
- const noBufferGap = !nextStart || activeFrag && activeFrag.start <= currentTime || nextStart - currentTime > MAX_START_GAP_JUMP && !this.fragmentTracker.getPartialFragment(currentTime);
18867
+ const noBufferGap = !nextStart || activeFrag && activeFrag.start <= currentTime || nextStart - currentTime > MAX_START_GAP_JUMP && !fragmentTracker.getPartialFragment(currentTime);
18868
18868
  if (hasEnoughBuffer || noBufferGap) {
18869
18869
  return;
18870
18870
  }
@@ -18874,7 +18874,7 @@ class GapController extends Logger {
18874
18874
 
18875
18875
  // Skip start gaps if we haven't played, but the last poll detected the start of a stall
18876
18876
  // The addition poll gives the browser a chance to jump the gap for us
18877
- if (!this.moved && this.stalled !== null) {
18877
+ if (!this.moved && this.stalled !== null && fragmentTracker) {
18878
18878
  // There is no playable buffer (seeked, waiting for buffer)
18879
18879
  const isBuffered = bufferInfo.len > 0;
18880
18880
  if (!isBuffered && !nextStart) {
@@ -18888,7 +18888,7 @@ class GapController extends Logger {
18888
18888
  // that begins over 1 target duration after the video start position.
18889
18889
  const isLive = !!(levelDetails != null && levelDetails.live);
18890
18890
  const maxStartGapJump = isLive ? levelDetails.targetduration * 2 : MAX_START_GAP_JUMP;
18891
- const partialOrGap = this.fragmentTracker.getPartialFragment(currentTime);
18891
+ const partialOrGap = fragmentTracker.getPartialFragment(currentTime);
18892
18892
  if (startJump > 0 && (startJump <= maxStartGapJump || partialOrGap)) {
18893
18893
  if (!media.paused) {
18894
18894
  this._trySkipBufferHole(partialOrGap);
@@ -18898,16 +18898,27 @@ class GapController extends Logger {
18898
18898
  }
18899
18899
 
18900
18900
  // Start tracking stall time
18901
+ const config = (_this$hls = this.hls) == null ? undefined : _this$hls.config;
18902
+ if (!config) {
18903
+ return;
18904
+ }
18905
+ const detectStallWithCurrentTimeMs = config.detectStallWithCurrentTimeMs;
18901
18906
  const tnow = self.performance.now();
18907
+ const tWaiting = this.waiting;
18902
18908
  if (stalled === null) {
18903
- this.stalled = tnow;
18909
+ // Use time of recent "waiting" event
18910
+ if (tWaiting > 0 && tnow - tWaiting < detectStallWithCurrentTimeMs) {
18911
+ this.stalled = tWaiting;
18912
+ } else {
18913
+ this.stalled = tnow;
18914
+ }
18904
18915
  return;
18905
18916
  }
18906
18917
  const stalledDuration = tnow - stalled;
18907
- if (!seeking && stalledDuration >= STALL_MINIMUM_DURATION_MS) {
18918
+ if (!seeking && (stalledDuration >= detectStallWithCurrentTimeMs || tWaiting) && this.hls) {
18908
18919
  // Dispatch MEDIA_ENDED when media.ended/ended event is not signalled at end of stream
18909
- if (state === State.ENDED && !(levelDetails != null && levelDetails.live) && Math.abs(currentTime - ((levelDetails == null ? void 0 : levelDetails.edge) || 0)) < 1) {
18910
- if (stalledDuration < 1000 || this.ended) {
18920
+ if (state === State.ENDED && !(levelDetails != null && levelDetails.live) && Math.abs(currentTime - ((levelDetails == null ? undefined : levelDetails.edge) || 0)) < 1) {
18921
+ if (this.ended) {
18911
18922
  return;
18912
18923
  }
18913
18924
  this.ended = currentTime || 1;
@@ -18918,13 +18929,27 @@ class GapController extends Logger {
18918
18929
  }
18919
18930
  // Report stalling after trying to fix
18920
18931
  this._reportStall(bufferInfo);
18921
- if (!this.media) {
18932
+ if (!this.media || !this.hls) {
18922
18933
  return;
18923
18934
  }
18924
18935
  }
18925
18936
  const bufferedWithHoles = BufferHelper.bufferInfo(media, currentTime, config.maxBufferHole);
18926
18937
  this._tryFixBufferStall(bufferedWithHoles, stalledDuration);
18927
18938
  }
18939
+ stallResolved(currentTime) {
18940
+ const stalled = this.stalled;
18941
+ if (stalled && this.hls) {
18942
+ this.stalled = null;
18943
+ // The playhead is now moving, but was previously stalled
18944
+ if (this.stallReported) {
18945
+ const stalledDuration = self.performance.now() - stalled;
18946
+ this.warn(`playback not stuck anymore @${currentTime}, after ${Math.round(stalledDuration)}ms`);
18947
+ this.stallReported = false;
18948
+ this.waiting = 0;
18949
+ this.hls.trigger(Events.STALL_RESOLVED, {});
18950
+ }
18951
+ }
18952
+ }
18928
18953
 
18929
18954
  /**
18930
18955
  * Detects and attempts to fix known buffer stalling issues.
@@ -18933,12 +18958,13 @@ class GapController extends Logger {
18933
18958
  * @private
18934
18959
  */
18935
18960
  _tryFixBufferStall(bufferInfo, stalledDurationMs) {
18961
+ var _this$hls2;
18936
18962
  const {
18937
- config,
18938
18963
  fragmentTracker,
18939
18964
  media
18940
18965
  } = this;
18941
- if (media === null) {
18966
+ const config = (_this$hls2 = this.hls) == null ? undefined : _this$hls2.config;
18967
+ if (!media || !fragmentTracker || !config) {
18942
18968
  return;
18943
18969
  }
18944
18970
  const currentTime = media.currentTime;
@@ -18958,13 +18984,12 @@ class GapController extends Logger {
18958
18984
  // we may just have to "nudge" the playlist as the browser decoding/rendering engine
18959
18985
  // needs to cross some sort of threshold covering all source-buffers content
18960
18986
  // to start playing properly.
18961
- if ((bufferInfo.len > config.maxBufferHole || bufferInfo.nextStart && bufferInfo.nextStart - currentTime < config.maxBufferHole) && stalledDurationMs > config.highBufferWatchdogPeriod * 1000) {
18987
+ const bufferedRanges = bufferInfo.buffered;
18988
+ if ((bufferedRanges && bufferedRanges.length > 1 && bufferInfo.len > config.maxBufferHole || bufferInfo.nextStart && bufferInfo.nextStart - currentTime < config.maxBufferHole) && stalledDurationMs > config.highBufferWatchdogPeriod * 1000) {
18962
18989
  this.warn('Trying to nudge playhead over buffer-hole');
18963
18990
  // Try to nudge currentTime over a buffer hole if we've been stalling for the configured amount of seconds
18964
18991
  // We only try to jump the hole if it's under the configured size
18965
- // Reset stalled so to rearm watchdog timer
18966
- this.stalled = null;
18967
- this._tryNudgeBuffer();
18992
+ this._tryNudgeBuffer(bufferInfo);
18968
18993
  }
18969
18994
  }
18970
18995
 
@@ -18977,9 +19002,10 @@ class GapController extends Logger {
18977
19002
  const {
18978
19003
  hls,
18979
19004
  media,
18980
- stallReported
19005
+ stallReported,
19006
+ stalled
18981
19007
  } = this;
18982
- if (!stallReported && media) {
19008
+ if (!stallReported && stalled !== null && media && hls) {
18983
19009
  // Report stalled error once
18984
19010
  this.stallReported = true;
18985
19011
  const error = new Error(`Playback stalling at @${media.currentTime} due to low buffer (${JSON.stringify(bufferInfo)})`);
@@ -18989,7 +19015,11 @@ class GapController extends Logger {
18989
19015
  details: ErrorDetails.BUFFER_STALLED_ERROR,
18990
19016
  fatal: false,
18991
19017
  error,
18992
- buffer: bufferInfo.len
19018
+ buffer: bufferInfo.len,
19019
+ bufferInfo,
19020
+ stalled: {
19021
+ start: stalled
19022
+ }
18993
19023
  });
18994
19024
  }
18995
19025
  }
@@ -19000,12 +19030,13 @@ class GapController extends Logger {
19000
19030
  * @private
19001
19031
  */
19002
19032
  _trySkipBufferHole(partial) {
19033
+ var _this$hls3;
19003
19034
  const {
19004
- config,
19005
- hls,
19035
+ fragmentTracker,
19006
19036
  media
19007
19037
  } = this;
19008
- if (media === null) {
19038
+ const config = (_this$hls3 = this.hls) == null ? undefined : _this$hls3.config;
19039
+ if (!media || !fragmentTracker || !config) {
19009
19040
  return 0;
19010
19041
  }
19011
19042
 
@@ -19020,9 +19051,6 @@ class GapController extends Logger {
19020
19051
  if (gapLength > 0 && (bufferStarved || waiting)) {
19021
19052
  // Only allow large gaps to be skipped if it is a start gap, or all fragments in skip range are partial
19022
19053
  if (gapLength > config.maxBufferHole) {
19023
- const {
19024
- fragmentTracker
19025
- } = this;
19026
19054
  let startGap = false;
19027
19055
  if (currentTime === 0) {
19028
19056
  const startFrag = fragmentTracker.getAppendedFrag(0, PlaylistLevelType.MAIN);
@@ -19053,17 +19081,18 @@ class GapController extends Logger {
19053
19081
  const targetTime = Math.max(startTime + SKIP_BUFFER_RANGE_START, currentTime + SKIP_BUFFER_HOLE_STEP_SECONDS);
19054
19082
  this.warn(`skipping hole, adjusting currentTime from ${currentTime} to ${targetTime}`);
19055
19083
  this.moved = true;
19056
- this.stalled = null;
19057
19084
  media.currentTime = targetTime;
19058
- if (partial && !partial.gap) {
19085
+ if (partial && !partial.gap && this.hls) {
19059
19086
  const error = new Error(`fragment loaded with buffer holes, seeking from ${currentTime} to ${targetTime}`);
19060
- hls.trigger(Events.ERROR, {
19087
+ this.hls.trigger(Events.ERROR, {
19061
19088
  type: ErrorTypes.MEDIA_ERROR,
19062
19089
  details: ErrorDetails.BUFFER_SEEK_OVER_HOLE,
19063
19090
  fatal: false,
19064
19091
  error,
19065
19092
  reason: error.message,
19066
- frag: partial
19093
+ frag: partial,
19094
+ buffer: bufferInfo.len,
19095
+ bufferInfo
19067
19096
  });
19068
19097
  }
19069
19098
  return targetTime;
@@ -19076,15 +19105,15 @@ class GapController extends Logger {
19076
19105
  * Attempts to fix buffer stalls by advancing the mediaElement's current time by a small amount.
19077
19106
  * @private
19078
19107
  */
19079
- _tryNudgeBuffer() {
19108
+ _tryNudgeBuffer(bufferInfo) {
19080
19109
  const {
19081
- config,
19082
19110
  hls,
19083
19111
  media,
19084
19112
  nudgeRetry
19085
19113
  } = this;
19086
- if (media === null) {
19087
- return;
19114
+ const config = hls == null ? undefined : hls.config;
19115
+ if (!media || !config) {
19116
+ return 0;
19088
19117
  }
19089
19118
  const currentTime = media.currentTime;
19090
19119
  this.nudgeRetry++;
@@ -19098,7 +19127,9 @@ class GapController extends Logger {
19098
19127
  type: ErrorTypes.MEDIA_ERROR,
19099
19128
  details: ErrorDetails.BUFFER_NUDGE_ON_STALL,
19100
19129
  error,
19101
- fatal: false
19130
+ fatal: false,
19131
+ buffer: bufferInfo.len,
19132
+ bufferInfo
19102
19133
  });
19103
19134
  } else {
19104
19135
  const error = new Error(`Playhead still not moving while enough data buffered @${currentTime} after ${config.nudgeMaxRetry} nudges`);
@@ -19107,13 +19138,15 @@ class GapController extends Logger {
19107
19138
  type: ErrorTypes.MEDIA_ERROR,
19108
19139
  details: ErrorDetails.BUFFER_STALLED_ERROR,
19109
19140
  error,
19110
- fatal: true
19141
+ fatal: true,
19142
+ buffer: bufferInfo.len,
19143
+ bufferInfo
19111
19144
  });
19112
19145
  }
19113
19146
  }
19114
19147
  }
19115
19148
 
19116
- const version = "1.6.0-beta.2.0.canary.10880";
19149
+ const version = "1.6.0-beta.2.0.canary.10883";
19117
19150
 
19118
19151
  // ensure the worker ends up in the bundle
19119
19152
  // If the worker should not be included this gets aliased to empty.js
@@ -19179,17 +19212,17 @@ let transmuxerInstanceCount = 0;
19179
19212
  class TransmuxerInterface {
19180
19213
  constructor(_hls, id, onTransmuxComplete, onFlush) {
19181
19214
  this.error = null;
19182
- this.hls = void 0;
19183
- this.id = void 0;
19215
+ this.hls = undefined;
19216
+ this.id = undefined;
19184
19217
  this.instanceNo = transmuxerInstanceCount++;
19185
- this.observer = void 0;
19218
+ this.observer = undefined;
19186
19219
  this.frag = null;
19187
19220
  this.part = null;
19188
- this.useWorker = void 0;
19221
+ this.useWorker = undefined;
19189
19222
  this.workerContext = null;
19190
19223
  this.transmuxer = null;
19191
- this.onTransmuxComplete = void 0;
19192
- this.onFlush = void 0;
19224
+ this.onTransmuxComplete = undefined;
19225
+ this.onFlush = undefined;
19193
19226
  this.onWorkerMessage = event => {
19194
19227
  const data = event.data;
19195
19228
  const hls = this.hls;
@@ -19200,7 +19233,7 @@ class TransmuxerInterface {
19200
19233
  case 'init':
19201
19234
  {
19202
19235
  var _this$workerContext;
19203
- const objectURL = (_this$workerContext = this.workerContext) == null ? void 0 : _this$workerContext.objectURL;
19236
+ const objectURL = (_this$workerContext = this.workerContext) == null ? undefined : _this$workerContext.objectURL;
19204
19237
  if (objectURL) {
19205
19238
  // revoke the Object URL that was used to create transmuxer worker, so as not to leak it
19206
19239
  self.URL.revokeObjectURL(objectURL);
@@ -19377,7 +19410,7 @@ class TransmuxerInterface {
19377
19410
  const trackSwitch = !(lastFrag && chunkMeta.level === lastFrag.level);
19378
19411
  const snDiff = lastFrag ? chunkMeta.sn - lastFrag.sn : -1;
19379
19412
  const partDiff = this.part ? chunkMeta.part - this.part.index : -1;
19380
- const progressive = snDiff === 0 && chunkMeta.id > 1 && chunkMeta.id === (lastFrag == null ? void 0 : lastFrag.stats.chunkCount);
19413
+ const progressive = snDiff === 0 && chunkMeta.id > 1 && chunkMeta.id === (lastFrag == null ? undefined : lastFrag.stats.chunkCount);
19381
19414
  const contiguous = !trackSwitch && (snDiff === 1 || snDiff === 0 && (partDiff === 1 || progressive && partDiff <= 0));
19382
19415
  const now = self.performance.now();
19383
19416
  if (trackSwitch || snDiff || frag.stats.parsing.start === 0) {
@@ -19386,7 +19419,7 @@ class TransmuxerInterface {
19386
19419
  if (part && (partDiff || !contiguous)) {
19387
19420
  part.stats.parsing.start = now;
19388
19421
  }
19389
- const initSegmentChange = !(lastFrag && ((_frag$initSegment = frag.initSegment) == null ? void 0 : _frag$initSegment.url) === ((_lastFrag$initSegment = lastFrag.initSegment) == null ? void 0 : _lastFrag$initSegment.url));
19422
+ const initSegmentChange = !(lastFrag && ((_frag$initSegment = frag.initSegment) == null ? undefined : _frag$initSegment.url) === ((_lastFrag$initSegment = lastFrag.initSegment) == null ? undefined : _lastFrag$initSegment.url));
19390
19423
  const state = new TransmuxState(discontinuity, contiguous, accurateTimeOffset, trackSwitch, timeOffset, initSegmentChange);
19391
19424
  if (!contiguous || discontinuity || initSegmentChange) {
19392
19425
  this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${frag.type} sn: ${chunkMeta.sn}${chunkMeta.part > -1 ? ' part: ' + chunkMeta.part : ''} ${this.id === PlaylistLevelType.MAIN ? 'level' : 'track'}: ${chunkMeta.level} id: ${chunkMeta.id}
@@ -19514,12 +19547,12 @@ function isSupported() {
19514
19547
  return false;
19515
19548
  }
19516
19549
  const mediaSource = getMediaSource();
19517
- return typeof (mediaSource == null ? void 0 : mediaSource.isTypeSupported) === 'function' && (['avc1.42E01E,mp4a.40.2', 'av01.0.01M.08', 'vp09.00.50.08'].some(codecsForVideoContainer => mediaSource.isTypeSupported(mimeTypeForCodec(codecsForVideoContainer, 'video'))) || ['mp4a.40.2', 'fLaC'].some(codecForAudioContainer => mediaSource.isTypeSupported(mimeTypeForCodec(codecForAudioContainer, 'audio'))));
19550
+ return typeof (mediaSource == null ? undefined : mediaSource.isTypeSupported) === 'function' && (['avc1.42E01E,mp4a.40.2', 'av01.0.01M.08', 'vp09.00.50.08'].some(codecsForVideoContainer => mediaSource.isTypeSupported(mimeTypeForCodec(codecsForVideoContainer, 'video'))) || ['mp4a.40.2', 'fLaC'].some(codecForAudioContainer => mediaSource.isTypeSupported(mimeTypeForCodec(codecForAudioContainer, 'audio'))));
19518
19551
  }
19519
19552
  function changeTypeSupported() {
19520
19553
  var _sourceBuffer$prototy;
19521
19554
  const sourceBuffer = getSourceBuffer();
19522
- return typeof (sourceBuffer == null ? void 0 : (_sourceBuffer$prototy = sourceBuffer.prototype) == null ? void 0 : _sourceBuffer$prototy.changeType) === 'function';
19555
+ return typeof (sourceBuffer == null ? undefined : (_sourceBuffer$prototy = sourceBuffer.prototype) == null ? undefined : _sourceBuffer$prototy.changeType) === 'function';
19523
19556
  }
19524
19557
 
19525
19558
  const TICK_INTERVAL = 100; // how often to tick in ms
@@ -19540,11 +19573,18 @@ class StreamController extends BaseStreamController {
19540
19573
  this.backtrackFragment = null;
19541
19574
  this.audioCodecSwitch = false;
19542
19575
  this.videoBuffer = null;
19576
+ this.onMediaWaiting = () => {
19577
+ const gapController = this.gapController;
19578
+ if (gapController) {
19579
+ gapController.waiting = self.performance.now();
19580
+ }
19581
+ };
19543
19582
  this.onMediaPlaying = () => {
19544
19583
  // tick to speed up FRAG_CHANGED triggering
19545
19584
  const gapController = this.gapController;
19546
19585
  if (gapController) {
19547
19586
  gapController.ended = 0;
19587
+ gapController.waiting = 0;
19548
19588
  }
19549
19589
  this.tick();
19550
19590
  };
@@ -19600,7 +19640,7 @@ class StreamController extends BaseStreamController {
19600
19640
  }
19601
19641
  onHandlerDestroying() {
19602
19642
  // @ts-ignore
19603
- this.onMediaPlaying = this.onMediaSeeked = null;
19643
+ this.onMediaPlaying = this.onMediaSeeked = this.onMediaWaiting = null;
19604
19644
  this.unregisterListeners();
19605
19645
  super.onHandlerDestroying();
19606
19646
  }
@@ -19657,8 +19697,8 @@ class StreamController extends BaseStreamController {
19657
19697
  levels,
19658
19698
  level
19659
19699
  } = this;
19660
- const currentLevel = levels == null ? void 0 : levels[level];
19661
- const details = currentLevel == null ? void 0 : currentLevel.details;
19700
+ const currentLevel = levels == null ? undefined : levels[level];
19701
+ const details = currentLevel == null ? undefined : currentLevel.details;
19662
19702
  if (details && (!details.live || this.levelLastLoaded === currentLevel && !this.waitForLive(currentLevel))) {
19663
19703
  if (this.waitForCdnTuneIn(details)) {
19664
19704
  break;
@@ -19682,7 +19722,7 @@ class StreamController extends BaseStreamController {
19682
19722
  levels,
19683
19723
  level
19684
19724
  } = this;
19685
- const currentLevel = levels == null ? void 0 : levels[level];
19725
+ const currentLevel = levels == null ? undefined : levels[level];
19686
19726
  this.resetStartWhenNotLoaded(currentLevel || null);
19687
19727
  this.state = State.IDLE;
19688
19728
  }
@@ -19931,9 +19971,11 @@ class StreamController extends BaseStreamController {
19931
19971
  const media = data.media;
19932
19972
  media.removeEventListener('playing', this.onMediaPlaying);
19933
19973
  media.removeEventListener('seeked', this.onMediaSeeked);
19974
+ media.removeEventListener('waiting', this.onMediaWaiting);
19934
19975
  media.addEventListener('playing', this.onMediaPlaying);
19935
19976
  media.addEventListener('seeked', this.onMediaSeeked);
19936
- this.gapController = new GapController(this.config, media, this.fragmentTracker, this.hls);
19977
+ media.addEventListener('waiting', this.onMediaWaiting);
19978
+ this.gapController = new GapController(media, this.fragmentTracker, this.hls);
19937
19979
  }
19938
19980
  onMediaDetaching(event, data) {
19939
19981
  const {
@@ -19942,6 +19984,7 @@ class StreamController extends BaseStreamController {
19942
19984
  if (media) {
19943
19985
  media.removeEventListener('playing', this.onMediaPlaying);
19944
19986
  media.removeEventListener('seeked', this.onMediaSeeked);
19987
+ media.removeEventListener('waiting', this.onMediaWaiting);
19945
19988
  }
19946
19989
  this.videoBuffer = null;
19947
19990
  this.fragPlaying = null;
@@ -19963,7 +20006,7 @@ class StreamController extends BaseStreamController {
19963
20006
  if (gapController.ended) {
19964
20007
  return;
19965
20008
  }
19966
- gapController.ended = ((_this$media2 = this.media) == null ? void 0 : _this$media2.currentTime) || 1;
20009
+ gapController.ended = ((_this$media2 = this.media) == null ? undefined : _this$media2.currentTime) || 1;
19967
20010
  }
19968
20011
  this.hls.trigger(Events.MEDIA_ENDED, {
19969
20012
  stalled: false
@@ -20038,7 +20081,7 @@ class StreamController extends BaseStreamController {
20038
20081
  if (newDetails.deltaUpdateFailed) {
20039
20082
  return;
20040
20083
  }
20041
- sliding = this.alignPlaylists(newDetails, curLevel.details, (_this$levelLastLoaded = this.levelLastLoaded) == null ? void 0 : _this$levelLastLoaded.details);
20084
+ sliding = this.alignPlaylists(newDetails, curLevel.details, (_this$levelLastLoaded = this.levelLastLoaded) == null ? undefined : _this$levelLastLoaded.details);
20042
20085
  }
20043
20086
  // override level info
20044
20087
  curLevel.details = newDetails;
@@ -20124,7 +20167,7 @@ class StreamController extends BaseStreamController {
20124
20167
 
20125
20168
  // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live)
20126
20169
  const accurateTimeOffset = details.PTSKnown || !details.live;
20127
- const initSegmentData = (_frag$initSegment = frag.initSegment) == null ? void 0 : _frag$initSegment.data;
20170
+ const initSegmentData = (_frag$initSegment = frag.initSegment) == null ? undefined : _frag$initSegment.data;
20128
20171
  const audioCodec = this._getAudioCodec(currentLevel);
20129
20172
 
20130
20173
  // transmux the MPEG-TS data to ISO-BMFF segments
@@ -20168,7 +20211,7 @@ class StreamController extends BaseStreamController {
20168
20211
  this.fragmentTracker.removeAllFragments();
20169
20212
  hls.once(Events.BUFFER_FLUSHED, () => {
20170
20213
  var _this$hls;
20171
- (_this$hls = this.hls) == null ? void 0 : _this$hls.trigger(Events.AUDIO_TRACK_SWITCHED, data);
20214
+ (_this$hls = this.hls) == null ? undefined : _this$hls.trigger(Events.AUDIO_TRACK_SWITCHED, data);
20172
20215
  });
20173
20216
  hls.trigger(Events.BUFFER_FLUSHING, {
20174
20217
  startOffset: 0,
@@ -20281,7 +20324,7 @@ class StreamController extends BaseStreamController {
20281
20324
  case ErrorDetails.LEVEL_LOAD_TIMEOUT:
20282
20325
  case ErrorDetails.LEVEL_PARSING_ERROR:
20283
20326
  // in case of non fatal error while loading level, if level controller is not retrying to load level, switch back to IDLE
20284
- if (!data.levelRetry && this.state === State.WAITING_LEVEL && ((_data$context = data.context) == null ? void 0 : _data$context.type) === PlaylistContextType.LEVEL) {
20327
+ if (!data.levelRetry && this.state === State.WAITING_LEVEL && ((_data$context = data.context) == null ? undefined : _data$context.type) === PlaylistContextType.LEVEL) {
20285
20328
  this.state = State.IDLE;
20286
20329
  }
20287
20330
  break;
@@ -20369,7 +20412,7 @@ class StreamController extends BaseStreamController {
20369
20412
  let startPosition = this.startPosition;
20370
20413
  // only adjust currentTime if different from startPosition or if startPosition not buffered
20371
20414
  // at that stage, there should be only one buffered range, as we reach that code after first fragment has been buffered
20372
- if (startPosition >= 0) {
20415
+ if (startPosition >= 0 && currentTime < startPosition) {
20373
20416
  if (media.seeking) {
20374
20417
  this.log(`could not seek to ${startPosition}, already seeking at ${currentTime}`);
20375
20418
  return;
@@ -20379,13 +20422,13 @@ class StreamController extends BaseStreamController {
20379
20422
  const details = this.getLevelDetails();
20380
20423
  const configuredTimelineOffset = this.config.timelineOffset;
20381
20424
  if (configuredTimelineOffset && startPosition) {
20382
- startPosition += (details == null ? void 0 : details.appliedTimelineOffset) || configuredTimelineOffset;
20425
+ startPosition += (details == null ? undefined : details.appliedTimelineOffset) || configuredTimelineOffset;
20383
20426
  }
20384
20427
  const buffered = BufferHelper.getBuffered(media);
20385
20428
  const bufferStart = buffered.length ? buffered.start(0) : 0;
20386
20429
  const delta = bufferStart - startPosition;
20387
20430
  const skipTolerance = Math.max(this.config.maxBufferHole, this.config.maxFragLookUpTolerance);
20388
- if (delta > 0 && (delta < skipTolerance || this.loadingParts && delta < 2 * ((details == null ? void 0 : details.partTarget) || 0))) {
20431
+ if (delta > 0 && (delta < skipTolerance || this.loadingParts && delta < 2 * ((details == null ? undefined : details.partTarget) || 0))) {
20389
20432
  this.log(`adjusting start position by ${delta} to match buffer start`);
20390
20433
  startPosition += delta;
20391
20434
  this.startPosition = startPosition;
@@ -20414,7 +20457,7 @@ class StreamController extends BaseStreamController {
20414
20457
  const {
20415
20458
  hls
20416
20459
  } = this;
20417
- const frag = data == null ? void 0 : data.frag;
20460
+ const frag = data == null ? undefined : data.frag;
20418
20461
  if (!frag || this.fragContextChanged(frag)) {
20419
20462
  return;
20420
20463
  }
@@ -20648,7 +20691,7 @@ class StreamController extends BaseStreamController {
20648
20691
  video.levelCodec = currentLevel.videoCodec;
20649
20692
  video.id = 'main';
20650
20693
  const parsedVideoCodec = video.codec;
20651
- if ((parsedVideoCodec == null ? void 0 : parsedVideoCodec.length) === 4) {
20694
+ if ((parsedVideoCodec == null ? undefined : parsedVideoCodec.length) === 4) {
20652
20695
  // Make up for passthrough-remuxer not being able to parse full codec
20653
20696
  // (logger warning "Unhandled video codec...")
20654
20697
  switch (parsedVideoCodec) {
@@ -20706,7 +20749,7 @@ class StreamController extends BaseStreamController {
20706
20749
  levels,
20707
20750
  level
20708
20751
  } = this;
20709
- const levelInfo = levels == null ? void 0 : levels[level];
20752
+ const levelInfo = levels == null ? undefined : levels[level];
20710
20753
  if (!levelInfo) {
20711
20754
  return this.config.maxBufferLength;
20712
20755
  }
@@ -20775,7 +20818,7 @@ class StreamController extends BaseStreamController {
20775
20818
  if (this.fragPlaying) {
20776
20819
  return this.fragPlaying;
20777
20820
  }
20778
- const currentTime = ((_this$media3 = this.media) == null ? void 0 : _this$media3.currentTime) || this.lastCurrentTime;
20821
+ const currentTime = ((_this$media3 = this.media) == null ? undefined : _this$media3.currentTime) || this.lastCurrentTime;
20779
20822
  if (isFiniteNumber(currentTime)) {
20780
20823
  return this.getAppendedFrag(currentTime);
20781
20824
  }
@@ -20783,7 +20826,7 @@ class StreamController extends BaseStreamController {
20783
20826
  }
20784
20827
  get currentProgramDateTime() {
20785
20828
  var _this$media4;
20786
- const currentTime = ((_this$media4 = this.media) == null ? void 0 : _this$media4.currentTime) || this.lastCurrentTime;
20829
+ const currentTime = ((_this$media4 = this.media) == null ? undefined : _this$media4.currentTime) || this.lastCurrentTime;
20787
20830
  if (isFiniteNumber(currentTime)) {
20788
20831
  const details = this.getLevelDetails();
20789
20832
  const frag = this.currentFrag || (details ? findFragmentByPTS(null, details.fragments, currentTime) : null);
@@ -20818,7 +20861,7 @@ class StreamController extends BaseStreamController {
20818
20861
 
20819
20862
  class KeyLoader {
20820
20863
  constructor(config) {
20821
- this.config = void 0;
20864
+ this.config = undefined;
20822
20865
  this.keyUriToKeyInfo = {};
20823
20866
  this.emeController = null;
20824
20867
  this.config = config;
@@ -20828,7 +20871,7 @@ class KeyLoader {
20828
20871
  const loader = this.keyUriToKeyInfo[uri].loader;
20829
20872
  if (loader) {
20830
20873
  var _loader$context;
20831
- if (type && type !== ((_loader$context = loader.context) == null ? void 0 : _loader$context.frag.type)) {
20874
+ if (type && type !== ((_loader$context = loader.context) == null ? undefined : _loader$context.frag.type)) {
20832
20875
  return;
20833
20876
  }
20834
20877
  loader.abort();
@@ -20917,7 +20960,7 @@ class KeyLoader {
20917
20960
  // Return key load promise as long as it does not have a mediakey session with an unusable key status
20918
20961
  if ((_keyInfo2 = keyInfo) != null && _keyInfo2.keyLoadPromise) {
20919
20962
  var _keyInfo$mediaKeySess;
20920
- switch ((_keyInfo$mediaKeySess = keyInfo.mediaKeySessionContext) == null ? void 0 : _keyInfo$mediaKeySess.keyStatus) {
20963
+ switch ((_keyInfo$mediaKeySess = keyInfo.mediaKeySessionContext) == null ? undefined : _keyInfo$mediaKeySess.keyStatus) {
20921
20964
  case undefined:
20922
20965
  case 'status-pending':
20923
20966
  case 'usable':
@@ -21086,7 +21129,7 @@ function getResponseUrl(response, context) {
21086
21129
  }
21087
21130
  class PlaylistLoader {
21088
21131
  constructor(hls) {
21089
- this.hls = void 0;
21132
+ this.hls = undefined;
21090
21133
  this.loaders = Object.create(null);
21091
21134
  this.variableList = null;
21092
21135
  this.onManifestLoaded = this.checkAutostartLoad;
@@ -21279,7 +21322,7 @@ class PlaylistLoader {
21279
21322
 
21280
21323
  // Override level/track timeout for LL-HLS requests
21281
21324
  // (the default of 10000ms is counter productive to blocking playlist reload requests)
21282
- if (isFiniteNumber((_context$deliveryDire = context.deliveryDirectives) == null ? void 0 : _context$deliveryDire.part)) {
21325
+ if (isFiniteNumber((_context$deliveryDire = context.deliveryDirectives) == null ? undefined : _context$deliveryDire.part)) {
21283
21326
  let levelDetails;
21284
21327
  if (context.type === PlaylistContextType.LEVEL && context.level !== null) {
21285
21328
  levelDetails = this.hls.levels[context.level].details;
@@ -21522,7 +21565,7 @@ class PlaylistLoader {
21522
21565
  stats
21523
21566
  };
21524
21567
  if (response) {
21525
- const url = (networkDetails == null ? void 0 : networkDetails.url) || context.url;
21568
+ const url = (networkDetails == null ? undefined : networkDetails.url) || context.url;
21526
21569
  errorData.response = _objectSpread2({
21527
21570
  url,
21528
21571
  data: undefined
@@ -21671,7 +21714,7 @@ function getMediaDecodingInfoPromise(level, audioTracksByGroup, mediaCapabilitie
21671
21714
  if (!audioGroupId) {
21672
21715
  return;
21673
21716
  }
21674
- (_audioTracksByGroup$g = audioTracksByGroup.groups[audioGroupId]) == null ? void 0 : _audioTracksByGroup$g.tracks.forEach(audioTrack => {
21717
+ (_audioTracksByGroup$g = audioTracksByGroup.groups[audioGroupId]) == null ? undefined : _audioTracksByGroup$g.tracks.forEach(audioTrack => {
21675
21718
  if (audioTrack.groupId === audioGroupId) {
21676
21719
  const channels = audioTrack.channels || '';
21677
21720
  const channelsNumber = parseFloat(channels);
@@ -21793,35 +21836,35 @@ class Hls {
21793
21836
  /**
21794
21837
  * The runtime configuration used by the player. At instantiation this is combination of `hls.userConfig` merged over `Hls.DefaultConfig`.
21795
21838
  */
21796
- this.config = void 0;
21839
+ this.config = undefined;
21797
21840
  /**
21798
21841
  * The configuration object provided on player instantiation.
21799
21842
  */
21800
- this.userConfig = void 0;
21843
+ this.userConfig = undefined;
21801
21844
  /**
21802
21845
  * The logger functions used by this player instance, configured on player instantiation.
21803
21846
  */
21804
- this.logger = void 0;
21805
- this.coreComponents = void 0;
21806
- this.networkControllers = void 0;
21847
+ this.logger = undefined;
21848
+ this.coreComponents = undefined;
21849
+ this.networkControllers = undefined;
21807
21850
  this._emitter = new EventEmitter();
21808
21851
  this._autoLevelCapping = -1;
21809
21852
  this._maxHdcpLevel = null;
21810
- this.abrController = void 0;
21811
- this.bufferController = void 0;
21812
- this.capLevelController = void 0;
21813
- this.latencyController = void 0;
21814
- this.levelController = void 0;
21815
- this.streamController = void 0;
21816
- this.audioTrackController = void 0;
21817
- this.subtitleTrackController = void 0;
21818
- this.interstitialsController = void 0;
21819
- this.emeController = void 0;
21820
- this.cmcdController = void 0;
21853
+ this.abrController = undefined;
21854
+ this.bufferController = undefined;
21855
+ this.capLevelController = undefined;
21856
+ this.latencyController = undefined;
21857
+ this.levelController = undefined;
21858
+ this.streamController = undefined;
21859
+ this.audioTrackController = undefined;
21860
+ this.subtitleTrackController = undefined;
21861
+ this.interstitialsController = undefined;
21862
+ this.emeController = undefined;
21863
+ this.cmcdController = undefined;
21821
21864
  this._media = null;
21822
21865
  this._url = null;
21823
- this._sessionId = void 0;
21824
- this.triggeringException = void 0;
21866
+ this._sessionId = undefined;
21867
+ this.triggeringException = undefined;
21825
21868
  this.started = false;
21826
21869
  const logger = this.logger = enableLogs(userConfig.debug || false, 'Hls instance', userConfig.assetPlayerId);
21827
21870
  const config = this.config = mergeConfig(Hls.DefaultConfig, userConfig, logger);
@@ -22163,7 +22206,7 @@ class Hls {
22163
22206
  recoverMediaError() {
22164
22207
  this.logger.log('recoverMediaError');
22165
22208
  const media = this._media;
22166
- const time = media == null ? void 0 : media.currentTime;
22209
+ const time = media == null ? undefined : media.currentTime;
22167
22210
  this.detachMedia();
22168
22211
  if (media) {
22169
22212
  this.attachMedia(media);
@@ -22502,7 +22545,7 @@ class Hls {
22502
22545
  */
22503
22546
  setAudioOption(audioOption) {
22504
22547
  var _this$audioTrackContr;
22505
- return ((_this$audioTrackContr = this.audioTrackController) == null ? void 0 : _this$audioTrackContr.setAudioOption(audioOption)) || null;
22548
+ return ((_this$audioTrackContr = this.audioTrackController) == null ? undefined : _this$audioTrackContr.setAudioOption(audioOption)) || null;
22506
22549
  }
22507
22550
  /**
22508
22551
  * Find and select the best matching subtitle track, making a level switch when a Group change is necessary.
@@ -22510,7 +22553,7 @@ class Hls {
22510
22553
  */
22511
22554
  setSubtitleOption(subtitleOption) {
22512
22555
  var _this$subtitleTrackCo;
22513
- return ((_this$subtitleTrackCo = this.subtitleTrackController) == null ? void 0 : _this$subtitleTrackCo.setSubtitleOption(subtitleOption)) || null;
22556
+ return ((_this$subtitleTrackCo = this.subtitleTrackController) == null ? undefined : _this$subtitleTrackCo.setSubtitleOption(subtitleOption)) || null;
22514
22557
  }
22515
22558
 
22516
22559
  /**
@@ -22688,7 +22731,7 @@ class Hls {
22688
22731
  */
22689
22732
  get interstitialsManager() {
22690
22733
  var _this$interstitialsCo;
22691
- return ((_this$interstitialsCo = this.interstitialsController) == null ? void 0 : _this$interstitialsCo.interstitialsManager) || null;
22734
+ return ((_this$interstitialsCo = this.interstitialsController) == null ? undefined : _this$interstitialsCo.interstitialsManager) || null;
22692
22735
  }
22693
22736
 
22694
22737
  /**
@@ -22699,7 +22742,7 @@ class Hls {
22699
22742
  return getMediaDecodingInfoPromise(level, audioTracksByGroup, navigator.mediaCapabilities);
22700
22743
  }
22701
22744
  }
22702
- Hls.defaultConfig = void 0;
22745
+ Hls.defaultConfig = undefined;
22703
22746
 
22704
22747
  var KeySystemFormats = emptyEs.KeySystemFormats;
22705
22748
  var KeySystems = emptyEs.KeySystems;