Better solution to prevent error
This commit is contained in:
parent
e83b925467
commit
93ad5a08a3
@ -90,7 +90,6 @@ export class LiveStreaming{
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
this.request?.unpipe(this.stream)
|
|
||||||
let stream = got.stream(this.base_url + segment)
|
let stream = got.stream(this.base_url + segment)
|
||||||
this.request = stream
|
this.request = stream
|
||||||
stream.pipe(this.stream, { end : false })
|
stream.pipe(this.stream, { end : false })
|
||||||
@ -149,7 +148,6 @@ export class Stream {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
let absolute_bytes : number = 0
|
let absolute_bytes : number = 0
|
||||||
this.request?.unpipe(this.stream)
|
|
||||||
let stream = got.stream(this.url, {
|
let stream = got.stream(this.url, {
|
||||||
headers : {
|
headers : {
|
||||||
"range" : `bytes=${this.bytes_count}-`
|
"range" : `bytes=${this.bytes_count}-`
|
||||||
@ -172,6 +170,7 @@ export class Stream {
|
|||||||
this.bytes_count += chunk.length
|
this.bytes_count += chunk.length
|
||||||
if(absolute_bytes > (this.per_sec_bytes * 300) && this.per_sec_bytes !== 0){
|
if(absolute_bytes > (this.per_sec_bytes * 300) && this.per_sec_bytes !== 0){
|
||||||
stream.destroy()
|
stream.destroy()
|
||||||
|
stream.unpipe(this.stream)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user