diff options
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/video-playlist/video-playlist.model.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/client/src/app/shared/video-playlist/video-playlist.model.ts b/client/src/app/shared/video-playlist/video-playlist.model.ts index 7e311aa54..6f27e7475 100644 --- a/client/src/app/shared/video-playlist/video-playlist.model.ts +++ b/client/src/app/shared/video-playlist/video-playlist.model.ts | |||
@@ -38,6 +38,9 @@ export class VideoPlaylist implements ServerVideoPlaylist { | |||
38 | videoChannelBy?: string | 38 | videoChannelBy?: string |
39 | videoChannelAvatarUrl?: string | 39 | videoChannelAvatarUrl?: string |
40 | 40 | ||
41 | private thumbnailVersion: number | ||
42 | private originThumbnailUrl: string | ||
43 | |||
41 | constructor (hash: ServerVideoPlaylist, translations: {}) { | 44 | constructor (hash: ServerVideoPlaylist, translations: {}) { |
42 | const absoluteAPIUrl = getAbsoluteAPIUrl() | 45 | const absoluteAPIUrl = getAbsoluteAPIUrl() |
43 | 46 | ||
@@ -54,6 +57,7 @@ export class VideoPlaylist implements ServerVideoPlaylist { | |||
54 | 57 | ||
55 | if (this.thumbnailPath) { | 58 | if (this.thumbnailPath) { |
56 | this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath | 59 | this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath |
60 | this.originThumbnailUrl = this.thumbnailUrl | ||
57 | } else { | 61 | } else { |
58 | this.thumbnailUrl = window.location.origin + '/client/assets/images/default-playlist.jpg' | 62 | this.thumbnailUrl = window.location.origin + '/client/assets/images/default-playlist.jpg' |
59 | } | 63 | } |
@@ -81,4 +85,13 @@ export class VideoPlaylist implements ServerVideoPlaylist { | |||
81 | this.displayName = peertubeTranslate(this.displayName, translations) | 85 | this.displayName = peertubeTranslate(this.displayName, translations) |
82 | } | 86 | } |
83 | } | 87 | } |
88 | |||
89 | refreshThumbnail () { | ||
90 | if (!this.originThumbnailUrl) return | ||
91 | |||
92 | if (!this.thumbnailVersion) this.thumbnailVersion = 0 | ||
93 | this.thumbnailVersion++ | ||
94 | |||
95 | this.thumbnailUrl = this.originThumbnailUrl + '?v' + this.thumbnailVersion | ||
96 | } | ||
84 | } | 97 | } |