hls.js 1.6.3-0.canary.11213 → 1.6.3-0.canary.11214

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
@@ -523,7 +523,7 @@ function enableLogs(debugConfig, context, id) {
523
523
  // Some browsers don't allow to use bind on console object anyway
524
524
  // fallback to default if needed
525
525
  try {
526
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.3-0.canary.11213"}`);
526
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.3-0.canary.11214"}`);
527
527
  } catch (e) {
528
528
  /* log fn threw an exception. All logger methods are no-ops. */
529
529
  return createLogger();
@@ -1740,8 +1740,6 @@ function getSampleData(data, initData, logger) {
1740
1740
  if (!track) {
1741
1741
  continue;
1742
1742
  }
1743
- let sampleCount;
1744
- let firstKeyFrame;
1745
1743
  const trackTimes = tracks[id] || (tracks[id] = {
1746
1744
  start: NaN,
1747
1745
  duration: 0,
@@ -1789,12 +1787,10 @@ function getSampleData(data, initData, logger) {
1789
1787
  let sampleDuration = defaultSampleDuration;
1790
1788
  for (let j = 0; j < truns.length; j++) {
1791
1789
  const trun = truns[j];
1792
- sampleCount = readUint32(trun, 4);
1790
+ const sampleCount = readUint32(trun, 4);
1791
+ const sampleIndex = trackTimes.sampleCount;
1793
1792
  trackTimes.sampleCount += sampleCount;
1794
1793
  if (track.type === ElementaryStreamTypes.VIDEO) {
1795
- if (firstKeyFrame === undefined) {
1796
- firstKeyFrame = -1;
1797
- }
1798
1794
  const dataOffsetPresent = trun[3] & 0x01;
1799
1795
  const firstSampleFlagsPresent = trun[3] & 0x04;
1800
1796
  const sampleDurationPresent = trun[2] & 0x01;
@@ -1808,8 +1804,8 @@ function getSampleData(data, initData, logger) {
1808
1804
  }
1809
1805
  if (firstSampleFlagsPresent && sampleCount) {
1810
1806
  const isNonSyncSample = trun[offset + 1] & 0x01;
1811
- if (!isNonSyncSample) {
1812
- firstKeyFrame = 0;
1807
+ if (!isNonSyncSample && trackTimes.keyFrameIndex === undefined) {
1808
+ trackTimes.keyFrameIndex = sampleIndex;
1813
1809
  }
1814
1810
  offset += 4;
1815
1811
  if (sampleDurationPresent) {
@@ -1841,8 +1837,8 @@ function getSampleData(data, initData, logger) {
1841
1837
  if (sampleFlagsPresent) {
1842
1838
  const isNonSyncSample = trun[offset + 1] & 0x01;
1843
1839
  if (!isNonSyncSample) {
1844
- if (firstKeyFrame === -1) {
1845
- firstKeyFrame = sampleCount - (remaining + 1);
1840
+ if (trackTimes.keyFrameIndex === undefined) {
1841
+ trackTimes.keyFrameIndex = trackTimes.sampleCount - (remaining + 1);
1846
1842
  trackTimes.keyFrameStart = sampleDTS;
1847
1843
  }
1848
1844
  }
@@ -1854,7 +1850,6 @@ function getSampleData(data, initData, logger) {
1854
1850
  sampleDTS += sampleDuration;
1855
1851
  rawDuration += sampleDuration;
1856
1852
  }
1857
- trackTimes.keyFrameIndex = firstKeyFrame;
1858
1853
  } else {
1859
1854
  rawDuration += defaultSampleDuration * sampleCount;
1860
1855
  }
@@ -10242,7 +10237,7 @@ function requireEventemitter3 () {
10242
10237
  var eventemitter3Exports = requireEventemitter3();
10243
10238
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
10244
10239
 
10245
- const version = "1.6.3-0.canary.11213";
10240
+ const version = "1.6.3-0.canary.11214";
10246
10241
 
10247
10242
  // ensure the worker ends up in the bundle
10248
10243
  // If the worker should not be included this gets aliased to empty.js