Skip to content

Commit

Permalink
fix(HLS): Avoid HLS resync when there is a gap in the stream (#5284)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored and JulianDomingo committed Jun 15, 2023
1 parent 49afa92 commit 679dbae
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,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 679dbae

Please sign in to comment.