mirror of
https://github.com/LuanRT/googlevideo.git
synced 2026-06-13 08:42:31 +00:00
fix(examples): stop progress bars on completion
This commit is contained in:
@@ -6,7 +6,7 @@ import { Innertube, UniversalCache } from 'youtubei.js';
|
||||
import GoogleVideo, { type Format, MediaType } from '../../dist/src/index.js';
|
||||
|
||||
const progressBars = new cliProgress.MultiBar({
|
||||
clearOnComplete: false,
|
||||
stopOnComplete: true,
|
||||
hideCursor: true
|
||||
}, cliProgress.Presets.rect);
|
||||
|
||||
@@ -132,6 +132,8 @@ if (audioOutput)
|
||||
if (videoOutput)
|
||||
videoOutput.end();
|
||||
|
||||
progressBars.stop();
|
||||
|
||||
const outputFilename = `${sanitizedTitle}_final.webm`;
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Innertube, UniversalCache } from 'youtubei.js';
|
||||
import GoogleVideo, { type Format, MediaType } from '../../dist/src/index.js';
|
||||
|
||||
const progressBars = new cliProgress.MultiBar({
|
||||
clearOnComplete: false,
|
||||
stopOnComplete: true,
|
||||
hideCursor: true
|
||||
}, cliProgress.Presets.rect);
|
||||
|
||||
@@ -126,16 +126,6 @@ serverAbrStream.on('error', (error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
serverAbrStream.on('end', () => {
|
||||
progressBars.stop();
|
||||
|
||||
if (audioOutput)
|
||||
audioOutput.end();
|
||||
|
||||
if (videoOutput)
|
||||
videoOutput.end();
|
||||
});
|
||||
|
||||
await serverAbrStream.init({
|
||||
audioFormats: [ selectedAudioFormat ],
|
||||
videoFormats: [ selectedVideoFormat ],
|
||||
@@ -148,4 +138,12 @@ await serverAbrStream.init({
|
||||
mediaType: MediaType.MEDIA_TYPE_DEFAULT,
|
||||
startTimeMs: 0
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
progressBars.stop();
|
||||
|
||||
if (audioOutput)
|
||||
audioOutput.end();
|
||||
|
||||
if (videoOutput)
|
||||
videoOutput.end();
|
||||
Reference in New Issue
Block a user