hls.js 1.6.0-beta.3.0.canary.10986 → 1.6.0-beta.3.0.canary.10989

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/hls.js CHANGED
@@ -1059,7 +1059,7 @@
1059
1059
  // Some browsers don't allow to use bind on console object anyway
1060
1060
  // fallback to default if needed
1061
1061
  try {
1062
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.3.0.canary.10986");
1062
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.3.0.canary.10989");
1063
1063
  } catch (e) {
1064
1064
  /* log fn threw an exception. All logger methods are no-ops. */
1065
1065
  return createLogger();
@@ -16413,7 +16413,7 @@
16413
16413
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16414
16414
  }
16415
16415
 
16416
- var version = "1.6.0-beta.3.0.canary.10986";
16416
+ var version = "1.6.0-beta.3.0.canary.10989";
16417
16417
 
16418
16418
  // ensure the worker ends up in the bundle
16419
16419
  // If the worker should not be included this gets aliased to empty.js
@@ -22981,8 +22981,16 @@
22981
22981
  };
22982
22982
  _proto.reset = function reset() {
22983
22983
  var _this$assetListLoader;
22984
+ this.appendInPlaceStarted = false;
22984
22985
  (_this$assetListLoader = this.assetListLoader) == null ? void 0 : _this$assetListLoader.destroy();
22985
- this.assetListLoader = this.error = undefined;
22986
+ this.assetListLoader = undefined;
22987
+ if (!this.supplementsPrimary) {
22988
+ this.assetListResponse = null;
22989
+ this.assetList = [];
22990
+ this._duration = null;
22991
+ }
22992
+ // `error?` is reset when seeking back over interstitial `startOffset`
22993
+ // using `schedule.resetErrorsInRange(start, end)`.
22986
22994
  };
22987
22995
  _proto.isAssetPastPlayoutLimit = function isAssetPastPlayoutLimit(assetIndex) {
22988
22996
  if (assetIndex >= this.assetList.length) {
@@ -23377,6 +23385,18 @@
23377
23385
  }
23378
23386
  this.events = this.items = null;
23379
23387
  };
23388
+ _proto.resetErrorsInRange = function resetErrorsInRange(start, end) {
23389
+ if (this.events) {
23390
+ return this.events.reduce(function (count, interstitial) {
23391
+ if (start <= interstitial.startOffset && end > interstitial.startOffset) {
23392
+ delete interstitial.error;
23393
+ return count + 1;
23394
+ }
23395
+ return count;
23396
+ }, 0);
23397
+ }
23398
+ return 0;
23399
+ };
23380
23400
  _proto.getEvent = function getEvent(identifier) {
23381
23401
  return identifier ? this.eventMap[identifier] || null : null;
23382
23402
  };
@@ -24023,13 +24043,20 @@
24023
24043
  var backwardSeek = diff <= -0.01;
24024
24044
  _this.timelinePos = currentTime;
24025
24045
  _this.bufferedPos = currentTime;
24026
- _this.checkBuffer();
24027
24046
 
24028
24047
  // Check if seeking out of an item
24029
24048
  var playingItem = _this.playingItem;
24030
24049
  if (!playingItem) {
24050
+ _this.checkBuffer();
24031
24051
  return;
24032
24052
  }
24053
+ if (backwardSeek) {
24054
+ var resetCount = _this.schedule.resetErrorsInRange(currentTime, currentTime - diff);
24055
+ if (resetCount) {
24056
+ _this.updateSchedule();
24057
+ }
24058
+ }
24059
+ _this.checkBuffer();
24033
24060
  if (backwardSeek && currentTime < playingItem.start || currentTime >= playingItem.end) {
24034
24061
  var _this$media;
24035
24062
  var scheduleIndex = _this.schedule.findItemIndexAtTime(_this.timelinePos);
@@ -24079,10 +24106,10 @@
24079
24106
  // Only allow timeupdate to advance primary position, seeking is used for jumping back
24080
24107
  // this prevents primaryPos from being reset to 0 after re-attach
24081
24108
  if (currentTime > _this.timelinePos) {
24109
+ _this.timelinePos = currentTime;
24082
24110
  if (currentTime > _this.bufferedPos) {
24083
24111
  _this.checkBuffer();
24084
24112
  }
24085
- _this.timelinePos = currentTime;
24086
24113
  } else {
24087
24114
  return;
24088
24115
  }
@@ -24168,7 +24195,7 @@
24168
24195
  _this.bufferingItem = updatedBufferingItem;
24169
24196
  } else if (bufferingItem.event) {
24170
24197
  // Interstitial removed from schedule (Live -> VOD or other scenario where Start Date is outside the range of VOD Playlist)
24171
- _this.bufferingItem = null;
24198
+ _this.bufferingItem = _this.playingItem;
24172
24199
  _this.clearInterstitial(bufferingItem.event, null);
24173
24200
  }
24174
24201
  }
@@ -24473,6 +24500,7 @@
24473
24500
  var resumptionTime = interstitial.resumeTime;
24474
24501
  if (this.timelinePos < resumptionTime) {
24475
24502
  this.timelinePos = resumptionTime;
24503
+ this.checkBuffer();
24476
24504
  }
24477
24505
  this.setSchedulePosition(nextIndex);
24478
24506
  }
@@ -24533,7 +24561,6 @@
24533
24561
  scheduleIndex: index
24534
24562
  });
24535
24563
  // Exiting an Interstitial
24536
- this.clearInterstitial(interstitial, scheduledItem);
24537
24564
  if (interstitial.cue.once) {
24538
24565
  // Remove interstitial with CUE attribute value of ONCE after it has played
24539
24566
  this.updateSchedule();
@@ -24702,7 +24729,7 @@
24702
24729
  if (item) {
24703
24730
  this.setBufferingItem(item);
24704
24731
  } else {
24705
- this.bufferingItem = null;
24732
+ this.bufferingItem = this.playingItem;
24706
24733
  }
24707
24734
  this.bufferingAsset = null;
24708
24735
  var media = this.primaryMedia;
@@ -24937,7 +24964,7 @@
24937
24964
  var timeRemaining = bufferingPlayer ? bufferingPlayer.remaining : bufferingLast ? bufferingLast.end - this.timelinePos : 0;
24938
24965
  this.log("buffered to boundary " + segmentToString(item) + (bufferingLast ? " (" + timeRemaining.toFixed(2) + " remaining)" : ''));
24939
24966
  this.bufferingItem = item;
24940
- this.bufferedPos = item.start;
24967
+ this.bufferedPos = Math.max(item.start, Math.min(item.end, this.timelinePos));
24941
24968
  if (!this.playbackDisabled) {
24942
24969
  if (isInterstitial) {
24943
24970
  // primary fragment loading will exit early in base-stream-controller while `bufferingItem` is set to an Interstitial block
@@ -25036,7 +25063,6 @@
25036
25063
  liveStartPosition = this.hls.liveSyncPosition || 0;
25037
25064
  }
25038
25065
  }
25039
- interstitial.assetListResponse = null;
25040
25066
  var assetListLoader = this.assetListLoader.loadAssetList(interstitial, liveStartPosition);
25041
25067
  if (assetListLoader) {
25042
25068
  interstitial.assetListLoader = assetListLoader;
@@ -25280,7 +25306,8 @@
25280
25306
  interstitial.assetList.forEach(function (asset) {
25281
25307
  _this6.clearAssetPlayer(asset.identifier, toSegment);
25282
25308
  });
25283
- interstitial.appendInPlaceStarted = false;
25309
+ // Remove asset list and resolved duration
25310
+ interstitial.reset();
25284
25311
  };
25285
25312
  _proto.clearAssetPlayer = function clearAssetPlayer(assetId, toSegment) {
25286
25313
  var playerIndex = this.getAssetPlayerQueueIndex(assetId);
@@ -25568,8 +25595,9 @@
25568
25595
  var playingItem = c.effectivePlayingItem;
25569
25596
  var targetIndex = c.schedule.findItemIndexAtTime(time, timelineType);
25570
25597
  var targetItem = (_c$schedule$items2 = c.schedule.items) == null ? void 0 : _c$schedule$items2[targetIndex];
25571
- var playingInterstitial = playingItem == null ? void 0 : playingItem.event;
25572
- var appendInPlace = playingInterstitial == null ? void 0 : playingInterstitial.appendInPlace;
25598
+ var bufferingPlayer = c.getBufferingPlayer();
25599
+ var bufferingInterstitial = bufferingPlayer == null ? void 0 : bufferingPlayer.interstitial;
25600
+ var appendInPlace = bufferingInterstitial == null ? void 0 : bufferingInterstitial.appendInPlace;
25573
25601
  var seekInItem = playingItem && c.itemsMatch(playingItem, targetItem);
25574
25602
  if (playingItem && (appendInPlace || seekInItem)) {
25575
25603
  // seek in asset player or primary media (appendInPlace)
@@ -25594,8 +25622,8 @@
25594
25622
  _seekToTime = targetItem.start + _diff;
25595
25623
  }
25596
25624
  var targetIsPrimary = !c.isInterstitial(targetItem);
25597
- if (!c.isInterstitial(playingItem) && (targetIsPrimary || targetItem.event.appendInPlace)) {
25598
- var _media2 = c.hls.media;
25625
+ if ((!c.isInterstitial(playingItem) || playingItem.event.appendInPlace) && (targetIsPrimary || targetItem.event.appendInPlace)) {
25626
+ var _media2 = c.media || (appendInPlace ? bufferingPlayer == null ? void 0 : bufferingPlayer.media : null);
25599
25627
  if (_media2) {
25600
25628
  _media2.currentTime = _seekToTime;
25601
25629
  }
@@ -25612,6 +25640,7 @@
25612
25640
  var assetIndex = 0;
25613
25641
  if (targetIsPrimary) {
25614
25642
  c.timelinePos = _seekToTime;
25643
+ c.checkBuffer();
25615
25644
  } else {
25616
25645
  var _targetItem$event;
25617
25646
  var assetList = targetItem == null ? void 0 : (_targetItem$event = targetItem.event) == null ? void 0 : _targetItem$event.assetList;