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

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.
@@ -537,7 +537,11 @@ class SubtitleTrackController extends BasePlaylistController {
537
537
  type,
538
538
  url,
539
539
  });
540
- const hlsUrlParameters = this.switchParams(track.url, lastTrack?.details);
540
+ const hlsUrlParameters = this.switchParams(
541
+ track.url,
542
+ lastTrack?.details,
543
+ track.details,
544
+ );
541
545
  this.loadPlaylist(hlsUrlParameters);
542
546
  }
543
547
 
@@ -59,10 +59,13 @@ export const enum HlsSkip {
59
59
  v2 = 'v2',
60
60
  }
61
61
 
62
- export function getSkipValue(details: LevelDetails, msn?: number): HlsSkip {
63
- const { canSkipUntil, canSkipDateRanges, endSN } = details;
64
- const snChangeGoal = msn !== undefined ? msn - endSN : 0;
65
- if (canSkipUntil && snChangeGoal < canSkipUntil) {
62
+ export function getSkipValue(details: LevelDetails): HlsSkip {
63
+ const { canSkipUntil, canSkipDateRanges, age } = details;
64
+ // A Client SHOULD NOT request a Playlist Delta Update unless it already
65
+ // has a version of the Playlist that is no older than one-half of the Skip Boundary.
66
+ // @see: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-6.3.7
67
+ const playlistRecentEnough = age < canSkipUntil / 2;
68
+ if (canSkipUntil && playlistRecentEnough) {
66
69
  if (canSkipDateRanges) {
67
70
  return HlsSkip.v2;
68
71
  }