From 93ad5a08a3f6d648e0ce34437e2f97442b17e2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8A=88=EB=A6=AC=ED=8A=AC?= <9804cjh@naver.com> Date: Tue, 7 Sep 2021 00:25:19 +0900 Subject: [PATCH] Better solution to prevent error --- play-dl/YouTube/classes/LiveStream.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/play-dl/YouTube/classes/LiveStream.ts b/play-dl/YouTube/classes/LiveStream.ts index d7b143e..7023a74 100644 --- a/play-dl/YouTube/classes/LiveStream.ts +++ b/play-dl/YouTube/classes/LiveStream.ts @@ -90,7 +90,6 @@ export class LiveStreaming{ continue } await new Promise((resolve, reject) => { - this.request?.unpipe(this.stream) let stream = got.stream(this.base_url + segment) this.request = stream stream.pipe(this.stream, { end : false }) @@ -149,7 +148,6 @@ export class Stream { return } let absolute_bytes : number = 0 - this.request?.unpipe(this.stream) let stream = got.stream(this.url, { headers : { "range" : `bytes=${this.bytes_count}-` @@ -172,6 +170,7 @@ export class Stream { this.bytes_count += chunk.length if(absolute_bytes > (this.per_sec_bytes * 300) && this.per_sec_bytes !== 0){ stream.destroy() + stream.unpipe(this.stream) } })