aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2020-03-18 12:44:36 -0500
committerMax Isom <[email protected]>2020-03-18 12:44:36 -0500
commitb1895627dbb43872544f012c58ed3f58de1e89ec (patch)
treec27cbd6c999aee2c5afe8fa98dddff0a8fdf93ef /src
parent11246812a6e5da88750bf4b6ded159dd4020a3d3 (diff)
downloadmuse-b1895627dbb43872544f012c58ed3f58de1e89ec.tar.xz
muse-b1895627dbb43872544f012c58ed3f58de1e89ec.zip
Don't cache long videos
Diffstat (limited to 'src')
-rw-r--r--src/services/player.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/services/player.ts b/src/services/player.ts
index 2ac128b..690d1f7 100644
--- a/src/services/player.ts
+++ b/src/services/player.ts
@@ -211,8 +211,10 @@ export default class {
youtubeStream.pipe(capacitor);
- // Don't cache livestreams
- if (!info.player_response.videoDetails.isLiveContent) {
+ // Don't cache livestreams or long videos
+ const MAX_CACHE_LENGTH_SECONDS = 30 * 60; // 30 minutes
+
+ if (!info.player_response.videoDetails.isLiveContent && parseInt(info.length_seconds, 10) < MAX_CACHE_LENGTH_SECONDS) {
const cacheTempPath = this.getCachedPathTemp(url);
const cacheStream = createWriteStream(cacheTempPath);