浏览代码

Possible cache support

Use cache for sending previously downloaded videos
master
父节点
当前提交
cf996b28ac
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. +4
    -3
      src/index.ts

+ 4
- 3
src/index.ts 查看文件

@@ -124,12 +124,13 @@ class YouTubeVideoClipEventEmitter extends EventEmitter implements ClipEventEmit
ffmpegProcessAudioStreamArgs.push(clipDuration);
}

const cacheFilename = 'output.webm'; // todo label this on the cache
const ffmpegProcessArgs = [
...ffmpegProcessVideoStreamArgs,
...ffmpegProcessAudioStreamArgs,
'-map', '0:v',
'-map', '1:a',
'output.webm',
cacheFilename,
];
this.emit('process', {
type: 'postprocess',
@@ -142,8 +143,8 @@ class YouTubeVideoClipEventEmitter extends EventEmitter implements ClipEventEmit
this.emit('end');
return;
}
const output = readFileSync('output.webm');
unlinkSync('output.webm');
const output = readFileSync(cacheFilename);
unlinkSync(cacheFilename);
this.emit('process', {
type: 'postprocess',
phase: 'success',


正在加载...
取消
保存