diff --git a/lib/media/streaming_engine.js b/lib/media/streaming_engine.js index ead1d24937..b706251a89 100644 --- a/lib/media/streaming_engine.js +++ b/lib/media/streaming_engine.js @@ -671,10 +671,15 @@ shaka.media.StreamingEngine = class { const mediaState = this.mediaStates_.get(type); const logPrefix = shaka.media.StreamingEngine.logPrefix_(mediaState); - // Always clear the iterator since we need to start streaming from the - // new time. This also happens in clearBuffer_, but if we don't clear, - // we still want to reset the iterator. - mediaState.segmentIterator = null; + let segment = null; + if (mediaState.segmentIterator) { + segment = mediaState.segmentIterator.current(); + } + // Only reset the iterator if we seek outside the current segment. + if (!segment || segment.startTime > presentationTime || + segment.endTime < presentationTime) { + mediaState.segmentIterator = null; + } if (!newTimeIsBuffered(type)) { const bufferEnd =