From b5775a7477451c7bb37c8640c87bf8fdccda99c7 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Fri, 22 Sep 2023 12:32:13 +0500 Subject: [PATCH] buffer remove check so it doesnt apply when < 60 s audio are buffered --- hls-player.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hls-player.js b/hls-player.js index 08ee5ff..c83deca 100644 --- a/hls-player.js +++ b/hls-player.js @@ -90,7 +90,7 @@ class VideoLoader { // remove old segments every 1 min let timeout = 60000; // if removal cannot happen since buffer is busy, try again in a bit - if (!this.media_buffer.updating) { + if (!this.media_buffer.updating && this.media_buffer.buffered.end(0) - 60 > this.media_buffer.buffered.start(0)) { // remove segments that are older than 1min behind the current end of buffer this.media_buffer.remove(0, this.media_buffer.buffered.end(0) - 60); } else {