- .switchMap(video => {
- return this.videoService
- .loadCompleteDescription(video.descriptionPath)
- .map(description => Object.assign(video, { description }))
- })
- .subscribe(
- video => {
- this.video = new VideoEdit(video)
-
- // We cannot set private a video that was not private
- if (video.privacy !== VideoPrivacy.PRIVATE) {
- const newVideoPrivacies = []
- for (const p of this.videoPrivacies) {
- if (p.id !== VideoPrivacy.PRIVATE) newVideoPrivacies.push(p)
+ .pipe(
+ switchMap(video => {
+ return this.videoService
+ .loadCompleteDescription(video.descriptionPath)
+ .pipe(map(description => Object.assign(video, { description })))
+ }),
+ switchMap(video => {
+ return this.videoChannelService
+ .listAccountVideoChannels(video.account)
+ .pipe(
+ map(result => result.data),
+ map(videoChannels => videoChannels.map(c => ({ id: c.id, label: c.displayName, support: c.support }))),
+ map(videoChannels => ({ video, videoChannels }))
+ )
+ }),
+ switchMap(({ video, videoChannels }) => {
+ return this.videoCaptionService
+ .listCaptions(video.id)
+ .pipe(
+ map(result => result.data),
+ map(videoCaptions => ({ video, videoChannels, videoCaptions }))
+ )
+ })
+ )
+ .subscribe(
+ ({ video, videoChannels, videoCaptions }) => {
+ this.video = new VideoEdit(video)
+ this.userVideoChannels = videoChannels
+ this.videoCaptions = videoCaptions
+
+ // We cannot set private a video that was not private
+ if (this.video.privacy !== VideoPrivacy.PRIVATE) {
+ this.videoPrivacies = this.videoPrivacies.filter(p => p.id.toString() !== VideoPrivacy.PRIVATE.toString())
+ } else { // We can schedule video publication only if it it is private
+ this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE