vdj 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vdj",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -62,20 +62,29 @@ export default class YouTubeSong extends Song {
62
62
  }
63
63
 
64
64
  public stream(): ReadableStream | null {
65
- const stream = ytdlexec(
66
- this.streamURL,
67
- {
68
- output: '-',
69
- format: 'bestaudio/best',
70
- limitRate: '1M',
71
- rmCacheDir: true,
72
- verbose: true,
73
- },
74
- { stdio: ['ignore', 'pipe', 'ignore'], }
75
- );
76
- stream.on('error', (err) => {
65
+ try {
66
+ const stream = ytdlexec(
67
+ this.streamURL,
68
+ {
69
+ output: '-',
70
+ format: 'bestaudio/best',
71
+ limitRate: '1M',
72
+ rmCacheDir: true,
73
+ verbose: true,
74
+ },
75
+ { stdio: ['ignore', 'pipe', 'ignore'], }
76
+ );
77
+ stream.on('error', (err) => {
78
+ this.logger && this.logger(`[${this.type}] Error while streaming: ${err}`);
79
+ });
80
+ stream.catch((err) => {
81
+ this.logger && this.logger(`[${this.type}] Error while streaming: ${err}`);
82
+ });
83
+ return stream.stdout;
84
+ }
85
+ catch (err) {
77
86
  this.logger && this.logger(`[${this.type}] Error while streaming: ${err}`);
78
- });
79
- return stream.stdout;
87
+ }
88
+ return null;
80
89
  }
81
90
  }