diff --git a/package-lock.json b/package-lock.json index d8caf9c..27757fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "play-dl", - "version": "0.7.2", + "version": "0.7.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "play-dl", - "version": "0.7.2", + "version": "0.7.3", "license": "MIT", "dependencies": { "got": "^11.8.2" diff --git a/package.json b/package.json index dae7b60..625fcdb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "play-dl", - "version": "0.7.2", + "version": "0.7.3", "description": "YouTube, SoundCloud, Spotify streaming for discord.js bots", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/play-dl/YouTube/classes/LiveStream.ts b/play-dl/YouTube/classes/LiveStream.ts index 3743254..f2771cb 100644 --- a/play-dl/YouTube/classes/LiveStream.ts +++ b/play-dl/YouTube/classes/LiveStream.ts @@ -77,6 +77,9 @@ export class LiveStreaming{ this.packet_count++ resolve('') }) + stream.once('error', (err) => { + this.stream.emit('error', err) + }) }) })() } @@ -151,6 +154,9 @@ export class LiveEnded{ this.packet_count++ resolve('') }) + stream.once('error', (err) => { + this.stream.emit('error', err) + }) }) })() } @@ -198,6 +204,11 @@ export class Stream { } let stream = got.stream(this.url) this.request = stream + + stream.once('error', (err) => { + this.stream.emit('error', err) + }) + stream.pipe(this.stream) } @@ -212,6 +223,10 @@ export class Stream { this.per_sec_bytes = Math.ceil((stream.downloadProgress.total as number)/this.duration) }) + stream.once('error', (err) => { + this.stream.emit('error', err) + }) + stream.on('data', (chunk: any) => { this.bytes_count += chunk.length this.stream.write(chunk) @@ -244,6 +259,11 @@ export class Stream { this.bytes_count += chunk.length this.stream.write(chunk) }) + + stream.once('error', (err) => { + this.stream.emit('error', err) + }) + stream.on('data', () => { if(absolute_bytes > (this.per_sec_bytes * 300)){ stream.destroy()