Better solution to prevent error

This commit is contained in:
슈리튬 2021-09-07 00:25:19 +09:00 committed by GitHub
parent e83b925467
commit 93ad5a08a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}
})