diff options
author | Chocobozzz <me@florianbigard.com> | 2020-09-17 09:20:52 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-09 15:33:04 +0100 |
commit | c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e (patch) | |
tree | 79304b0152b0a38d33b26e65d4acdad0da4032a7 /client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts | |
parent | 110d463fece85e87a26aca48a6048ae0017a27b3 (diff) | |
download | PeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.tar.gz PeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.tar.zst PeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.zip |
Live streaming implementation first step
Diffstat (limited to 'client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts index 8bad81097..47f59a5d0 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts | |||
@@ -7,6 +7,7 @@ import { FormValidatorService } from '@app/shared/shared-forms' | |||
7 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' | 7 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' |
8 | import { LoadingBarService } from '@ngx-loading-bar/core' | 8 | import { LoadingBarService } from '@ngx-loading-bar/core' |
9 | import { VideoPrivacy, VideoUpdate } from '@shared/models' | 9 | import { VideoPrivacy, VideoUpdate } from '@shared/models' |
10 | import { hydrateFormFromVideo } from '../shared/video-edit-utils' | ||
10 | import { VideoSend } from './video-send' | 11 | import { VideoSend } from './video-send' |
11 | 12 | ||
12 | @Component({ | 13 | @Component({ |
@@ -109,7 +110,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
109 | 110 | ||
110 | this.videoCaptions = videoCaptions | 111 | this.videoCaptions = videoCaptions |
111 | 112 | ||
112 | this.hydrateFormFromVideo() | 113 | hydrateFormFromVideo(this.form, this.video, true) |
113 | }, | 114 | }, |
114 | 115 | ||
115 | err => { | 116 | err => { |
@@ -146,31 +147,5 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
146 | console.error(err) | 147 | console.error(err) |
147 | } | 148 | } |
148 | ) | 149 | ) |
149 | |||
150 | } | ||
151 | |||
152 | private hydrateFormFromVideo () { | ||
153 | this.form.patchValue(this.video.toFormPatch()) | ||
154 | |||
155 | const objects = [ | ||
156 | { | ||
157 | url: 'thumbnailUrl', | ||
158 | name: 'thumbnailfile' | ||
159 | }, | ||
160 | { | ||
161 | url: 'previewUrl', | ||
162 | name: 'previewfile' | ||
163 | } | ||
164 | ] | ||
165 | |||
166 | for (const obj of objects) { | ||
167 | fetch(this.video[obj.url]) | ||
168 | .then(response => response.blob()) | ||
169 | .then(data => { | ||
170 | this.form.patchValue({ | ||
171 | [ obj.name ]: data | ||
172 | }) | ||
173 | }) | ||
174 | } | ||
175 | } | 150 | } |
176 | } | 151 | } |