aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-edit/video-update.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-09-17 09:20:52 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitc6c0fa6cd8fe8f752463d8982c3dbcd448739c4e (patch)
tree79304b0152b0a38d33b26e65d4acdad0da4032a7 /client/src/app/+videos/+video-edit/video-update.component.ts
parent110d463fece85e87a26aca48a6048ae0017a27b3 (diff)
downloadPeerTube-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-update.component.ts')
-rw-r--r--client/src/app/+videos/+video-edit/video-update.component.ts38
1 files changed, 8 insertions, 30 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 20438a2d3..c0f46acd2 100644
--- a/client/src/app/+videos/+video-edit/video-update.component.ts
+++ b/client/src/app/+videos/+video-edit/video-update.component.ts
@@ -5,7 +5,8 @@ import { Notifier } from '@app/core'
5import { FormReactive, FormValidatorService, SelectChannelItem } from '@app/shared/shared-forms' 5import { FormReactive, FormValidatorService, SelectChannelItem } from '@app/shared/shared-forms'
6import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main' 6import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main'
7import { LoadingBarService } from '@ngx-loading-bar/core' 7import { LoadingBarService } from '@ngx-loading-bar/core'
8import { VideoPrivacy } from '@shared/models' 8import { VideoPrivacy, VideoLive } from '@shared/models'
9import { hydrateFormFromVideo } from './shared/video-edit-utils'
9 10
10@Component({ 11@Component({
11 selector: 'my-videos-update', 12 selector: 'my-videos-update',
@@ -14,11 +15,12 @@ import { VideoPrivacy } from '@shared/models'
14}) 15})
15export class VideoUpdateComponent extends FormReactive implements OnInit { 16export class VideoUpdateComponent extends FormReactive implements OnInit {
16 video: VideoEdit 17 video: VideoEdit
18 userVideoChannels: SelectChannelItem[] = []
19 videoCaptions: VideoCaptionEdit[] = []
20 videoLive: VideoLive
17 21
18 isUpdatingVideo = false 22 isUpdatingVideo = false
19 userVideoChannels: SelectChannelItem[] = []
20 schedulePublicationPossible = false 23 schedulePublicationPossible = false
21 videoCaptions: VideoCaptionEdit[] = []
22 waitTranscodingEnabled = true 24 waitTranscodingEnabled = true
23 25
24 private updateDone = false 26 private updateDone = false
@@ -40,10 +42,11 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
40 42
41 this.route.data 43 this.route.data
42 .pipe(map(data => data.videoData)) 44 .pipe(map(data => data.videoData))
43 .subscribe(({ video, videoChannels, videoCaptions }) => { 45 .subscribe(({ video, videoChannels, videoCaptions, videoLive }) => {
44 this.video = new VideoEdit(video) 46 this.video = new VideoEdit(video)
45 this.userVideoChannels = videoChannels 47 this.userVideoChannels = videoChannels
46 this.videoCaptions = videoCaptions 48 this.videoCaptions = videoCaptions
49 this.videoLive = videoLive
47 50
48 this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE 51 this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE
49 52
@@ -53,7 +56,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
53 } 56 }
54 57
55 // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout 58 // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout
56 setTimeout(() => this.hydrateFormFromVideo()) 59 setTimeout(() => hydrateFormFromVideo(this.form, this.video, true))
57 }, 60 },
58 61
59 err => { 62 err => {
@@ -133,29 +136,4 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
133 pluginData: this.video.pluginData 136 pluginData: this.video.pluginData
134 }) 137 })
135 } 138 }
136
137 private hydrateFormFromVideo () {
138 this.form.patchValue(this.video.toFormPatch())
139
140 const objects = [
141 {
142 url: 'thumbnailUrl',
143 name: 'thumbnailfile'
144 },
145 {
146 url: 'previewUrl',
147 name: 'previewfile'
148 }
149 ]
150
151 for (const obj of objects) {
152 fetch(this.video[obj.url])
153 .then(response => response.blob())
154 .then(data => {
155 this.form.patchValue({
156 [ obj.name ]: data
157 })
158 })
159 }
160 }
161} 139}