@give-tech/ec-player 0.0.1-beta.58 → 0.0.1-beta.59

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/index.js CHANGED
@@ -1785,8 +1785,8 @@ class HLSSegmentPrefetcher extends SegmentPrefetcher {
1785
1785
  async fetchSegment(segment, index) {
1786
1786
  if (segment.initSegmentUri && segment.initSegmentUri !== this.currentInitSegmentUri) {
1787
1787
  console.log("[HLSSegmentPrefetcher] Init segment changed:", segment.initSegmentUri);
1788
- await this.player.loadNewInitSegment(segment.initSegmentUri);
1789
1788
  this.currentInitSegmentUri = segment.initSegmentUri;
1789
+ await this.player.loadNewInitSegment(segment.initSegmentUri);
1790
1790
  }
1791
1791
  const baseUrl = this.baseUrl;
1792
1792
  const url = segment.uri.startsWith("http") ? segment.uri : baseUrl + segment.uri;
@@ -2520,8 +2520,12 @@ class HLSPlayer extends BasePlayer {
2520
2520
  */
2521
2521
  async loadNewInitSegment(uri) {
2522
2522
  console.log("[fMP4] Loading new init segment for discontinuity:", uri);
2523
- this._sampleQueue.length = 0;
2524
- this._nalQueue.length = 0;
2523
+ if (this._sampleQueue.length > 0) {
2524
+ this._sampleQueue.length = 0;
2525
+ }
2526
+ if (this._nalQueue.length > 0) {
2527
+ this._nalQueue.length = 0;
2528
+ }
2525
2529
  const url = uri.startsWith("http") ? uri : this.currentPlaylistUrl.substring(0, this.currentPlaylistUrl.lastIndexOf("/") + 1) + uri;
2526
2530
  const headers = {};
2527
2531
  if (this.initSegment?.uri === uri && this.initSegment.byteRange) {