Streams now gets ended when piping
This commit is contained in:
parent
0e881ea0c5
commit
77a0c022fa
@ -260,10 +260,15 @@ export class Stream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async loop() {
|
private async loop() {
|
||||||
if (this.stream.destroyed || this.time.length === 0 || this.segment_urls.length === 0) {
|
if (this.stream.destroyed) {
|
||||||
this.cleanup();
|
this.cleanup();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(this.time.length === 0 || this.segment_urls.length === 0) {
|
||||||
|
this.cleanup();
|
||||||
|
this.stream.push(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.downloaded_time += this.time.shift() as number;
|
this.downloaded_time += this.time.shift() as number;
|
||||||
this.downloaded_segments++;
|
this.downloaded_segments++;
|
||||||
const stream = await request_stream(this.segment_urls.shift() as string).catch((err: Error) => err);
|
const stream = await request_stream(this.segment_urls.shift() as string).catch((err: Error) => err);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user