timer issues fixed - 0.9.9

This commit is contained in:
killer069 2021-09-13 12:47:00 +05:30
parent 20e0df6a9f
commit fc52d0dc68

View File

@ -129,7 +129,7 @@ export class Stream {
this.bytes_count = 0 this.bytes_count = 0
this.video_url = video_url this.video_url = video_url
this.cookie = cookie this.cookie = cookie
this.timer = setTimeout(() => { this.timer = setInterval(() => {
this.retry() this.retry()
}, 7200 * 1000) }, 7200 * 1000)
this.per_sec_bytes = Math.ceil(contentLength / duration) this.per_sec_bytes = Math.ceil(contentLength / duration)
@ -159,9 +159,6 @@ export class Stream {
private async retry(){ private async retry(){
let info = await video_info(this.video_url, this.cookie) let info = await video_info(this.video_url, this.cookie)
this.url = info.format[info.format.length - 1].url this.url = info.format[info.format.length - 1].url
this.timer = setTimeout(() => {
this.retry()
}, 7200 * 1000)
} }
private cleanup(){ private cleanup(){
@ -187,6 +184,11 @@ export class Stream {
this.cleanup() this.cleanup()
await this.retry() await this.retry()
this.loop() this.loop()
if(!this.timer){
this.timer = setInterval(() => {
this.retry()
}, 7200 * 1000)
}
return return
} }
this.request = stream this.request = stream