diff options
| author | Max Isom <[email protected]> | 2021-11-24 13:16:44 -0600 |
|---|---|---|
| committer | Max Isom <[email protected]> | 2021-11-24 13:16:44 -0600 |
| commit | 9f9469f682e68c45d2c20251bfa5726e7c415b80 (patch) | |
| tree | 282a853f37e21af72d355c38a8acca480011d82b /src/services | |
| parent | 49664be9e138b71eb920600cd24b4510f5f2e662 (diff) | |
| download | muse-9f9469f682e68c45d2c20251bfa5726e7c415b80.tar.xz muse-9f9469f682e68c45d2c20251bfa5726e7c415b80.zip | |
Add back -re option on uncached streams
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/player.ts | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/services/player.ts b/src/services/player.ts index 5f4d368..67b8b38 100644 --- a/src/services/player.ts +++ b/src/services/player.ts @@ -364,6 +364,17 @@ export default class { // Create stream and pipe to capacitor return new Promise((resolve, reject) => { + const capacitor = new WriteStream(); + + // Cache video if necessary + if (shouldCacheVideo) { + const cacheStream = this.fileCache.createWriteStream(this.getHashForCache(url)); + + capacitor.createReadStream().pipe(cacheStream); + } else { + ffmpegInputOptions.push('-re'); + } + const youtubeStream = ffmpeg(ffmpegInput) .inputOptions(ffmpegInputOptions) .noVideo() @@ -374,17 +385,8 @@ export default class { reject(error); }); - const capacitor = new WriteStream(); - youtubeStream.pipe(capacitor); - // Cache video if necessary - if (shouldCacheVideo) { - const cacheStream = this.fileCache.createWriteStream(this.getHashForCache(url)); - - capacitor.createReadStream().pipe(cacheStream); - } - resolve(capacitor.createReadStream()); }); } |
