diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-16 16:35:32 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-16 16:35:32 +0100 |
commit | 6de36768980ef6063b8fcd730b59fa685dd2b99c (patch) | |
tree | a8e5a87b14013b33bf2d306552a380c407a1551d /client/src/app/videos/+video-edit/video-update.component.ts | |
parent | b6a4fd6b099b3363ac59c06cfd81b54e1356d8bc (diff) | |
download | PeerTube-6de36768980ef6063b8fcd730b59fa685dd2b99c.tar.gz PeerTube-6de36768980ef6063b8fcd730b59fa685dd2b99c.tar.zst PeerTube-6de36768980ef6063b8fcd730b59fa685dd2b99c.zip |
Add ability to update thumbnail and preview on client
Diffstat (limited to 'client/src/app/videos/+video-edit/video-update.component.ts')
-rw-r--r-- | client/src/app/videos/+video-edit/video-update.component.ts | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts index 7f41b56d8..ad6452835 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts | |||
@@ -48,11 +48,10 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
48 | this.buildForm() | 48 | this.buildForm() |
49 | 49 | ||
50 | this.serverService.videoPrivaciesLoaded | 50 | this.serverService.videoPrivaciesLoaded |
51 | .subscribe( | 51 | .subscribe(() => this.videoPrivacies = this.serverService.getVideoPrivacies()) |
52 | () => this.videoPrivacies = this.serverService.getVideoPrivacies() | ||
53 | ) | ||
54 | 52 | ||
55 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) | 53 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) |
54 | .catch(err => console.error('Cannot populate async user video channels.', err)) | ||
56 | 55 | ||
57 | const uuid: string = this.route.snapshot.params['uuid'] | 56 | const uuid: string = this.route.snapshot.params['uuid'] |
58 | this.videoService.getVideo(uuid) | 57 | this.videoService.getVideo(uuid) |
@@ -116,5 +115,26 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
116 | 115 | ||
117 | private hydrateFormFromVideo () { | 116 | private hydrateFormFromVideo () { |
118 | this.form.patchValue(this.video.toJSON()) | 117 | this.form.patchValue(this.video.toJSON()) |
118 | |||
119 | const objects = [ | ||
120 | { | ||
121 | url: 'thumbnailUrl', | ||
122 | name: 'thumbnailfile' | ||
123 | }, | ||
124 | { | ||
125 | url: 'previewUrl', | ||
126 | name: 'previewfile' | ||
127 | } | ||
128 | ] | ||
129 | |||
130 | for (const obj of objects) { | ||
131 | fetch(this.video[obj.url]) | ||
132 | .then(response => response.blob()) | ||
133 | .then(data => { | ||
134 | this.form.patchValue({ | ||
135 | [ obj.name ]: data | ||
136 | }) | ||
137 | }) | ||
138 | } | ||
119 | } | 139 | } |
120 | } | 140 | } |