hls.js 1.6.5-0.canary.11268 → 1.6.5

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/package.json CHANGED
@@ -135,5 +135,5 @@
135
135
  "url-toolkit": "2.2.5",
136
136
  "wrangler": "3.114.9"
137
137
  },
138
- "version": "1.6.5-0.canary.11268"
138
+ "version": "1.6.5"
139
139
  }
@@ -758,6 +758,9 @@ export function mapDateRanges(
758
758
  ) {
759
759
  // Make sure DateRanges are mapped to a ProgramDateTime tag that applies a date to a segment that overlaps with its start date
760
760
  const programDateTimeCount = programDateTimes.length;
761
+ if (!programDateTimeCount) {
762
+ return;
763
+ }
761
764
  const lastProgramDateTime = programDateTimes[programDateTimeCount - 1];
762
765
  const playlistEnd = details.live ? Infinity : details.totalduration;
763
766
  const dateRangeIds = Object.keys(details.dateRanges);
@@ -168,14 +168,14 @@ export function mergeDetails(
168
168
  oldDetails,
169
169
  newDetails,
170
170
  (oldFrag, newFrag, newFragIndex, newFragments) => {
171
- if (!newDetails.startCC && newFrag.cc !== oldFrag.cc) {
171
+ if (
172
+ (!newDetails.startCC || newDetails.skippedSegments) &&
173
+ newFrag.cc !== oldFrag.cc
174
+ ) {
172
175
  const ccOffset = oldFrag.cc - newFrag.cc;
173
176
  for (let i = newFragIndex; i < newFragments.length; i++) {
174
177
  newFragments[i].cc += ccOffset;
175
178
  }
176
- newDetails.startCC =
177
- getFragmentWithSN(oldDetails, newDetails.startSN - 1)?.cc ??
178
- newFragments[0].cc;
179
179
  newDetails.endCC = newFragments[newFragments.length - 1].cc;
180
180
  }
181
181
  if (
@@ -243,7 +243,6 @@ export function mergeDetails(
243
243
  }
244
244
  newDetails.startSN = newFragments[0].sn;
245
245
  } else {
246
- newDetails.endCC = newFragments[newFragments.length - 1].cc;
247
246
  if (newDetails.canSkipDateRanges) {
248
247
  newDetails.dateRanges = mergeDateRanges(
249
248
  oldDetails.dateRanges,
@@ -266,6 +265,14 @@ export function mergeDetails(
266
265
  }
267
266
  mapDateRanges(programDateTimes, newDetails);
268
267
  }
268
+ newDetails.endCC = newFragments[newFragments.length - 1].cc;
269
+ }
270
+ if (!newDetails.startCC) {
271
+ const fragPriorToNewStart = getFragmentWithSN(
272
+ oldDetails,
273
+ newDetails.startSN - 1,
274
+ );
275
+ newDetails.startCC = fragPriorToNewStart?.cc ?? newFragments[0].cc;
269
276
  }
270
277
 
271
278
  // Merge parts