diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-20 11:05:10 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-20 11:05:10 +0100 |
commit | 8fa5653ad8bebed9a1b2a649e8ea160184d52408 (patch) | |
tree | eb71b80545a89d73e9b0ef09c695b509360da85c /server/lib/cache | |
parent | 15ca2e871aa069e596baf9da22b3d2a1ab1a0b1a (diff) | |
download | PeerTube-8fa5653ad8bebed9a1b2a649e8ea160184d52408.tar.gz PeerTube-8fa5653ad8bebed9a1b2a649e8ea160184d52408.tar.zst PeerTube-8fa5653ad8bebed9a1b2a649e8ea160184d52408.zip |
Add transition on play/loading player
Diffstat (limited to 'server/lib/cache')
-rw-r--r-- | server/lib/cache/videos-preview-cache.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/lib/cache/videos-preview-cache.ts b/server/lib/cache/videos-preview-cache.ts index c5bda8dd8..28908b186 100644 --- a/server/lib/cache/videos-preview-cache.ts +++ b/server/lib/cache/videos-preview-cache.ts | |||
@@ -33,7 +33,12 @@ class VideosPreviewCache { | |||
33 | }) | 33 | }) |
34 | } | 34 | } |
35 | 35 | ||
36 | getPreviewPath (key: string) { | 36 | async getPreviewPath (key: string) { |
37 | const video = await VideoModel.loadByUUID(key) | ||
38 | if (!video) return undefined | ||
39 | |||
40 | if (video.isOwned()) return join(CONFIG.STORAGE.PREVIEWS_DIR, video.getPreviewName()) | ||
41 | |||
37 | return new Promise<string>((res, rej) => { | 42 | return new Promise<string>((res, rej) => { |
38 | this.lru.get(key, (err, value) => { | 43 | this.lru.get(key, (err, value) => { |
39 | err ? rej(err) : res(value) | 44 | err ? rej(err) : res(value) |
@@ -42,10 +47,10 @@ class VideosPreviewCache { | |||
42 | } | 47 | } |
43 | 48 | ||
44 | private async loadPreviews (key: string) { | 49 | private async loadPreviews (key: string) { |
45 | const video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(key) | 50 | const video = await VideoModel.loadByUUID(key) |
46 | if (!video) return undefined | 51 | if (!video) return undefined |
47 | 52 | ||
48 | if (video.isOwned()) return join(CONFIG.STORAGE.PREVIEWS_DIR, video.getPreviewName()) | 53 | if (video.isOwned()) throw new Error('Cannot load preview of owned video.') |
49 | 54 | ||
50 | const res = await this.saveRemotePreviewAndReturnPath(video) | 55 | const res = await this.saveRemotePreviewAndReturnPath(video) |
51 | 56 | ||