Skip to content

Commit

Permalink
fix(HLS): Avoid HLS resync when there is a gap in the stream (shaka-p…
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Jun 12, 2023
1 parent 62f24d2 commit b8c2004
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/media/streaming_engine.js
Expand Up @@ -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 =
Expand Down

0 comments on commit b8c2004

Please sign in to comment.