hls.js 1.6.0-beta.2.0.canary.10844 → 1.6.0-beta.2.0.canary.10851

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.
@@ -401,7 +401,7 @@ function enableLogs(debugConfig, context, id) {
401
401
  // Some browsers don't allow to use bind on console object anyway
402
402
  // fallback to default if needed
403
403
  try {
404
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.10844"}`);
404
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.10851"}`);
405
405
  } catch (e) {
406
406
  /* log fn threw an exception. All logger methods are no-ops. */
407
407
  return createLogger();
@@ -3282,7 +3282,7 @@ class LevelDetails {
3282
3282
  return this.endSN;
3283
3283
  }
3284
3284
  get expired() {
3285
- if (this.live && this.age) {
3285
+ if (this.live && this.age && this.misses < 3) {
3286
3286
  const playlistWindowDuration = this.partEnd - this.fragmentStart;
3287
3287
  return this.age > Math.max(playlistWindowDuration, this.totalduration) + this.levelTargetDuration;
3288
3288
  }
@@ -5306,6 +5306,9 @@ function updateFragPTSDTS(details, frag, startPTS, endPTS, startDTS, endDTS) {
5306
5306
  return drift;
5307
5307
  }
5308
5308
  function mergeDetails(oldDetails, newDetails) {
5309
+ if (oldDetails === newDetails) {
5310
+ return;
5311
+ }
5309
5312
  // Track the last initSegment processed. Initialize it to the last one on the timeline.
5310
5313
  let currentInitSegment = null;
5311
5314
  const oldFragments = oldDetails.fragments;
@@ -8416,7 +8419,7 @@ class BaseStreamController extends TaskLoop {
8416
8419
  frag = this.getInitialLiveFragment(levelDetails, fragments);
8417
8420
  const mainStart = this.hls.startPosition;
8418
8421
  const liveSyncPosition = this.hls.liveSyncPosition;
8419
- const startPosition = frag ? (mainStart !== -1 ? mainStart : liveSyncPosition) || frag.start : pos;
8422
+ const startPosition = frag ? (mainStart !== -1 && mainStart >= start ? mainStart : liveSyncPosition) || frag.start : pos;
8420
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}`);
8421
8424
  this.startPosition = this.nextLoadPosition = startPosition;
8422
8425
  }
@@ -16242,7 +16245,7 @@ class PassThroughRemuxer {
16242
16245
  const duration = getDuration(data, initData);
16243
16246
  const startDTS = getStartDTS(initData, data);
16244
16247
  const decodeTime = startDTS === null ? timeOffset : startDTS;
16245
- if (isInvalidInitPts(initPTS, decodeTime, timeOffset, duration) || initSegment.timescale !== initPTS.timescale && accurateTimeOffset) {
16248
+ if ((accurateTimeOffset || !initPTS) && (isInvalidInitPts(initPTS, decodeTime, timeOffset, duration) || initSegment.timescale !== initPTS.timescale)) {
16246
16249
  initSegment.initPTS = decodeTime - timeOffset;
16247
16250
  if (initPTS && initPTS.timescale === 1) {
16248
16251
  this.logger.warn(`Adjusting initPTS @${timeOffset} from ${initPTS.baseTime / initPTS.timescale} to ${initSegment.initPTS}`);
@@ -19176,7 +19179,7 @@ class GapController extends Logger {
19176
19179
  }
19177
19180
  }
19178
19181
 
19179
- const version = "1.6.0-beta.2.0.canary.10844";
19182
+ const version = "1.6.0-beta.2.0.canary.10851";
19180
19183
 
19181
19184
  // ensure the worker ends up in the bundle
19182
19185
  // If the worker should not be included this gets aliased to empty.js
@@ -20228,12 +20231,17 @@ class StreamController extends BaseStreamController {
20228
20231
  }
20229
20232
  // If switching from alt to main audio, flush all audio and trigger track switched
20230
20233
  if (fromAltAudio) {
20234
+ this.fragmentTracker.removeAllFragments();
20235
+ hls.once(Events.BUFFER_FLUSHED, () => {
20236
+ var _this$hls;
20237
+ (_this$hls = this.hls) == null ? void 0 : _this$hls.trigger(Events.AUDIO_TRACK_SWITCHED, data);
20238
+ });
20231
20239
  hls.trigger(Events.BUFFER_FLUSHING, {
20232
20240
  startOffset: 0,
20233
20241
  endOffset: Number.POSITIVE_INFINITY,
20234
20242
  type: null
20235
20243
  });
20236
- this.fragmentTracker.removeAllFragments();
20244
+ return;
20237
20245
  }
20238
20246
  hls.trigger(Events.AUDIO_TRACK_SWITCHED, data);
20239
20247
  } else {