Video Info bug fixes and stream improvements

This commit is contained in:
Atari Tom
2022-05-27 15:35:02 -04:00
parent 126c5f98d1
commit a0e3ae88c2
6 changed files with 16 additions and 12 deletions

View File

@@ -65,6 +65,8 @@ export async function stream_from_info(
): Promise<YouTubeStream> {
if (info.format.length === 0)
throw new Error('Upcoming and premiere videos that are not currently live cannot be streamed.');
if (options.quality && !Number.isInteger(options.quality))
throw new Error("Quality must be set to an integer.")
const final: any[] = [];
if (
@@ -99,6 +101,7 @@ export async function stream_from_info(
info.video_details.durationInSec,
final[0].indexRange.end,
Number(final[0].contentLength),
Number(final[0].bitrate),
info.video_details.url,
options
);