diff --git a/lib/media/segment_prefetch.js b/lib/media/segment_prefetch.js index b4f0b5b8c2..9643a24b8c 100644 --- a/lib/media/segment_prefetch.js +++ b/lib/media/segment_prefetch.js @@ -147,7 +147,12 @@ shaka.media.SegmentPrefetch = class { } // init segments are ignored from the prefetch limit - if (!this.initSegmentPrefetchMap_.has(initSegmentReference)) { + const initSegments = Array.from(this.initSegmentPrefetchMap_.keys()); + const someReference = initSegments.some((reference) => { + return shaka.media.InitSegmentReference.equal( + reference, initSegmentReference); + }); + if (!someReference) { const segmentPrefetchOperation = new shaka.media.SegmentPrefetchOperation(this.fetchDispatcher_); segmentPrefetchOperation.dispatchFetch( @@ -270,9 +275,11 @@ shaka.media.SegmentPrefetch = class { const segmentReferences = Array.from(this.segmentPrefetchMap_.keys()); for (const initSegmentReference of this.initSegmentPrefetchMap_.keys()) { // if no segment references this init segment, we should remove it. - if (!segmentReferences.some( - (segmentReference) => - segmentReference.initSegmentReference === initSegmentReference)) { + const someReference = segmentReferences.some((segmentReference) => { + return shaka.media.InitSegmentReference.equal( + segmentReference.initSegmentReference, initSegmentReference); + }); + if (!someReference) { this.abortPrefetchedSegment_(initSegmentReference); } }