Skip to content

Commit 1745555

Browse files
authored
fix: error on non-opus fallback (#200)
1 parent 4420ca1 commit 1745555

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ function download(url, options = {}) {
3232
const demuxer = new prism.opus.WebmDemuxer();
3333
return resolve(ytdl.downloadFromInfo(info, options).pipe(demuxer).on('end', () => demuxer.destroy()));
3434
} else {
35+
const bestFormat = nextBestFormat(info.formats);
36+
if (!bestFormat) return reject('No suitable format found');
3537
const transcoder = new prism.FFmpeg({
3638
args: [
3739
'-reconnect', '1',
3840
'-reconnect_streamed', '1',
3941
'-reconnect_delay_max', '5',
40-
'-i', nextBestFormat(info.formats).url,
42+
'-i', bestFormat.url,
4143
'-analyzeduration', '0',
4244
'-loglevel', '0',
4345
'-f', 's16le',

0 commit comments

Comments
 (0)