+ // Update the video
+ this.videoService.updateVideo(this.video)
+ .pipe(
+ // Then update captions
+ switchMap(() => this.videoCaptionService.updateCaptions(this.video.id, this.videoCaptions))
+ )
+ .subscribe(
+ () => {
+ this.updateDone = true
+ this.isUpdatingVideo = false
+ this.loadingBar.complete()
+ this.notifier.success(this.i18n('Video updated.'))
+ this.router.navigate([ '/videos/watch', this.video.uuid ])
+ },
+
+ err => {
+ this.loadingBar.complete()
+ this.isUpdatingVideo = false
+ this.notifier.error(err.message)
+ console.error(err)
+ }
+ )