+ this.trackChannelChange()
+ this.trackPrivacyChange()
+ }
+
+ ngOnInit () {
+ this.updateForm()
+
+ this.videoCategories = this.serverService.getVideoCategories()
+ this.videoLicences = this.serverService.getVideoLicences()
+ this.videoLanguages = this.serverService.getVideoLanguages()
+ console.log(this.videoLanguages)
+
+ setTimeout(() => this.minScheduledDate = new Date(), 1000 * 60) // Update every minute
+ }
+
+ private trackPrivacyChange () {
+ // We will update the "support" field depending on the channel
+ this.form.controls[ 'privacy' ]
+ .valueChanges
+ .pipe(map(res => parseInt(res.toString(), 10)))
+ .subscribe(
+ newPrivacyId => {
+ this.schedulePublicationEnabled = newPrivacyId === this.SPECIAL_SCHEDULED_PRIVACY
+
+ // Value changed
+ const scheduleControl = this.form.get('schedulePublicationAt')
+ const waitTranscodingControl = this.form.get('waitTranscoding')
+
+ if (this.schedulePublicationEnabled) {
+ scheduleControl.setValidators([ Validators.required ])
+
+ waitTranscodingControl.disable()
+ waitTranscodingControl.setValue(false)
+ } else {
+ scheduleControl.clearValidators()
+
+ waitTranscodingControl.enable()
+ waitTranscodingControl.setValue(true)
+ }
+
+ scheduleControl.updateValueAndValidity()
+ waitTranscodingControl.updateValueAndValidity()
+ }
+ )
+ }
+
+ private trackChannelChange () {