From fc52d0dc684621b3846da6c72842d0e421f335b0 Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Mon, 13 Sep 2021 12:47:00 +0530 Subject: [PATCH] timer issues fixed - 0.9.9 --- play-dl/YouTube/classes/LiveStream.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/play-dl/YouTube/classes/LiveStream.ts b/play-dl/YouTube/classes/LiveStream.ts index f8b44dc..4b8ffe2 100644 --- a/play-dl/YouTube/classes/LiveStream.ts +++ b/play-dl/YouTube/classes/LiveStream.ts @@ -129,7 +129,7 @@ export class Stream { this.bytes_count = 0 this.video_url = video_url this.cookie = cookie - this.timer = setTimeout(() => { + this.timer = setInterval(() => { this.retry() }, 7200 * 1000) this.per_sec_bytes = Math.ceil(contentLength / duration) @@ -159,9 +159,6 @@ export class Stream { private async retry(){ let info = await video_info(this.video_url, this.cookie) this.url = info.format[info.format.length - 1].url - this.timer = setTimeout(() => { - this.retry() - }, 7200 * 1000) } private cleanup(){ @@ -187,6 +184,11 @@ export class Stream { this.cleanup() await this.retry() this.loop() + if(!this.timer){ + this.timer = setInterval(() => { + this.retry() + }, 7200 * 1000) + } return } this.request = stream