Skip to content

Commit 2e161fe

Browse files
committed
fix livestreams being not detected
1 parent e5b5f93 commit 2e161fe

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

index.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ const prism = require('prism-media');
44
function filter(format) {
55
return format.audioEncoding === 'opus' &&
66
format.container === 'webm' &&
7-
format.audio_sample_rate == 48000 &&
8-
!format.live; // prism cannot yet play live webm files
7+
format.audio_sample_rate == 48000;
98
}
109

1110
module.exports = function download(url, options = {}) {
@@ -14,7 +13,7 @@ module.exports = function download(url, options = {}) {
1413
ytdl.getInfo(url, (err, info) => {
1514
if (err) return reject(err);
1615
// Prefer opus
17-
const canDemux = info.formats.find(filter);
16+
const canDemux = info.formats.find(filter) && info.length_seconds != 0;
1817
if (canDemux) Object.assign(options, { filter });
1918
const ytdlStream = ytdl.downloadFromInfo(info, options);
2019
if (canDemux) {

0 commit comments

Comments
 (0)