diff --git a/lib/media/media_source_engine.js b/lib/media/media_source_engine.js index 47fc7b5e56..6280472e4d 100644 --- a/lib/media/media_source_engine.js +++ b/lib/media/media_source_engine.js @@ -1599,6 +1599,13 @@ shaka.media.MediaSourceEngine = class { return; } + // Avoid changing timestampOffset when the difference is less than 100 ms + // from the end of the current buffer. + const bufferEnd = this.bufferEnd(contentType); + if (bufferEnd && Math.abs(bufferEnd - timestampOffset) < 0.1) { + return; + } + // Queue an abort() to help MSE splice together overlapping segments. // We set appendWindowEnd when we change periods in DASH content, and the // period transition may result in overlap.