+ switchMap(() => this.videoCaptionService.updateCaptions(this.videoEdit.id, this.videoCaptions)),
+
+ switchMap(() => {
+ if (!this.liveVideo) return of(undefined)
+
+ const saveReplay = !!this.form.value.saveReplay
+ const replaySettings = saveReplay
+ ? { privacy: this.form.value.replayPrivacy }
+ : undefined
+
+ const liveVideoUpdate: LiveVideoUpdate = {
+ saveReplay,
+ replaySettings,
+ permanentLive: !!this.form.value.permanentLive,
+ latencyMode: this.form.value.latencyMode
+ }
+
+ // Don't update live attributes if they did not change
+ const baseVideo = pick(this.liveVideo, Object.keys(liveVideoUpdate) as (keyof LiveVideoUpdate)[])
+ const liveChanged = !simpleObjectsDeepEqual(baseVideo, liveVideoUpdate)
+ if (!liveChanged) return of(undefined)
+
+ return this.liveVideoService.updateLive(this.videoEdit.id, liveVideoUpdate)
+ })