video segment fetch loop, it just works
This commit is contained in:
parent
24b896824f
commit
85cbf0e335
1 changed files with 10 additions and 0 deletions
|
@ -58,6 +58,16 @@ class VideoLoader {
|
|||
this.media_buffer = this.media_source.addSourceBuffer(mime);
|
||||
this.media_buffer.mode = 'segments';
|
||||
this.media_buffer.appendBuffer(init_frag);
|
||||
this.fetch_new_segments();
|
||||
}
|
||||
|
||||
async fetch_new_segments() {
|
||||
while (this.playlist_loader.new_segments.length > 0) {
|
||||
let segment_uri = this.playlist_loader.new_segments.shift();
|
||||
let segment_stream = await this.fetch_video(segment_uri);
|
||||
this.media_buffer.appendBuffer(segment_stream);
|
||||
}
|
||||
setTimeout(this.fetch_new_segments.bind(this), this.playlist_loader.refresh_interval * 1000);
|
||||
}
|
||||
|
||||
async fetch_video(uri) {
|
||||
|
|
Loading…
Reference in a new issue