Skip to content

Commit cd14bc9

Browse files
committed
WIP: store thumbnails on object storage
1 parent 4e51c83 commit cd14bc9

File tree

45 files changed

+759
-770
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+759
-770
lines changed

client/src/app/+videos/+video-watch/video-watch.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
932932
private updatePlayerOnNoLive () {
933933
this.peertubePlayer.unload()
934934
this.peertubePlayer.disable()
935-
this.peertubePlayer.setPoster(this.video.previewPath)
935+
this.peertubePlayer.setPoster(this.video.previewUrl)
936936
}
937937

938938
private buildHotkeysHelp (video: Video) {

client/src/app/shared/shared-main/video/video-edit.model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ export class VideoEdit implements VideoUpdate {
6262
this.commentsPolicy = video.commentsPolicy.id
6363
this.downloadEnabled = video.downloadEnabled
6464

65-
if (video.thumbnailPath) this.thumbnailUrl = getAbsoluteAPIUrl() + video.thumbnailPath
66-
if (video.previewPath) this.previewUrl = getAbsoluteAPIUrl() + video.previewPath
65+
if (video.thumbnailUrl) this.thumbnailUrl = video.thumbnailUrl
66+
if (video.previewUrl) this.previewUrl = video.previewUrl
6767

6868
this.scheduleUpdate = video.scheduledUpdate
6969
this.originallyPublishedAt = video.originallyPublishedAt

client/src/app/shared/shared-main/video/video.model.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,12 @@ export class Video implements VideoServerModel {
4848

4949
name: string
5050
serverHost: string
51-
thumbnailPath: string
5251
thumbnailUrl: string
5352

5453
aspectRatio: number
5554

5655
isLive: boolean
5756

58-
previewPath: string
5957
previewUrl: string
6058

6159
embedPath: string
@@ -151,15 +149,9 @@ export class Video implements VideoServerModel {
151149
this.isLocal = hash.isLocal
152150
this.name = hash.name
153151

154-
this.thumbnailPath = hash.thumbnailPath
155-
this.thumbnailUrl = this.thumbnailPath
156-
? hash.thumbnailUrl || (absoluteAPIUrl + hash.thumbnailPath)
157-
: null
152+
this.thumbnailUrl = hash.thumbnailUrl
158153

159-
this.previewPath = hash.previewPath
160-
this.previewUrl = this.previewPath
161-
? hash.previewUrl || (absoluteAPIUrl + hash.previewPath)
162-
: null
154+
this.previewUrl = hash.previewUrl
163155

164156
this.embedPath = hash.embedPath
165157
this.embedUrl = hash.embedUrl || (getAbsoluteEmbedUrl() + hash.embedPath)

client/src/app/shared/shared-tables/video-cell.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<a [href]="getVideoUrl()" class="table-video-link" [title]="video().name" target="_blank" rel="noopener noreferrer">
22
<div class="table-video">
33
<div class="table-video-image">
4-
<img [src]="video().thumbnailPath" alt="">
4+
<img [src]="video().thumbnailUrl" alt="">
55

66
<ng-content select="[image]"></ng-content>
77
</div>

client/src/app/shared/shared-video-playlist/video-playlist.model.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export class VideoPlaylist implements ServerVideoPlaylist {
3434
ownerAccount: AccountSummary
3535
videoChannel?: VideoChannelSummary
3636

37-
thumbnailPath: string
3837
thumbnailUrl: string
3938

4039
embedPath: string
@@ -63,11 +62,7 @@ export class VideoPlaylist implements ServerVideoPlaylist {
6362
this.description = hash.description
6463
this.privacy = hash.privacy
6564

66-
this.thumbnailPath = hash.thumbnailPath
67-
68-
this.thumbnailUrl = this.thumbnailPath
69-
? hash.thumbnailUrl || (absoluteAPIUrl + hash.thumbnailPath)
70-
: absoluteAPIUrl + '/client/assets/images/default-playlist.jpg'
65+
this.thumbnailUrl = hash.thumbnailUrl || absoluteAPIUrl + '/client/assets/images/default-playlist.jpg'
7166

7267
this.embedPath = hash.embedPath
7368
this.embedUrl = hash.embedUrl || (getAbsoluteEmbedUrl() + hash.embedPath)

client/src/standalone/player/src/shared/playlist/playlist-menu-item.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class PlaylistMenuItem extends Component {
8383
positionBlock.appendChild(player)
8484

8585
const thumbnail = super.createEl('img', {
86-
src: window.location.origin + videoElement.video.thumbnailPath
86+
src: window.location.origin + videoElement.video.thumbnailUrl
8787
})
8888

8989
const infoBlock = super.createEl('div', {

client/src/standalone/videos/embed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ export class PeerTubeEmbed {
381381

382382
this.peertubePlayer.unload()
383383
this.peertubePlayer.disable()
384-
this.peertubePlayer.setPoster(video.previewPath)
384+
this.peertubePlayer.setPoster(video.previewUrl)
385385
}
386386

387387
private async handlePasswordError (err: PeerTubeServerError) {

client/src/standalone/videos/shared/player-options-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export class PlayerOptionsBuilder {
294294
duration: video.duration,
295295
videoRatio: video.aspectRatio,
296296

297-
poster: getBackendUrl() + video.previewPath,
297+
poster: video.previewUrl,
298298

299299
embedUrl: getBackendUrl() + video.embedPath,
300300
embedTitle: video.name,

config/default.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ object_storage:
266266
prefix: ''
267267
base_url: ''
268268

269+
# Video thumbnails
270+
thumbnails:
271+
bucket_name: 'thumbnails'
272+
prefix: ''
273+
base_url: ''
274+
269275
log:
270276
level: 'info' # 'debug' | 'info' | 'warn' | 'error'
271277

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@
150150
"ip-anonymize": "^0.1.0",
151151
"ipaddr.js": "2.2.0",
152152
"iso-639-3": "3.0.1",
153-
"jimp": "^0.22.4",
154153
"js-yaml": "^4.0.0",
155154
"jsonld": "~8.3.1",
156155
"jsonwebtoken": "^9.0.2",
@@ -181,6 +180,7 @@
181180
"sanitize-html": "2.x",
182181
"sequelize": "~6.37.3",
183182
"sequelize-typescript": "^2.0.0-beta.1",
183+
"sharp": "^0.33.5",
184184
"short-uuid": "^5.2.0",
185185
"sitemap": "^8.0.0",
186186
"socket.io": "^4.5.4",

0 commit comments

Comments
 (0)