hls.js 1.5.14-0.canary.10606 → 1.5.14-0.canary.10609

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.mjs CHANGED
@@ -421,7 +421,7 @@ function enableLogs(debugConfig, context, id) {
421
421
  // Some browsers don't allow to use bind on console object anyway
422
422
  // fallback to default if needed
423
423
  try {
424
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.14-0.canary.10606"}`);
424
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.14-0.canary.10609"}`);
425
425
  } catch (e) {
426
426
  /* log fn threw an exception. All logger methods are no-ops. */
427
427
  return createLogger();
@@ -5847,13 +5847,24 @@ function mapFragmentIntersection(oldDetails, newDetails, intersectionFn) {
5847
5847
  }
5848
5848
  }
5849
5849
  }
5850
- function adjustSliding(oldDetails, newDetails) {
5850
+ function adjustSliding(oldDetails, newDetails, matchingStableVariantOrRendition = true) {
5851
5851
  const delta = newDetails.startSN + newDetails.skippedSegments - oldDetails.startSN;
5852
5852
  const oldFragments = oldDetails.fragments;
5853
- if (delta < 0 || delta >= oldFragments.length) {
5853
+ const advancedOrStable = delta >= 0;
5854
+ let sliding = 0;
5855
+ if (advancedOrStable && delta < oldFragments.length) {
5856
+ sliding = oldFragments[delta].start;
5857
+ } else if (advancedOrStable && matchingStableVariantOrRendition) {
5858
+ // align new start with old end (updated playlist start sequence is past end sequence of last update)
5859
+ sliding = oldDetails.edge;
5860
+ } else if (!newDetails.skippedSegments && newDetails.fragments[0].start === 0) {
5861
+ // align new start with old (playlist switch has a sequence with no overlap and should not be used for alignment)
5862
+ sliding = oldDetails.fragments[0].start;
5863
+ } else {
5864
+ // new details already has a sliding offset or has skipped segments
5854
5865
  return;
5855
5866
  }
5856
- addSliding(newDetails, oldFragments[delta].start);
5867
+ addSliding(newDetails, sliding);
5857
5868
  }
5858
5869
  function addSliding(details, start) {
5859
5870
  if (start) {
@@ -8776,7 +8787,7 @@ function alignStream(lastFrag, switchDetails, details) {
8776
8787
  // Try to align on sn so that we pick a better start fragment.
8777
8788
  // Do not perform this on playlists with delta updates as this is only to align levels on switch
8778
8789
  // and adjustSliding only adjusts fragments after skippedSegments.
8779
- adjustSliding(switchDetails, details);
8790
+ adjustSliding(switchDetails, details, false);
8780
8791
  }
8781
8792
  }
8782
8793
 
@@ -11081,7 +11092,7 @@ function concatUint8Arrays(chunks, dataLength) {
11081
11092
  return result;
11082
11093
  }
11083
11094
 
11084
- const version = "1.5.14-0.canary.10606";
11095
+ const version = "1.5.14-0.canary.10609";
11085
11096
 
11086
11097
  // ensure the worker ends up in the bundle
11087
11098
  // If the worker should not be included this gets aliased to empty.js