mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-27 17:22:42 +02:00
Add logic to catch empty formats
This commit is contained in:
parent
35855dd164
commit
0db43cee32
1 changed files with 4 additions and 0 deletions
|
@ -524,6 +524,10 @@ export default class {
|
||||||
format = formats.find(filter);
|
format = formats.find(filter);
|
||||||
|
|
||||||
const nextBestFormat = (formats: ytdl.videoFormat[]): ytdl.videoFormat | undefined => {
|
const nextBestFormat = (formats: ytdl.videoFormat[]): ytdl.videoFormat | undefined => {
|
||||||
|
if (formats.length < 1) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
if (formats[0].isLive) {
|
if (formats[0].isLive) {
|
||||||
formats = formats.sort((a, b) => (b as unknown as {audioBitrate: number}).audioBitrate - (a as unknown as {audioBitrate: number}).audioBitrate); // Bad typings
|
formats = formats.sort((a, b) => (b as unknown as {audioBitrate: number}).audioBitrate - (a as unknown as {audioBitrate: number}).audioBitrate); // Bad typings
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue