diff options
-rw-r--r-- | web/script/player/track/mse.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/web/script/player/track/mse.ts b/web/script/player/track/mse.ts index 623e149..2d17b87 100644 --- a/web/script/player/track/mse.ts +++ b/web/script/player/track/mse.ts @@ -55,9 +55,12 @@ export class MSEPlayerTrack extends PlayerTrack { this.source_buffer.addEventListener("updateend", () => { if (this.abort.signal.aborted) return; if (this.current_load) { - this.current_load.cb(); this.loading.delete(this.current_load.index); + const cb = this.current_load.cb; this.current_load = undefined; + cb() + } else { + console.warn("updateend but nothing is loading") } this.update_buf_ranges(); this.tick_append(); @@ -100,7 +103,6 @@ export class MSEPlayerTrack extends PlayerTrack { if (!this.check_buf_collision(seg.start, seg.end)) continue; if (seg.start <= target + MIN_BUFFER_DURATION) blocking.push(this.load(i)); - else this.load(i); } @@ -126,7 +128,7 @@ export class MSEPlayerTrack extends PlayerTrack { }); } tick_append() { - if (this.source_buffer.updating) return; + if (this.source_buffer.updating || this.current_load) return; if (this.append_queue.length) { const seg = this.append_queue[0]; this.append_queue.splice(0, 1); |