hls.js 1.5.8-0.canary.10156 → 1.5.8-0.canary.10157

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
@@ -512,7 +512,7 @@ function enableLogs(debugConfig, context, id) {
512
512
  // Some browsers don't allow to use bind on console object anyway
513
513
  // fallback to default if needed
514
514
  try {
515
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.8-0.canary.10156"}`);
515
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.8-0.canary.10157"}`);
516
516
  } catch (e) {
517
517
  /* log fn threw an exception. All logger methods are no-ops. */
518
518
  return createLogger();
@@ -5230,14 +5230,17 @@ var HlsSkip = {
5230
5230
  Yes: "YES",
5231
5231
  v2: "v2"
5232
5232
  };
5233
- function getSkipValue(details, msn) {
5233
+ function getSkipValue(details) {
5234
5234
  const {
5235
5235
  canSkipUntil,
5236
5236
  canSkipDateRanges,
5237
- endSN
5237
+ age
5238
5238
  } = details;
5239
- const snChangeGoal = msn !== undefined ? msn - endSN : 0;
5240
- if (canSkipUntil && snChangeGoal < canSkipUntil) {
5239
+ // A Client SHOULD NOT request a Playlist Delta Update unless it already
5240
+ // has a version of the Playlist that is no older than one-half of the Skip Boundary.
5241
+ // @see: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-6.3.7
5242
+ const playlistRecentEnough = age < canSkipUntil / 2;
5243
+ if (canSkipUntil && playlistRecentEnough) {
5241
5244
  if (canSkipDateRanges) {
5242
5245
  return HlsSkip.v2;
5243
5246
  }
@@ -6355,7 +6358,7 @@ class BasePlaylistController extends Logger {
6355
6358
  this.canLoad = false;
6356
6359
  this.clearTimer();
6357
6360
  }
6358
- switchParams(playlistUri, previous) {
6361
+ switchParams(playlistUri, previous, current) {
6359
6362
  const renditionReports = previous == null ? void 0 : previous.renditionReports;
6360
6363
  if (renditionReports) {
6361
6364
  let foundIndex = -1;
@@ -6387,7 +6390,8 @@ class BasePlaylistController extends Logger {
6387
6390
  part += 1;
6388
6391
  }
6389
6392
  }
6390
- return new HlsUrlParameters(msn, part >= 0 ? part : undefined, HlsSkip.No);
6393
+ const skip = current && getSkipValue(current);
6394
+ return new HlsUrlParameters(msn, part >= 0 ? part : undefined, skip);
6391
6395
  }
6392
6396
  }
6393
6397
  }
@@ -6520,7 +6524,7 @@ class BasePlaylistController extends Logger {
6520
6524
  }
6521
6525
  }
6522
6526
  getDeliveryDirectives(details, previousDeliveryDirectives, msn, part) {
6523
- let skip = getSkipValue(details, msn);
6527
+ let skip = getSkipValue(details);
6524
6528
  if (previousDeliveryDirectives != null && previousDeliveryDirectives.skip && details.deltaUpdateFailed) {
6525
6529
  msn = previousDeliveryDirectives.msn;
6526
6530
  part = previousDeliveryDirectives.part;
@@ -17890,7 +17894,7 @@ class AudioTrackController extends BasePlaylistController {
17890
17894
  if (trackLoaded) {
17891
17895
  return;
17892
17896
  }
17893
- const hlsUrlParameters = this.switchParams(track.url, lastTrack == null ? void 0 : lastTrack.details);
17897
+ const hlsUrlParameters = this.switchParams(track.url, lastTrack == null ? void 0 : lastTrack.details, track.details);
17894
17898
  this.loadPlaylist(hlsUrlParameters);
17895
17899
  }
17896
17900
  findTrackId(currentTrack) {
@@ -18793,7 +18797,7 @@ class SubtitleTrackController extends BasePlaylistController {
18793
18797
  type,
18794
18798
  url
18795
18799
  });
18796
- const hlsUrlParameters = this.switchParams(track.url, lastTrack == null ? void 0 : lastTrack.details);
18800
+ const hlsUrlParameters = this.switchParams(track.url, lastTrack == null ? void 0 : lastTrack.details, track.details);
18797
18801
  this.loadPlaylist(hlsUrlParameters);
18798
18802
  }
18799
18803
  }
@@ -27005,7 +27009,7 @@ class LevelController extends BasePlaylistController {
27005
27009
  const levelDetails = level.details;
27006
27010
  if (!levelDetails || levelDetails.live) {
27007
27011
  // level not retrieved yet, or live playlist we need to (re)load it
27008
- const hlsUrlParameters = this.switchParams(level.uri, lastLevel == null ? void 0 : lastLevel.details);
27012
+ const hlsUrlParameters = this.switchParams(level.uri, lastLevel == null ? void 0 : lastLevel.details, levelDetails);
27009
27013
  this.loadPlaylist(hlsUrlParameters);
27010
27014
  }
27011
27015
  }
@@ -28973,7 +28977,7 @@ class Hls {
28973
28977
  * Get the video-dev/hls.js package version.
28974
28978
  */
28975
28979
  static get version() {
28976
- return "1.5.8-0.canary.10156";
28980
+ return "1.5.8-0.canary.10157";
28977
28981
  }
28978
28982
 
28979
28983
  /**