hls.js 1.6.3-0.canary.11211 → 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/package.json CHANGED
@@ -98,7 +98,7 @@
98
98
  "doctoc": "2.2.1",
99
99
  "es-check": "8.0.2",
100
100
  "eslint": "8.57.1",
101
- "eslint-config-prettier": "10.1.3",
101
+ "eslint-config-prettier": "10.1.5",
102
102
  "eslint-plugin-import": "2.31.0",
103
103
  "eslint-plugin-mocha": "10.5.0",
104
104
  "eslint-plugin-n": "17.17.0",
@@ -135,5 +135,5 @@
135
135
  "url-toolkit": "2.2.5",
136
136
  "wrangler": "3.114.8"
137
137
  },
138
- "version": "1.6.3-0.canary.11211"
138
+ "version": "1.6.3-0.canary.11214"
139
139
  }
@@ -664,8 +664,6 @@ export function getSampleData(
664
664
  if (!track) {
665
665
  continue;
666
666
  }
667
- let sampleCount: number | undefined;
668
- let firstKeyFrame: number | undefined;
669
667
  const trackTimes: TrackTimes =
670
668
  tracks[id] ||
671
669
  (tracks[id] = {
@@ -722,12 +720,10 @@ export function getSampleData(
722
720
  let sampleDuration = defaultSampleDuration;
723
721
  for (let j = 0; j < truns.length; j++) {
724
722
  const trun = truns[j];
725
- sampleCount = readUint32(trun, 4);
723
+ const sampleCount = readUint32(trun, 4);
724
+ const sampleIndex = trackTimes.sampleCount;
726
725
  trackTimes.sampleCount += sampleCount;
727
726
  if (track.type === ElementaryStreamTypes.VIDEO) {
728
- if (firstKeyFrame === undefined) {
729
- firstKeyFrame = -1;
730
- }
731
727
  const dataOffsetPresent = trun[3] & 0x01;
732
728
  const firstSampleFlagsPresent = trun[3] & 0x04;
733
729
  const sampleDurationPresent = trun[2] & 0x01;
@@ -741,8 +737,8 @@ export function getSampleData(
741
737
  }
742
738
  if (firstSampleFlagsPresent && sampleCount) {
743
739
  const isNonSyncSample = trun[offset + 1] & 0x01;
744
- if (!isNonSyncSample) {
745
- firstKeyFrame = 0;
740
+ if (!isNonSyncSample && trackTimes.keyFrameIndex === undefined) {
741
+ trackTimes.keyFrameIndex = sampleIndex;
746
742
  }
747
743
  offset += 4;
748
744
  if (sampleDurationPresent) {
@@ -774,8 +770,9 @@ export function getSampleData(
774
770
  if (sampleFlagsPresent) {
775
771
  const isNonSyncSample = trun[offset + 1] & 0x01;
776
772
  if (!isNonSyncSample) {
777
- if (firstKeyFrame === -1) {
778
- firstKeyFrame = sampleCount - (remaining + 1);
773
+ if (trackTimes.keyFrameIndex === undefined) {
774
+ trackTimes.keyFrameIndex =
775
+ trackTimes.sampleCount - (remaining + 1);
779
776
  trackTimes.keyFrameStart = sampleDTS;
780
777
  }
781
778
  }
@@ -787,7 +784,6 @@ export function getSampleData(
787
784
  sampleDTS += sampleDuration;
788
785
  rawDuration += sampleDuration;
789
786
  }
790
- trackTimes.keyFrameIndex = firstKeyFrame;
791
787
  } else {
792
788
  rawDuration += defaultSampleDuration * sampleCount;
793
789
  }