+ this.schedulerInterval = setInterval(() => this.minScheduledDate = new Date(), 1000 * 60) // Update every minute
+ }
+
+ ngOnDestroy () {
+ if (this.schedulerInterval) clearInterval(this.schedulerInterval)
+ }
+
+ getExistingCaptions () {
+ return this.videoCaptions.map(c => c.language.id)
+ }
+
+ onCaptionAdded (caption: VideoCaptionEdit) {
+ this.videoCaptions.push(
+ Object.assign(caption, { action: 'CREATE' as 'CREATE' })
+ )
+ }
+
+ deleteCaption (caption: VideoCaptionEdit) {
+ // This caption is not on the server, just remove it from our array
+ if (caption.action === 'CREATE') {
+ removeElementFromArray(this.videoCaptions, caption)
+ return
+ }
+
+ caption.action = 'REMOVE' as 'REMOVE'
+ }
+
+ openAddCaptionModal () {
+ this.videoCaptionAddModal.show()