buffer remove check so it doesnt apply when < 60 s audio are buffered

This commit is contained in:
Muaz Ahmad 2023-09-22 12:32:13 +05:00
parent 4478cf5958
commit b5775a7477

View file

@ -90,7 +90,7 @@ class VideoLoader {
// remove old segments every 1 min // remove old segments every 1 min
let timeout = 60000; let timeout = 60000;
// if removal cannot happen since buffer is busy, try again in a bit // 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 // 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); this.media_buffer.remove(0, this.media_buffer.buffered.end(0) - 60);
} else { } else {